1. Hibernate: Criteria vs. HQL stackoverflow.comWhat are the pros and cons of using Criteria or HQL? The Criteria API is a nice object-oriented way to express queries in Hibernate, but sometimes Criteria Queries are more difficult ... |
2. Criteria to HQL stackoverflow.comis there any way to take a Criteria (that has multiple Criterias, Restrictions and Orders) and generate a HQL query out of it? Cheers Nik |
3. Criteria v/s HQL .who is faster? stackoverflow.comI have been reading some anwers, but i'm still confused. ¿Why? because the differences that you have mentioned do not relate with the performance. they are related with easy use.(Objetc(criteria) and ... |
4. Criteria v/s HQL .who is faster? stackoverflow.comI have been reading some anwers, but i'm still confused. ¿Why? because the differences that you have mentioned do not relate with the performance. they are related with easy use.(Objetc(criteria) and ... |
5. Hibernate: How do I rewrite this criteria to HQL? stackoverflow.comI want to write HQL, where I find out if Company has Persons(employees) with some of given names. I've managed to do that with criteria:
|
6. Criteria OR HQL coderanch.comI am working on a large database with multiple relations existing between entities. One set of relations is as shown below Area (Many to One) ----->MarketMaster (Many to One) -----> Market (Many to One) --> MarketCluster(Many to One) --->Region Similarly Area table has lot of relation with many other tables. My doubts 1. To cater to the fields, operators and values ... |
7. HQL -> Criteria.... coderanch.comMaybe a full code snippet using the Criteria API will help. Here's a sample of getting a list of results: User user = new User(); user.setVerified(false); Example example = Example.create(user); Session session = HibernateUtil.beginTransaction(); Criteria criteria = session.createCriteria(User.class); criteria.add(example); List results = criteria.list(); HibernateUtil.commitTransaction(); for (int i = 0; i |
8. when to use HQL and when to use Criteria? coderanch.com |
9. HQL and criteria coderanch.comI need to implement a query like this... select count(*) as res from table where field1 in (...) and field2 in (...) and field3 in (...) and (time1-time2)<10; That time1-time2 I know how to do it in HQL. I there anyway to put these Criteria and HQL things together? I already know of sqlRestriction but I want to make the query ... |
10. multi criteria HQL, please help me zkoss.orgI would like to do it in three text boxes, but I'm still novice, so I don't know how to do it. So the only solution is to constraint the input with fixed rule.If you can tell me how to write three input parameters in three different textboxes, I would be really happy. |
11. HQL Vs Criteria forum.hibernate.org |
12. criteria vs hql forum.hibernate.org |
13. HQL, Criteria, and reporting forum.hibernate.orgI need to create a search screen in my application that works as a report generator. I have to provide the ability for the user to choose return columns, sorting, etc. It appears that I have two choices: HQL or the Criteria API and QBE. The Criteria API is very appealing because it means I won't have to do any query/string ... |
14. Using Criteria instead of HQL forum.hibernate.orgFor my company's current project, I have written several queries using HQL and it works great. I have tried to move to using the Criteria and related classes, because it seems like a more elegant way to go. Most things have been easy to go from HQL to Criteria. However, I have come across a difficult problem. I have two tables ... |
15. HQL SubSeclect to criteria forum.hibernate.org |
16. Hibernate Criteria and HQL re-elaboration forum.hibernate.orgI'm sure I'm not the first one asking this question, but I received no answer... I thought the Hibernate developers, may be not all of them, were watching on this forum... I'm still investigating the problem and naturally I'm ready to put my hands in the dirty part...I'm not scared by the work. I'm actually in the opinion the fastest solution ... |
17. HQL ? Criteria ? forum.hibernate.orgThey are two different APIs where power is similar (in H3.x) so it really boils down to which you feel most comfortable with. I have a preference toward HQL as I am use to using it (and SQL etc) but Criteria really does have features that make requirements such as adhock searches very easy to do. It also has the added ... |
18. By using Criteria or HQL can we do this ? forum.hibernate.org |
19. Criteria too slow, how can I get HQL from a Criteria? forum.hibernate.orgThe list() method is what causes the query to execute, so it is naturally going to be the slowest part, since that is when the database is being hit. The Criteria really should not be any slower than using HQL, unless for some reason it generates inefficient SQL in a complex scenario. You can turn on Hibernate logging to see what ... |
20. Criteria vs HQL - general question forum.hibernate.orgAs everyone, I am having a lot of simple queries for finding entities by different parameters. I want to create a dynamic way to replace all that finders, by providing entity instance (or some find-oriented subclass) to create dynamic query. I have 2 solutions: 1) using dynamic hql, which doesn't necessary be heavy for maintaince etc - remember that I am ... |
21. Could use some help going from HQL to Criteria forum.hibernate.orgI need to translate the following query (which is tested and works) to use Criteria: select distinct(c) from Card c join c.categories cat join cat.allParents category join category.allChildren child join child.cards card where c.id = card.id and category = ?) So far I have: return getSession().createCriteria(Card.class, "c") .setProjection(Projections.distinct(Projections.property("c"))) .createAlias("c.categories", "cat") .createAlias("cat.allParents", "category") .createAlias("category.allChildren", "child") .createAlias("child.cards", "card") .add(eqProperty("c.id", "card.id")) .add(eq("category.id", cat.getId())); which ... |
22. hql to criteria forum.hibernate.orgI am trying to translate this hql query: Code: select distinct ci.savingType from CalculationItem as ci where ci.currency=? into Criteria API query. So far , this is the best that I can do: Code: Criteria cr = sessionFactory.getCurrentSession().createCriteria(CalculationItem.class); if(currency!=null) { ... |
23. use HQL in Criteria forum.hibernate.orgHow can you do use hql by criteria? for example, DB schema is +--------------------------+ | Glossary | +--------------------------+ | gls_no int primary key | | gls_name varchar(16) | +--------------------------+ session.createCritera(Glossa.class) .add(Restricionts.sqlRestrictions("name like 'H%'")) .list(); this example occured error! because sqlRestrictions use native sql, so then name is unkown field. ======== I must do criteria method. How can you solve this problem? ... |
24. HQL to Criteria forum.hibernate.orgHi! I've this mapping: ----------------------------- |
25. HQL OR CRITERIA OR EXAMPLE forum.hibernate.orgHi All, I am new to Hibernate. I did applications with HQL, Criteria and Example. I want to know What is most efficient in these three. What should I use with first priority. I want a clear reason. why and why not ? advantage and disadvantage also. If any link is suggested please let me know. and any reason that you ... |
26. Please help from HQL to Criteria forum.hibernate.orgquery="select distinct p from User as p " + "JOIN fetch p.Office o JOIN fetch p.UserRoles r JOIN fetch r.SystemRole s " + "where " + "lower(p.staffNo) LIKE :staffNo " + "AND lower(p.badgeNo) LIKE :badgeNo " + "AND p.Office.officeId = :officeid "+ "AND s.roleId = :roleid "+ "AND ( lower(p.lastName) LIKE :name "+ "OR lower(p.firstName) LIKE :name) "+ "order by o.officeName" ... |
27. HQL works but Criteria doesn't. forum.hibernate.orgThe solution was interesting and something new to me, so I thought of sharing it here. Actually the db column 'PAN' is not a VARCHAR2 its a CHAR of length 4. So in order to get a result with that column as the input parameter we have to pass a String of length 4. (PAN is mapped with a String type ... |
28. Criteria vs. HQL forum.hibernate.orgTurn on Hibernate SQL statment logging (it's in the manual somewhere). Look at the SQL statements being generated, probably a lot more for the criteria API version, right? HQL and Criteria API have treat default fetch profiles differently. The Criteria version is probably eagerly loading a collection or relationship that the HQL version is not. You will need to read the ... |
29. different behavior of Resulttransformer with HQL or Criteria forum.hibernate.orgfinal DetachedCriteria criteria = DetachedCriteria.forClass(Album.class, "alb"); criteria.createAlias("alb.albumSongs", "albSong"); criteria.createAlias("albSong.song", "s_song"); criteria.setProjection(Projections.projectionList() .add(Projections.count("albSong.song"), "songCount") .add(Projections .property("albSong.song"), "songCountSong") .add(Projections .groupProperty("s_song.name") ... |
30. extensibility, hql + criteria - how this could work out. forum.hibernate.orgSo i have worked for about 2 years with Hibernate now, have experienced some subtle bugs but most of the time a workaround could be found. Now i am using hibernatespatial a lot, as well as some homebrew Criterions, and implementations of the Order class. Hibernatespatial is implemented exclusively for the criteria API. Most of the time i like to write ... |
31. HQL vs Criteria forums.oracle.com |
32. Hibernate - From hql to Criteria forums.oracle.com |