1. How to get SQL from Hibernate Criteria API (*not* for logging) stackoverflow.comis there an easy way to get the (to-be-generated) sql from a Hibernate Criteria? Ideally I would have something like:
|
2. Exposing Hibernate criteria via service API stackoverflow.comThis is more of a design than implementation question and it's going to be long so bear with me. It's best explained with an example: Let's say I have a ... |
3. JPQL and SQL Criteria Api stackoverflow.comJPA 1.0 specification is not defining the Criteria API which provides a programmatic approach for creating and modifying JPA Queries. Is there any API for building SQL and JPQL Queries like ... |
4. Can I append pieces of custom HQL when using NHibernate's criteria api? stackoverflow.comNormally I'm using criteria api to make queries against my database, but because criteria api seems to have a bug when searching for the same entity twice, I would like to ... |
5. JPA Criteria API missing stackoverflow.comI'm building application that uses JPA, and I want to use Criteria API as described http://openjpa.apache.org/builds/latest/docs/manual/jpa_overview_criteria.html. More precisely this part:
|
6. Hibernate. Convert HQL to Criteria API stackoverflow.comHow to convert the following hql to Criteria API
?
Thanks
|
7. What are some of the real world example where JPA2 Criteria API is more preferable? stackoverflow.comI have taken a look at JPA 2.0 Criteria API, but I found it to be too cumbersome unlike Hibernate Criteria. Is there any good reason to use JPA 2.0 Criteria ... |
8. org.hibernate.QueryException: Not all named parameters have been set stackoverflow.comI'm getting extremely weird behavior out of JPA 2.0 Criteria API with Hibernate 3.5.1-Final as a provider. I'm trying to build a dynamic query that looks like this in JPQL:
|
9. What is wrong with my JPA Criteria API code (taken from JEE6 Tutorial)? stackoverflow.comThis is my code, which I can't even compile:
|
10. What to use: JPQL or Criteria API? stackoverflow.comMy Java application is using JPA for object persistence. The business domain is very simple (just three classes are persistent, with 3-5 properties in each). Queries are simple as well. The ... |
11. JPA/Metamodel: Strange (inconsistent ?) example in Sun Docs stackoverflow.comIn Sun Online resources, they provide son example about the usage of the Criteria/Metamodel API, but as far as I understand Java, it seems to be impossible to work:
|
12. Hibernate Criteria API stackoverflow.comI was asked in the interview today about Hibernate eager loading. The question was: If there is an Employee class and an Address Class and relationship:1 employee --> many addresses. How with ... |
13. ElementCollection createAlias in hibernate API stackoverflow.comdoes anyone know if and how the solution for following question (which is written in the JPA API) can be written using the hibernate criteria API? To be more specific I ... |
14. Mix HQL and Criteria API in Hibernate stackoverflow.comIs it possible to mix HQL and the Criteria API?
I have a |
15. Calling PostGIS functions from Hibernate JPA2 Criteria API stackoverflow.comIs there a way to pass any expression that hibernate does not understand directly to postgres ? What I already tried :
|
16. How to navigate the object graph using JPA Criteria API? stackoverflow.comSuppose we have the following class graph:
|
17. why i can use jpa 2 feature Criteria API in JDeveloper and Weblogic! stackoverflow.comI'm writing criteria API but not work with Weblogic Server. I find that (jpa1.x.x.jar,jpa2.x.x.jar) Library file in weblogic module folder. I am calling EntityManager.getCriteriaBuilder(); But It shows syntax error, I think ... |
18. JPA 2: Issue with AND method stackoverflow.comI have this error with JPA's AND method:
|
19. Hibernate Restrictions.in vs. Disjunction stackoverflow.comOther than less code, what is the difference between the following two approaches to building an IN clause using the Hibernate Criteria API? Are there performance concerns? Is there ... |
20. how can I reference a parent table with Hibernate Criteria API? stackoverflow.comI have this relations: Class A, which contains a collection of object B Class B. How can I build an Hibernate Criteria to get the elements of B that are referenced by a specific ... |
21. hibernate criteria API: filtering by subset stackoverflow.comI have a class which contains a Set of Bs. I'd like to make an Hibernate Criteria to get all A's for which the set of Bs is a superset of some ... |
22. CASE statement in HQL or Criteria stackoverflow.comderived from this question, is it possible to use HQL or Criteria for the following SQL statement:
|
23. question on Hibernate Criteria API stackoverflow.comI have a two table A and B:
ID is referenced to Bid as foreign RelationMapping.
Here is the problem .My Hibenate B Entity has ... |
24. Criteria API combined AND / OR stackoverflow.comI am struggling to create a query using the Criteria API. The following SQL query returns the result that I need:
|
25. How to create bogus Predicate in JPA stackoverflow.comIs there any way to create bogus Predicate in JPA? Sort of like this:
Almost all the methods of CriteriaBuilder take Expression as parameter.
I also tried this ... |
26. Hibernate Criteria object - perform a INTERSECT stackoverflow.comI was wondering if their is an easy to perform a oracle INTERSECT using the Criteria API object. Using Hibernate 3.2 EX. I want all of the t.value that exist in 'table' ... |
27. Question about Criteria.createCriteria in Hibernate API stackoverflow.comSo I'm still trying to get myself acquainted with the Hibernate Criteria API, and I have this piece of Java code which I would like to seek clarification over.
|
28. month() function and year() function in postgresql through jpa2 stackoverflow.comHow to get the month and year of a postgresql date field using jpa2 criteria query or jpql? Has anybody done this? |
29. Some basic questions on Criteria from JPA 2.0 stackoverflow.comI discovered JPA 2.0 Criteria API today and want to learn it. Just went through some examples and try to do a hands on. I have a table fruit with columns:
|
30. Using 'Case when' in Hibernate Criteria API coderanch.com |
31. Criteria API vs HQL coderanch.comWell Ajeeth, what I was going for was asking a question to lead Jothi to an answer rather than just telling them my opinion (a very old teaching method). But I can see how my response might sound a little curt and, if Jothi didn't think about my question at all, unhelpful. Internet fora are an environment ripe for misinterpretation, so ... |
32. Problems using Hibernate Criteria API coderanch.comHi, I have a class Person with these attributes: firstname:String, lastname:String and birthdayate. I'm trying to use the Hibernate Criteria API by creating a new Person and setting some of the attributes with values that I want to query the database against. Person person = new Person(); person.setFirstname("Paul"); I then create a new Example thus: Example example = Example.create(person); example.enableLike(); example.excludeZeroes(); ... |
33. JPA Criteria API and EmbeddedIDs coderanch.com |
34. setParameterList JPA 2.0 Criteria API forum.hibernate.orgHi Emmanuel, I'm using the JPA 2.0 implementation of Hibernate 3.5.beta. I was wondering if this kind of query will be possible with JPA 2.0 or not. //named parameter list List names = new ArrayList(); names.add("Izi"); names.add("Fritz"); Query q = sess.createQuery("from DomesticCat cat where cat.name in (:namesList)"); q.setParameterList("namesList", names); List cats = q.list(); Do you have an example like this in ... |
35. Help required in Criteria API forum.hibernate.org |
36. JPA 2.0 Criteria API with MetaModel Not working forum.hibernate.org |
37. Many-to-many: brings back too much data with Criteria API forum.hibernate.org |
38. JPA Criteria API question forum.hibernate.org |
39. Criteria fluent api forum.hibernate.orgHi, using SQL functions like "concat" in Criteria is very difficult, with aliases it is even impossible. Why the Criteria does not allow something like this?: Restrictions.ilike(Functions.concat("{alias.name}", " ", "{alias.surname}"), "%frank")) I think would be not so much difficult to make it like this with current state of the Criteria code. is there any existing project trying to improve Criteria search? ... |
40. WrongClassException and Criteria API: different behaviours forum.hibernate.org |
41. Is this a Hibernate Criteria API limitation?? forum.hibernate.org |
42. iterator for Criteria API forum.hibernate.orgHas this been added? I have a requirement to export massive amounts of data as a CSV, and am already using the Criteria API. It would be swell if I could stream the results out using an iterator, rather than having to wait until a whole list is 100% populated. Thanks! --Corey |
43. Criteria API and interfaces forum.hibernate.orgI'm trying to use the Criteria API to create a query with a query with a widely varying set of criteria, the alternative being to build it via string concatenation. The problem is that I'm trying to search off of an interface. The query API seems to handle this pretty well, but createCriteria throws an exception. I understand that the Criteria ... |
44. Criteria API .addOrder(...) problem. forum.hibernate.orgnet.sf.hibernate.QueryException: could not resolve property: child.name of: package.Parent at net.sf.hibernate.persister.AbstractPropertyMapping.toColumns(AbstractPropertyMapping.java:99) at net.sf.hibernate.expression.AbstractCriterion.getColumns(AbstractCriterion.java:69) at net.sf.hibernate.expression.Order.toSqlString(Order.java:73) at net.sf.hibernate.loader.CriteriaLoader. |
45. Criteria API design problems forum.hibernate.orgHello, I a fan of programatic query as most of the time I have to generate a query from data given by the user in a form. But I see some problems in the current Criteria API: * It does not implement all the functionallity of hql. * A criteria is associated with a session, so it is not possible to ... |
46. The Criteria API forum.hibernate.org |
47. Criteria API is great but could be even greater forum.hibernate.orgHi All, I was wondering why the Criteria API is so restricted at some places. It was such a good idea to create it and it could be used much more flexibly. Some ideas: 1) It is a pity that the expressions once created cannot be examined at all. There is no getXXX() method for any of the attributes of the ... |
48. Bug in Criteria API? forum.hibernate.orgHibernate version: CVS Checkout 09/05/2004 Mapping documents: |
49. Criteria API forum.hibernate.orgNewbie Joined: Thu Sep 23, 2004 4:11 am Posts: 12 Location: Gold Coast, Australia Hibernate version: 2.0 I have the following relational mapping: "A Property has an Address which has a Postcode which has a locality (of type String)". These relationships are mapped using a many-to-one. I'm trying to construct a query to select Property types by using the Criteria API ... |
50. API Criteria forum.hibernate.orgpublic class IDResultTransformer implements ResultTransformer { public Object transformTuple(Object[] tuple, String[] aliases) { Object object = tuple[tuple.length - 1]; if(object instanceof MyEntityClass) { return ((MyEntityClass)object).getID(); } return object; } public List transformList(List collection) ... |
51. Criteria API forum.hibernate.org |
52. Altered Criteria API forum.hibernate.orgAltered Criteria API in Hibernate 2.1 Hi, I work on an opensource project development We found the Criteria API very useful. I had a requirement to detach the criteria API and serialize it. As the current version of criteria pacakage is not detached from the ORM engine we have done few modification to detach the Criteria part. I have the following ... |
53. Criteria API & not exists forum.hibernate.org |
54. criteria api and simple math forum.hibernate.orgHere is further clarification on my problem. Here is my table: Address --------- line1 varchar line2 varchar city varchar state varchar distance float . . . I want to do a query and within that query use criteria something like this: where distance - x < 50 x is a fixed amount I want to subtract |
55. Criteria API - specifying result set forum.hibernate.org |
56. How can I use the Criteria API to replace the following HQL. forum.hibernate.orgI haven't been able to find any good tutorials on Criteria API, but the following HQL is generated based upon the number of predicates passed in. For example, there isn't a need to do a left outer join if there are no predicates and there isn't a need to check the predicate name/value also. I know using the Criteria API would ... |
57. problem with BIT in Criteria API forum.hibernate.org@Entity @Table(name="pricelist" ,schema="public" ) public class Pricel implements java.io.Serializable { private Integer priceId; private Boolean showOnWeb; /** default constructor */ public Pricel() { } ... |
58. Is it possible to run this with the Criteria API ? forum.hibernate.orgHi, while porting our application from JDO to Hibernate, we're wondering whether the Criteria api would be powerful enough to allow generic querying involving objects not navigable from the root class (the HQL api can do this and we'll stick with it if it's the only way). For instance : If we have a class Cats and another, called Paternity, with ... |
59. Criteria API and Reports forum.hibernate.orgHibernate version:3.0.5 Hi, I have Hibernate based object model and I would like to use Hibernate Criteria API to build queries which feed my report engine. But after some thinking, I think that it won't be usable to retrieve all objects into the memory. So I have a question: I still would like to use Criteria API to build queries, but ... |
60. Criteria API: Restrictions.isNotTrue, isNotFalse forum.hibernate.orgCurrently, there is no way for the Criteria API to support the following query: select * from SomeTable where someBoolean is not true ; Which would return all rows where someBoolean is null or false. Would it be possible to add Restrictions.isNotTrue (String propertyName), and its inverse, Restrictions.isNotFalse (String propertyName)? Currently, the workaround is to use a sqlRestriction (propertyName + " ... |
61. Use HQL function with criteria API forum.hibernate.org |
62. extension of the criteria api forum.hibernate.orgHibernate version: 2.1.7 Hi, we are using in a spatial data application the criteria api to encapsulate complex spatial queries. in our database the geometries appear as object columns. these are transformed in jjava objects by using user types. the problem now is to transform objects from one spatial reference system in to another. because sometimes another spatial reference system is ... |
63. Error Criteria APi forum.hibernate.orgI use criteria Api but I get error with execution, my code is: Iterator iCriteria = session.createCriteria("from FactNegSolicitud fns") .add(Expression.eq("fns.fEntrada","2005-12-07")) .add(Expression.eq("fns.fEntrada","2005-12-07")) .add(Expression.eq("fns.id_solicitud","1")) .add(Expression.eq("fns.idEmpleadoSolicitante","100")) .add(Expression.eq("gem.idEmpresa","72")) .add(Expression.eq("gg.idGrupo","37")) .list() .iterator(); I have the next error org.hibernate.MappingException: Unknown entity: from FactNegSolicitud fns at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:610) at org.hibernate.impl.SessionImpl.getOuterJoinLoadable(SessionImpl.java:1470) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1436) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:298) at org.aqua.AQForm.Solicitud.Solicitud.mtsearch(Solicitud.java:277) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72) ... |
64. How to use Criteria API with discriminators? forum.hibernate.orgI have a table-per-class-hierarchy situation and I'm trying to use the Criteria API to query for objects by their type. For example, take the following mapping snippet which maps a User abstract class and its two subclasses, Employee & Contractor: Code: |
65. Criteria API: OR across criteria forum.hibernate.orgHi all I'm trying to use the Criteria API for the first time, and have stumbled across a problem that I could use some advice on. For ease of example, assume that I have a model in which entities of type "Adult" contain a collection of entities of type "Child". Each Child has a field named "sex" which is either set ... |
66. Criteria API Problem forum.hibernate.org |
67. Criteria API Problem forum.hibernate.orgi thought that it would be possible to define which nested collections or nested persistent classes are loaded and how they are loaded at runtime by using the Criteria api? But this seems not to be possible: the DAO-layer: Code: public Concert loadConcert(long id, String[] fetchGroups) { Criteria c = this.getSession().createCriteria(Concert.class) ... |
68. Criteria API Question forum.hibernate.org |
69. Criteria API missing"OR" functionality for associa forum.hibernate.orgThanks for your reply. I have tried this approach but the problem is that 'restriction 1' (Restrictions.eq("classState", state)) and 'restriction 2' (Restrictions.eq("otherState", state)) are on separate classes/tables (Class1.class and the class associated via association other1). This means that 'restriction 1' has to be added to the Criteria "class1Crit" and 'restriction 2' has to be added to the Criteria "other1crit" such that ... |
70. Criteria API forum.hibernate.org |
71. Criteria API forum.hibernate.org |
72. joing two table using criteria api forum.hibernate.org |
73. HQL/Criteria API forum.hibernate.org |
74. Criteria API problem forum.hibernate.org |
75. Transform HQL sentence to DetachedCriteria API forum.hibernate.orgI tried this code but I have an exception: Code: DetachedCriteria p = DetachedCriteria.forClass( EdvPersona.class, "p" ); DetachedCriteria c = DetachedCriteria.forClass( EdvCurso.class, "c" ); c.setFetchMode( "cuMateria", FetchMode.JOIN ); c.setProjection( Projections.rowCount() ); DetachedCriteria m = c.createCriteria( "cuMateria", "m" ) .add( Restrictions.like( "m.maTitulo", "something%" ) ); c.add( Property.forName( "c.cuProfesor.peId" ).eqProperty( "p.peId" ) ); p.add( Subqueries.lt( ... |
76. Problem with Hibernate 3 Criteria API: How to Project result forum.hibernate.orgMapping documents: Company: |
77. Is it possible to implement such SQL using Criteria API? forum.hibernate.org |
78. Criteria API questions forum.hibernate.orgHi, I need a little help with the Criteria API. Lets assume I have the following classes A { private String name; private B b; private Set |
79. Possible bug in the Criteria API forum.hibernate.orgHi I think I found a bug using the Criteria API. I am using Hibernate 3.2.0.cr5 (according to the META-INF in hibernate3.jar) with Oracle9, thin driver and Oracle9 dialect Willing to extract 50 random elements from my database, I wrote the following snippet of code: Criteria crit = getSession().createCriteria(Woffre.class); crit.setMaxResults(50); crit.addOrder(Order.asc("sid")); return crit.list(); As you can see, there's nothing particular here. ... |
80. Using Hibernate Criteria API for SQL OR forum.hibernate.org |
81. Criteria API - createCriteria forum.hibernate.orgHi all, I am facing a different problem now. The fields in my search operation are not mandatory. The user will enter the sort criteria and the order of sorting. In the below code companyName and companyType belong to Company POJO and city and countryCode belong to CompanyAddress POJO. Now Search is successful only when I choose atleast one values from ... |
82. Criteria API undesired behaviour forum.hibernate.orgAuthor Message ataveras Post subject: Criteria API undesired behaviour Posted: Fri May 11, 2007 4:03 pm Beginner Joined: Wed Apr 18, 2007 6:17 pm Posts: 49 Location: Dominican Republic Hibernate version: 3.2.3.ga / 3.2.4.ga Name and version of the database you are using: postgreSQL 8.2.4 Description: The problem it's that hibernate it's omitting the second sql join to the ... |
83. Criteria API vs. HQL forum.hibernate.orgAuthor Message adamgibbons Post subject: Criteria API vs. HQL Posted: Thu May 17, 2007 5:48 am Senior Joined: Sat Apr 21, 2007 11:01 pm Posts: 144 What are peoples thoughts on Criteria API and HQL. Personaly i prefer HQL and find Criteria code horidly ugly. For example consider this beast: Code: private Collection findSitesByAssetCriteria(AssetCriteria assetCriteria, Boolean ... |
84. Rewriting HQL with the Criteria API forum.hibernate.orgBeginner Joined: Fri Nov 03, 2006 6:15 am Posts: 21 Hibernate version: 3.2 Mapping documents: Code: |
85. Criteria API problem forum.hibernate.orgHi everybody, I have an HQL query for multi search criteria... like this...... select u, r from com.mhhe.authoring.persistence.ContentUser u, com.mhhe.authoring.persistence.ContentRole r, com.mhhe.authoring.persistence.ContentUserRole ur where u.userName = ur.contentUser.userName and ur.contentRole.roleId = r.roleId and lower(u.userName) like :userId and lower(u.firstName) like :firstName and lower(u.lastName) like :lastName and u.createdBy like :userName I just want to convert this into Criteria API code.. I am just confusing ... |
86. Criteria Api problem with @MayToMany forum.hibernate.orgSorry if i ask something that may be obvious. I have two entity with a jointable cause there is a many to many association. Example: Teachers --> JOIN-TABLE <-- Students. I have put inside the Teachers entity the @ManyToMany association. Everthing works fine, cause i 'm able to get the students list for a choose teacher. The problem comes when i ... |
87. how add restriction with or using criteria API forum.hibernate.orgTo criteria, restrictions is added(and other things but that does not interest right now) for example: Criteria.add (Restriction.like (name, Pepe)); by defect when you add one restriction is reconciled through AND, that is to say: Criteria.add (Restriction.like (name, Pepe)); criteria.add (Restriction.like (last name, Will wash)); here it looked for all the person who their name is PEPE and his Lavaer last ... |
88. Criteria API Help forum.hibernate.org |
89. one-to-many + Criteria-Api forum.hibernate.orgHi! First I apologize for my bad English. I'm new to hibernate and have a problem. Hibernate version:3.2.0 DB: MySQL 5.0.41 I have two tables: Person, Memos A Person can have zero, one or more memos. |
90. Relational Division using the Criteria API forum.hibernate.org |
91. Differnce in using HQL , Criteria API and SQL forum.hibernate.orgHi, I am using Hibernate and want to evaluate which is the better mechanism for database interaction out of HQL, SQL and Criteria API. I want to evaluate above three scenarios on below points. 1. Speed / execution time. 2. Ease of use 3. Complex queries suppport 4. Cache support. Thanks in advance. Neeraj Yadav. |
92. Help with Criteria API forum.hibernate.orgI'm trying to write a general-purpose search function for my app and am looking into the Criteria API for doing so. Its ability to dynamically generate searches is rather powerful and attractive. However, I've hit a few snags. It's easy enough to say do simple equality checks, gt, lt, and "in" predicates, but past that seems a bit arcane. I have ... |
93. Need help on Criteria API forum.hibernate.orgNewbie Joined: Fri May 30, 2008 5:28 am Posts: 2 Hello, I'm relatively new to this hibernate world! So I started using hibernate as the persistence layer support framework with the final year project of my bachelor's degree. I have used the criteria API to retrieve some data (namely "Surfingmode" values) from "surfingmode" table. I've used criteria API because I wanna ... |
94. Invalid return type while executing the Criteria API forum.hibernate.org |
95. Convert from HQL to Criteria API forum.hibernate.orggetSession().createCriteria(Foo.class) .createCriteria("bar") .add(Restrictions.eq("active",0) ... |
96. Criteria API forum.hibernate.orgHi I have class A having a set of Class B. Class B have id,prop and another Class C mapped as many-to-one Class C have id,name among others. Now I want to construct a Criteria or Query preferably a Criteria to fetch me all the A's whose B's must have b.prop=100 and b.c.id=2 and b.prop=200 and b.c.id=3. I have put the ... |
97. how do this with criteria-api forum.hibernate.org |
98. Case in-sensitive grouping using Criteria API forum.hibernate.org |
99. random rows using Criteria API forum.hibernate.org |
100. Hibernate Criteria API generates invalid SQL forum.hibernate.orgAuthor Message gschmidl Post subject: Hibernate Criteria API generates invalid SQL Posted: Thu Apr 16, 2009 7:00 am Newbie Joined: Thu Apr 16, 2009 6:53 am Posts: 1 I'm having a problem with the Hibernate Criteria API generating invalid SQL. I have now tried this both using createCriteria to navigate to the sub-table I need as well as adding ... |