1. how to use to_date date function in hibernate Expression forum.hibernate.orgHello, I am running a search on the database base, based on date range. The column holding the date is of type DATE. Since i am using sql.date object to search for the values, the date comparison does not return the expected values. The hibernate version used is 2.1. Please guide me in this regard. Thanks in advance. regards sreedhar |
2. arithmetic expressions in hql select clause forum.hibernate.orgIts a given that it will be supported but I suppose it should be documented anyway. I have not kept upto date with what is going on with the parser or requests for it in JIRA. You should have a look. I do know some work has been done but I don't know what state it is in at this point. ... |
3. Expression.eq not working with many-to-one forum.hibernate.org |
4. Trouble creating an IN expression. forum.hibernate.org |
5. outer or full join must be followed by path expression forum.hibernate.orgSelect new MensagemVersao(mv.Id.CodigoTipoMensagem,mv.Id.Numero,mv.Descricao,mv.DataAprovacao,tm.Descricao,tm.DataAprovacao) From MensagemVersao mv join TipoMensagem tm where mv.DataAprovacao is not null and mv.Id.Numero = (select max(mv.Id.Numero) from MensagemVersao mv join TipoMensagem tm where mv.Id.CodigoTipoMensagem = 'CH03' and mv.DataAprovacao is not null ) and mv.Id.CodigoTipoMensagem = 'CH03' . outer or full join must be followed by path expression [ ... |
6. queries with regular expressions on Oracle 10g via Hibernate forum.hibernate.org[b]Hibernate version: 2.0.3[/b] [b]Name and version of the database you are using: Oracle 10g[/b] hi, all sides, used oracle 10g regular expression feature with hibernate as in the following: 1. negation of an REGEXP_LIKE expression: session.find("select count(a) from a in class PersistentEntry where ( ( NOT ( REGEXP_LIKE( a.columnname, '^.*host=.*,cn=Hosts,cn=Resources$') ) ))" ) it lead to an QueryException. 2. negation of ... |
7. Bug: HQL Expressions in WHERE clauses of HQL aren't expected forum.hibernate.orgpackage org.hibernate.bug1; public class BaBu1_Record { private int m_key; private double m_a; /** * @return the value A */ public double getA() { ... |
8. HQL: How use a parameter in a like %foo% expression? forum.hibernate.orgHow do you "bind" the value [Mac'Donalds] into the query? Using parameters? If so, Hibernate simply passes those values onto the jdbc PreparedStatement as-is and it is actually the resposnibility of the jdbc driver to ensure that parameter bind values are properly escaped. If that is not the case, then you have a very buggy jdbc driver. If you do not ... |
9. outer or full join must be followed by path expression forum.hibernate.orgHi all, I got a problem during one-to-many relation. Query query =session.createQuery("select quantity.quantity ,quantity.product_id from general.Quantity quantity inner join general.Product as p on quantity.product_id= p.product_id "); Quantity.hbm contains |
10. how to handle subquery with Criteria or Expression? forum.hibernate.orgselect user0_.user_id as user1_1_, user0_.password as password0_1_, user0_.email as email0_1_, user0_.user_name as user4_0_1_, user0_.address1 as address5_0_1_, user0_.address2 as address6_0_1_, user0_.phone as phone0_1_, user0_.status as status0_1_, shoppingin1_.userId as userId3_, shoppingin1_.shopping_id as shopping1_3_, shoppingin1_.shopping_id as shopping1_ 0_, shoppingin1_.user_id as user2_2_0_, shoppingin1_.description as descript3_2_0_ from userinfo user0_, (select * from shopping_info where shopping_id > 2) shoppingin1_ where user0_.user_id=shoppingin1_.userId(+) user0_.status > 1 order by shoppingin1_.shooping_id ... |
11. HQL : how to escape % and _ in like expression forum.hibernate.org |
12. Help with Expression forum.hibernate.orgHi , Iam facing a problem using createcriteria with expression, I have somtinh like this. Criteria criteria = hibernateSession.createCriteria(EmployeeDTO.class); criteria.add(Expression.eq("deptnum ",DeptNum)); criteria.add(Expression.like("empName",LastName,MatchMode.END)); List values = criteria.list(); Iam getting the size of the list as 6 which is correct.But the DTOs returned is the same i.e i et the same instance of dto 6 times instead of 6 different DTOs. for (Iterator ... |
13. Expression.like doesn't work with MSSQL forum.hibernate.org |
14. Hibernate Query with expression like '%?%' forum.hibernate.orgHi guys! Im using Hibernate Query with Positional Parameter (like JDBC PreparedStatement '?'). When I try to use the expression '%?%' like " ...where table.name like '%?%' ", an error occurs . The hibernate version is 2 and I am using Java5. Code: net.sf.hibernate.exception.GenericJDBCException: Could not execute query at net.sf.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:90) at net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:79) ... |
15. outer or full join must be followed by path expression forum.hibernate.orgCan someone comment on this pls? I am getting the above exception, and here is my query pack = abc.def.ghi String sb = ("from Course as course join "+pack+"Group as gr join "+pack+"GroupEvent as groupEvent where groupEvent.eventReleased = 1 "); Query query = session.createQuery(sb.toString()); List list = query.list(); and here are my hibernate files, |
17. more than one expression in IN cluase forum.hibernate.org |
18. Expression.like do not work forum.hibernate.org//Create session HibernateBusinessObject hbo = new HibernateBusinessObject(); List list1 = hbo.getSession().createCriteria(Author.class).add([color=red]Expression.like[/color]("au_lname", s1, MatchMode.ANYWHERE)).list(); or //s1 is a String parameter of method List list1; Criteria criteira1 = hbo.getSession().createCriteria(Author.class); criteira1.add([color=red]Expression.like[/color]("au_lname", "%" ... |
19. Criteria expression fails forum.hibernate.orgCriteria dom = session.createCriteria(Domain.class); if (!workmate.getDomainId().equals(new Integer(0))) { dom.add( Expression.like( "id", workmate.getDomainId().toString())); } else if (workmate.getDomainId().equals(new Integer(0))) { dom.add( Expression.like( "id", "'%'")); } if(!search.equalsIgnoreCase("")) { dom.add( Expression.like("name", search, MatchMode.ANYWHERE)); } else { dom.add( Expression.like("name", ... |
20. what's wrong with this expression!?? forum.hibernate.orgNow I stepped over to sqlQuery since criteria didn't work. When I change "%" in to "'%'" during debug the code runs through en I get a result. Second run the code throws an error. When I change back to "%" the code runs through again. Second run it again trows error. Is this a bug in hibernate? or am I ... |
21. Criteria and Expression.in restriction forum.hibernate.orgI found a strange behavior with criteria and Expression.in restriction: I have a method that receives a session, creates a criteria and returns a List. If I pass a session = sessionFactory.openSession(); the criteria works correctly; if I pass a: Session dom4jSession = session.getSession(EntityMode.DOM4J); the criteria throws an exception: In detail: public Document getXMLFunction(){ Session session = HibernateSessionFactory.currentSession(); Transaction tx = ... |
22. a set contains an object expression in Criteria API forum.hibernate.orgHello, I have a Song class and a Value class who have a many-to-many relationship between them (through the table songvalue). Now i want to select all songs that contain a certain value object with the criterion api. i can't just use a bidirectional binding, by just doing value.getSongs() or something, because i need it as a Criterion in an algorithm ... |
23. Property Path Expressions and ASTQueryTranslatorFactory forum.hibernate.orgBeginner Joined: Fri Apr 15, 2005 3:08 pm Posts: 26 ----------------------------------------------------------------------------------- Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:3.0.5 Mapping documents (relevant portions): Code: |
24. Hibernate Regular Expression Support forum.hibernate.orgHello Hibernate gurus, I was wondering if Hibernate offers any support for regular expressions when performing database queries. Specifically, I would like to perform the following... I have a table in my database that stores contact information and contains a field for a phone number (among other things). Say a user of the system would like to look up the information ... |
25. HQL error on parameterized expression in function forum.hibernate.org |
26. sysdate expression throw unknow column exception forum.hibernate.org |
27. Expression.eq( ... usage for case insesitive forum.hibernate.org |
28. how to query with the Expressions 'like' forum.hibernate.org |
29. Boolean expression in Order by clause forum.hibernate.org |
30. Strange behaviour using compound path expression in where forum.hibernate.org// one A and one B s.persist(new A()); s.persist(new B()); Query query = s.createQuery("from B as b where b.a is null"); ... |
31. Search for specific expression forum.hibernate.orgBeginner Joined: Wed Apr 05, 2006 3:19 pm Posts: 43 If I type "Laurens" (full name), then he finds the user... but that's not what I want. Code: 21:25:42,656 DEBUG SQL:346 - select this_.userID as userID8_0_, this_.userName as userName8_0_, ... |
32. Creating Regular Expressions in HQL forum.hibernate.orgHeya, I treid running that class but i get the following error when i try to implement the query. Code: 14:49:27,902 ERROR [PARSER] line 1:248: unexpected token: regexp 14:49:27,981 ERROR [[action]] Servlet.service() for servlet action threw exception java.lang.NoSuchMethodError: org.hibernate.hql.antlr.HqlBaseParser.recover(Lantlr/RecognitionException;Lantlr/collections/impl/BitSet;)V at org.hibernate.hql.antlr.HqlBaseParser.atom(HqlBaseParser.java:3533) at org.hibernate.hql.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:3200) at org.hibernate.hql.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:3082) at org.hibernate.hql.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2802) ... |
33. Setting Parameters in subselect (common table expression) forum.hibernate.orgHibernate version: 3.1.2 Name and version of the database you are using: DB2 8.x *************** I have legacy SQL query which has 'common table expression' like: SELECT QRY1.COL1, QRY2.COL2 FROM ( SELECT TAB1.COL1 FROM TAB1 WHERE TAB1.COL2=?) AS QRY1 LEFT OUTER JOIN (SELECT TAB2.COL2 FROM TAB2) AS QRY2 ON QRY1.COL1=QRY2.COL2) As Hibernate does not support coomon table expressions (that is my ... |
34. Hibernate string expression forum.hibernate.orgWell I try what you suggested by the following stack trace was shown. [http-8080-Processor25] ExecuteQuery.warn(52) | Method execution failed: org.hibernate.type.SerializationException: could not deserialize at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:211) at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:234) at org.hibernate.type.SerializableType.fromBytes(SerializableType.java:78) at org.hibernate.type.SerializableType.get(SerializableType.java:39) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102) at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81) at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1899) at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1372) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1300) at org.hibernate.loader.Loader.getRow(Loader.java:1197) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:569) at org.hibernate.loader.Loader.doQuery(Loader.java:689) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2150) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:369) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:300) ... |
35. Criteria using Expression.in() yields empty result. forum.hibernate.orgNewbie Joined: Mon Jun 12, 2006 6:53 am Posts: 1 I'm using an Expression.in on a component class. When executing the code I an empty list. When using the generated SQL in DBVisualizer adding the variables it returns the expectet list. Am I doing something wrong or have I stumpled over a bug? I just turned on debug log level and ... |
36. Maintaining the Order of the Collection in the IN expression forum.hibernate.orgHi all, I am new to Hibernate, as well as this list, so sorry if this question is basic or unclear... I am trying to add a Restriction to a query so that given a Collection of ids, it will return results with those ids IN THE SAME ORDER. I've used the "InExpression(String propertyName, Collection values)" with the following line of ... |
37. like Expression not on the value but on the propertyName ?? forum.hibernate.orgFor a registration module not all userNames are allowed. So we filled a database table (BlockedValues) with all kinds of strings that are not allowed as username (assh,dick,motherf etc etc.) But I don't know how to create such an expression.. The following is just the 'wrong way around': Criteria criteria = session.createCriteria(BlockedValues.class,"BV"); criteria.add(Expression.like("blockedValue","%"+userName + "%")); Thanks Niels |
38. How can I use regular expression in HQL forum.hibernate.org |
39. Selection expressions as porjections forum.hibernate.orghey! i would like to do the following query: SELECT i.name='john' FROM test.Individual i. while the equivalent in SQ works perfectely fine, hibernate does not seem to be able to parse the query: SEVERE: *** ERROR: |
40. How do I get the time-part from a date in Expression.between forum.hibernate.orgCriteria criteria = createCriteria(); criteria.add(Expression.between("extract(hour from {alias}.EVENT_DATE)", startMorning, endMorning); ... |
41. QueryException: path expression forum.hibernate.orgWhen I try to get the composite key for a table using a simple query. I get the following error 1) testGetTemplate(TestGroupUser)org.hibernate.QueryException: path expression ends in a composite value: template0_.id [from com.narval.util.dbutil.dao.Templat e d where d.id= ? ] at org.hibernate.hql.classic.PathExpressionParser.getWhereColumn(PathExp ressionParser.java:389) at org.hibernate.hql.classic.WhereParser.doPathExpression(WhereParser.ja va:363) at org.hibernate.hql.classic.WhereParser.doToken(WhereParser.java:382) at org.hibernate.hql.classic.WhereParser.token(WhereParser.java:263) at org.hibernate.hql.classic.ClauseParser.token(ClauseParser.java:86) at org.hibernate.hql.classic.PreprocessingParser.token(PreprocessingPars er.java:108) at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:28) at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslator Impl.java:192) at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslator Impl.java:168) ... |
42. How to use Not In Function in Hibernate using Expression forum.hibernate.orgHi Hibernate Experts, Since 6 months I started using Hibernate in my application. Currently I got a requirement to use "Not In" function in Hibernate. Example Query: SELECT * FROM V_NEWS_SUBJECT WHERE ID NOT IN (118,117,114,113,112,111,108,104,103,102,94,93,92,89,88,87) I have observed that Hibernate has only IN function. How to convert the above Query in Hibernate using "Expression"? Can any one of you advise ... |
43. Criteria order by expression forum.hibernate.org |
44. HQL IN expression problems. forum.hibernate.orgI"m trying to do a simple SQL where clause with the IN expression like so: String accountNumberList = "1,2,3"); session.createQuery("select * from table where account.accountId in (:accoountNumberList)").setString("accountNumberList", accountNumberList); The thing is that only the results that match the first character in that string are returned. It will not return the data that matched the next characters. I've tried using setParameterList() , ... |
45. LIKE Expression for collection elements in HQL? forum.hibernate.org |
46. EJB QL - Constructor expressions forum.hibernate.orgHello, I'm using JBoss 4.0.5. I want to try to use the powerful feature of EJB QL to specify a constructor within the SELECT clause. I have try this : List fctResults = em.createQuery("SELECT" + " new stesud.salaries.common.signa.Matricule(" + " c300.tra_matric)" + " FROM ..." + " WHERE ..." + " ORDER BY ...") .setParameter("...",...) .getResultList(); the column c300.tra_matric is a ... |
47. using case expression in hql forum.hibernate.orgHi, Im trying to use a case expression within the HQL and when I use a trivial "case when ... then ... end", it works ok, but as soon as i add the "else" part, it fails with unexpected AST node: query error. I've even tried with the latest hibernate jar, but of no use. Any ideas on how to fix ... |
48. hql query help - date expression forum.hibernate.orgYou should be able to execute it using the following: select c.* from |
49. Restriction expression to test collection-valued property? forum.hibernate.orgHi, I have... 1) persistent objects of a class Event... 2) which has a Set property "types"... 3) whose values are persistent objects of a class EventType... 4) and EventType has a String property "name" And all this works fine. But now I need to build a query using the Criteria interface, and I need a restriction that is satisfied if ... |
50. Expression to groupby Date on Timestamp & 1 more forum.hibernate.org |
51. 1-Many Association with Expression.in clause forum.hibernate.orgI have a simply query in existing system select server.sid , group.gid from server , group where server.sid = 10 and group.gid in (20.30) But I can't get corresponding criteria api for this query. I wrote the following code to load data but it does not work. What code should be added to handle gid Code: //Code to load data Criteria ... |
52. Expression Like problem forum.hibernate.orgHi, In my database I have a table with a "name" column and one row which contains the value "test" If I use this criterion : criteria.add(Expression.like("name", "%test%")) the query works very well and returns the row. but if I do this : criteria.add(Expression.like("name", "%te%")) nothing is returned! I thought that by doing this "%te%" the row containing "test" would be ... |
53. Criteria API versus HQL Expression Support differences? forum.hibernate.orgHibernate version:3.30GA It appears that HQL expression support is more expansive than exression support under the Criteria API. Are there Criteria Query class functions that support any of the following, and if so where?: 1. stardard math operators such as: * / + - 2. EJB-QL 3.0: substring(), trim(), lower(), upper(), length(), locate(), abs(), sqrt(), bit_length(), mod() 3. database-supported SQL scalar ... |
54. select count with distinct and an expression forum.hibernate.orgHi Pramodkp Thanks for the reply. SQLQuery works - but means I lose the 'hibernate' layer for all of my queries. The code I'm writing is part of a generic library, so the queries which use it would have to use the raw table names and the raw column names, rather than the abstractions that hibernate provides. The actual query is ... |
55. UPPERCASE unavailable using Expression.ilike() method! forum.hibernate.orgprotected IlikeExpression(String propertyName, Object value, int CONVERT_MODE) { this.propertyName = propertyName; this.value = value; this.selectedCM = CONVERT_MODE; } @Deprecated protected IlikeExpression(String propertyName, Object value) { ... |
56. Criteria API: Entities along-side Additional Expressions forum.hibernate.orgAll, Is it possible to use the Criteria API to select additional columns in addition to the root entity? For example -- assume we have a Person entity with Name, Age, etc. We want to construct a query using the Criteria API which will select everyone in the table who is 35 years old while also selecting a few additional columns ... |
57. How to write query using IN expression with parameter value? forum.hibernate.orgHere is the from clause from Hibernate documentation: from DomesticCat cat where cat.name in ( 'Foo', 'Bar', 'Baz' ) I am trying to pass parameter (String array) instead of literals: 'Foo', 'Bar', 'Baz', like this: new String[]{"transfer1", "transfer2"} My query looks like this: select transfer from TransferImpl as transfer where transfer.name in (?) I am getting empty collection in return. Where ... |
58. Expression.disjunction design problem forum.hibernate.orgThe code snippet below lets me return person object who have or don't have a matching key/val query. For example, I can return all hairColor==red people or all people with hairColor!=red. Code: Criteria pCrit = sess.createCriteria(Person.class); pCrit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); Criteria pmCrit = tCrit.createCriteria("personMetadatas"); SimpleExpression exKey = Expression.eq("key", "hairColor"); Criteria key = pmCrit.add(exKey); SimpleExpression exVal = Expression.eq("value", "red"); if (not) ... |
59. Expression.disjunction design problem forum.hibernate.orgThe code snippet below lets me return person object who have or don't have a matching key/val query. For example, I can return all hairColor==red people or all people with hairColor!=red. Code: Criteria pCrit = sess.createCriteria(Person.class); pCrit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); Criteria pmCrit = tCrit.createCriteria("personMetadatas"); SimpleExpression exKey = Expression.eq("key", "hairColor"); Criteria key = pmCrit.add(exKey); SimpleExpression exVal = Expression.eq("value", "red"); if (not) ... |
60. How to use Expression in Hibernate forum.hibernate.org |
61. Hibernate criteria with Regular Expressions ? forum.hibernate.org |
62. EJB QL: constructor expression with named parameter? forum.hibernate.orgNewbie Joined: Mon Mar 26, 2007 9:22 am Posts: 9 Hi, I have some named queries with named parameters that I want to get working. When I start JBoss it scans through my EJB .jars for entities and hibernate loads the named queries. My queries look all quite the same: Code: select new com.project.dataobject.AnyDO(a, :flagA, :flagB) from Any a where a.id ... |
63. Adding a derived property from sql expression to criteria forum.hibernate.orgIn my object model class there is a derived calculation, daysPassed (which is not a property in the model), which is calculated by taking a property already in the model (orderDate). I have a function that gets a list of those model objects based on certain parameters, and now I also want to add the ability to sort on the derived ... |
64. Null values translates in empty string in SQL Expression forum.hibernate.orgHI! When i save object, null values translates in empty string (' |
65. Null values translates in empty string in SQL Expression forum.hibernate.org |
66. "Case" expression uisng DetachedCriteria API forum.hibernate.org |
67. IQuery expression forum.hibernate.orghi my class have a property named WorkType (enum) that added flags attribute. this property keep multiple enum value (FullTime | PartTime | Freelance). i want query using IQuery interface, but can't do it:( my query; (for example, my enum property value is "FullTime | PartTime | Freelance") IQuery query = Session.CreateQuery("select a from Entity.Advert a where a.WorkType = :p1 or ... |
68. Query api and LIKE expression with subquery forum.hibernate.orgHi, I would like to construct query that has LIKE expression that accepts dynamic argument as subquery. Example: ... AND cat.name LIKE (SELECT dog.name || '%' FROM Dog dog WHERE dog.id =:dogID) AND ... It results as following query syntax exception: org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: query .... Is it possible at all? Wbr, Ilhan |
69. HQL expressions for BLOBs forum.hibernate.orghibernate 3.1.X We have a mapped entity named FOO with a property of type BLOB. I would like to write a HQL statement that would only return instances of FOO that have a non zero BLOB. Are there any HQL expressions available in the where clause for use on BLOB types? Carlos |
70. IN expression for multiple columns in HQL forum.hibernate.org |
71. difference bet Expression and Restriction forum.hibernate.org |
72. Expression between forum.hibernate.orgHi there, I've got a problem with Expression.between. What I want to do is a search between a start value and a stop value which includes the two values. But when I use Expression.between(property, start, stop ) I only get results between the values start and stop. E.g. Expression.between(property, 1 , 3) gets me all the values with 2 but what ... |
73. HQL in expression forum.hibernate.org |
74. Oracle Cursor Expressions (Cursor subqueries) forum.hibernate.orgHi All, I'm connecting to an Oracle database, and accessing a function that returns a SYS_REFCURSOR. I can succesfully map the function using the following syntax: @NamedNativeQuery( name = "blah_list" , query = "{ call blah__function(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}" , resultClass = blah.class , hints = { @QueryHint(name = "org.hibernate.callable", value = "true") , @QueryHint(name = "org.hibernate.readOnly", value = "true") } ) I can ... |