1. Hibernate Query Problem forum.hibernate.orgI am using hibernate 3.0. I am having problem in fetching results by Hibernate query. I am having following objects Entry,Queue,Task. Entry has one to many relationship with Tasks. Queue has many to one relationship with Entry. Following is the query I am executing. Code: getHibernateTemplate().find("from Entry e join fetch e.queue " + where (e.status = ? or e.status = ?) ... |
2. Newbee having problem crafting a master-detail HQL query forum.hibernate.orgI'm a newbee in HQL (and in SQL also) and I have dificulties crafting the HQL query named "LRUDAO.find_by_name_for_sil28" below. Could someone help me ? TIA. Hibernate version: 3.1 Mapping documents: |
3. hibernate query problem or desired behavior ? forum.hibernate.org |
4. Problem with Select query in Hibernate forum.hibernate.orgHi All, I made the mapping correct and the query run fine no errors neither and exceptions. Once i use the sql query that hibernate did generate, it returns rows. The code i use is normal query, using a session to create a query and then just query.list(), but always nada. here is a part from the log : 17406 [main] ... |
5. Hibernate query problem forum.hibernate.orgI am using Hibernate 3.0.5 with MySQL and I have found something very strange in a query I am using. I am also using Spring Framework 1.2 to manage the Hibernate sessions. I have 3 tables: (Patch, Build, Bug). A Patch contains Builds, a Build contains bugs and bugs have a value for the build the bug was found in and ... |
6. Hibernate HQL query problem forum.hibernate.orgHello, I have a very strong problem with an HQL query and I'm looking for your precious help ;-) My HQL query is : select distinct articles from com.iserva.model.Article as articles inner join articles.column as column inner join articles.state as state where articles.language =:language and articles.state.stepId =:stepId and articles.state.status =:status and articles.column =:column The SQL Equivalent generated by Hibernate is : ... |
7. Long lasting query! Enormous, urgent problem..! forum.hibernate.orgHi. It has been a week since we first noticed problems with our application (java+hibernate+oracle+weblogic). The query and the session are optimized with the FIRST_ROWS mode. I've written one class that run the sql query with jdbc14. (it took 15s to perform) I've written tool servlet that measures its time with the weblogic driver (noXA) - took also approximtelly 15s. From ... |
8. select new ... - problem forum.hibernate.orgI have H 3.1.3 and i need to make something like this : query = tx.getSession().createQuery( "select new com.comarch.wfm.dao.wrappers.ResourceAdmListWrapper(r, :day, :tx) " + "from ResourceVO r "); query.setParameter("resource", resource); query.setParameter("day", day); query.setParameter("tx", tx); now i get exeption : Unable to locate appropriate constructor on class... An alternative is : creating a list of ResourceVO ,iterating all ResourceVOs and create ResourceAdmListWrapper in ... |
9. >>Query creation problem<< forum.hibernate.orgHello! I want to make this query in HQL but i get an exception. In mySQL database the query returns the expected result so the sintax is ok... maybe there is some slight difference in HQL. Help would be much appreciated! Here it is: Code: String result = (String) session.createQuery("select m.mwoid from Mwo m " + "where timestampdiff(second, m.creationDate, now()) = ... |
10. Problem with setMaxResult forum.hibernate.orgpublic List getAllCustomers() { List customerList = null; getHibernateTemplate().setMaxResults(50); customerList = getHibernateTemplate().find("from Customer c where c.password=?", "password"); System.out.println("No. of customers retrieved=" + customerList.size()); return customerList; ... |
11. problem using "select *..." forum.hibernate.org |
12. Problem with Hibernate Criteria Query forum.hibernate.orgpublic Collection loadDistinctByOrganizationAndRoles(Organization organization, Collection roles) { Criteria criteria = getSession().createCriteria(User.class); criteria.add(Expression.eq("assignedOrganization", organization)); criteria.add(Expression.in("roles", roles)); return criteria.list(); } |
13. problem with datediff inside select new forum.hibernate.orgHi, I am new to the Hibernate. I am using Spring,Hibernate3 and My Sql 5 with Tomcat 5. I am using HibernateDAOSupport to get the seesionfactory. Here is my sample report query : String sql = "select new Info(t1.userId,datediff(curdate(),max(t2.entryTime))) from Tab1 t1, Tab2 t2 where t1.userId = t2.id group by t1.userId having datediff(curdate(),max(t2.entryTime)) > 3"; results = getSessionFactory().openSession().createQuery(sql).list(); I am getting ... |
14. n+1 select problem forum.hibernate.orgHi All I have been reading quiet a lot about Hibernate. One thing which I could not get very clearly was regarding the n+1 select problem. I read about Hibernate solves a perennial problem (which is n+1 select problem). I would like to know what is this n+1 select problem. Can some ellaborate on this. Would be good if some could ... |
15. SELECT with hibernate problem - newbie forum.hibernate.orgHi, I cant select using hibernate (insert works fine). This is my code: User userAuth = null; Transaction tx = null; Session session = InitSessionFactory.getInstance().getCurrentSession(); try { tx = session.beginTransaction(); List users = session.createQuery("from db_user where name='"+request.getParameter("username")+"' AND password='"+request.getParameter("password")+"'").list(); userAuth = (User)users.get(0); tx.commit(); } catch (HibernateException e) { if (tx != null && tx.isActive()) tx.rollback(); } this is the User xml ... |
16. hql query problem forum.hibernate.orghi , I am developing a application for conducting survey. I am working on diffrent tables given below. Survey, Survey sections, Survey Questions Survey Answers I wrote a query to get Overall survey object which contains information about all the tables.Hql query for this is select s from Survey as s where s.codeValue= :codevalueid and s.displayname= :name and s.versionnumber= :versionno but ... |
17. Query Problems forum.hibernate.orgI am running into a problem trying to execute a query using Hibernate 3 on MySQL. I have not been using hibernate for all that long. First off, does everything have to be mapped if I use the getHibernateTemplate to execute a query? My query is the following: select avg(avg_daily_file_size / (select count(distinct date) as total_days from issue i, `file` f ... |
18. many-to-many and ordering problem forum.hibernate.orgHello I have a many-to-many relationship via a join table. let's they the represent books and authors. when I have a book object and get all the authers with book.getAuthors() I want an ordered List. when using a Query I can call the list() method to give me a List. but in the mapping file I have to use the |
19. problem regarding HQL query! forum.hibernate.orgI am trying to migrate from Hibernate 2.* to 3.2.1. Everything seems to work fine except for the query shown below. I also have the stack trace for the query, any help would be appreciated. from Award as award join fetch award.awardResearchers where award.awardResearchers.elements.employee.employeeId = :employeeId and award.budgetEndDate >= :budgetEndDate Caused by: java.lang.ClassCastException: org.hibernate.hql.ast.tree.CollectionFunction at org.hibernate.hql.ast.tree.DotNode.getLhs(DotNode.java:523) at org.hibernate.hql.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:441) at org.hibernate.hql.antlr.HqlSqlBaseWalker.addrExpr(HqlSqlBaseWalker.java:4326) at ... |
20. Nmaed Query Problem forum.hibernate.orgHI, I have written a query in my hibernate mapping document.Here is the snippet: |
21. Criteria - small ordering problem forum.hibernate.org |
22. Problem with OR in query forum.hibernate.orgCode: Hibernate: select distinct mbus0_.id as id0_, mbus0_.system_entry as system2_0_, mbus0_.busy_entry as busy3_0_, mbus0_.status as status0_, mbus0_.bus_number as bus5_0_, mbus0_.bus_size as bus6_0_, mbus0_.bus_price_brutto as bus7_0_, mbus0_.initial_payment as initial8_0_, mbus0_.date_initial_payment as date9_0_, mbus0_.final_payment_done as final10_0_, mbus0_.date_final_payment as date11_0_, mbus0_.driver as driver0_, mbus0_.driver_handy as driver13_0_, mbus0_.new_bus as new14_0_, mbus0_.event_ref as event17_0_, mbus0_.event_location_ref as event15_0_, mbus0_.departure_region_ref as departure16_0_, mbus0_.bus_company_ref as bus18_0_, mbus0_.bus_owner as bus19_0_ ... |
23. Problem with query forum.hibernate.orgHi all, I have so strange issues with a query I am trying to execute. First the interesting parts of tzhe classes the query uses: Code: @Entity(name = "EnvironmentOrder") @Table(name = "EnvironmentOrder") public class Order extends AbstractOrder { [nothing interesting here] } @Entity @Inheritance(strategy=InheritanceType.JOINED) public abstract class AbstractOrder implements TransactionalObject { @ManyToOne ... |
24. How to avoid N+1 select problem? forum.hibernate.orgI have 2 tables PARENT and CHILD. The PARENT tabel has a foriegn key to the CHILD table. I want to query for all children of parent with ID = 1 select p.child from Parent p where p.id = 1 The above query returns proxies for the children. How can write the same query with the collection been intitialized? Thanks |
25. strange problem with union all query forum.hibernate.org |
26. Problem executing query forum.hibernate.orgI am getting the error message below. Here is the hbm.xm settings: |
27. Problem in create the Query forum.hibernate.org |
28. Criteria query: one2many problem forum.hibernate.org |
29. Hibernate Query Problem forum.hibernate.orgI've been trying to make a more complex query than I'm used to, but try as I might I can't seem to get the syntax correct. Is it possible to query the database for a persisted object which has both a Unique foreign key, and a maximum primary key? That is, if I have multiple objects with the same foreign key ... |
30. Problem in running Hibernate Query forum.hibernate.orgString str2 = "SELECT TO_CHAR(ADD_MONTHS( TO_DATE(?,'DD/MM/YYYY'), (ROWNUM-1))) as MONYR, ADD_MONTHS(TO_DATE(?,'DD/MM/YYYY'),(ROWNUM-1)) as DD_DATE FROM CL_Enroll as clEnroll WHERE ROWNUM <= MONTHS_BETWEEN(TO_DATE(?,'DD/MM/YYYY'),TO_DATE(?,'DD/MM/YYYY'))+1 ORDER BY ADD_MONTHS(TO_DATE(?,'DD/MM/YYYY'),(ROWNUM-1)) ASC"; try { String startDate = "5/8/2004"; String endDate= "20/12/2004"; List monyear = new ArrayList(); session1 = sessionFactory.openSession(); Query query = session1.createQuery(str2); query.setString(0,startDate); query.setString(1,startDate); query.setString(2,endDate); query.setString(3,startDate); query.setString(4,startDate); List query1 = query.list(); for(Iterator itr=query1.iterator();itr.hasNext();) { row = (Object[]) itr.next(); ... |
31. SQL Query Problem forum.hibernate.orgNewbie Joined: Wed May 09, 2007 7:06 am Posts: 12 Hello, I have a SQL-expression in a MySQL -query running with no problemS, but if I try to use this expression with the EntityManager it runs out in an error. Don't have many experience with Hibernate and hope for assistance!!!! Hibernate version: Version from jboss-4.2.0.GA Code: Code: SELECT DISTINCT count(csy.y20gpnum) as ... |
32. Problem with query expressed as criteria... forum.hibernate.orgThe following two methods return different number of objects. The one done by criteria returns duplicates objects for one row in the table about in the middle of the table. I do not understand why these are returning different results. Code: public List |
33. Hibernate query problem forum.hibernate.orgHey everyone, I've been using Hibernate for quite some time, but recently I've been having trouble with a particular query : query = "from com.mypackage.ProcessedCheque c " + "where c.originalRequest.id in (:ids) " + "order by c.originalRequest.id asc" I've got numerous other queries that are virtually identical, but this one always throws an IllegalArgumentException saying : "node to traverse cannot be ... |
34. Select IN Problems forum.hibernate.orgI swear I had this working before, but now its not. I have a simple HQL of: Code: SELECT DISTINCT tbl FROM AccountFee tbl WHERE tbl.account IN (:account) I set the :account = an array of account objects. AccountFee.account is an Account object with an Account having many fees. I get the following stack trace when I try to execute ... |
35. Problem with query forum.hibernate.org |
36. N + 1 Select problem happening forum.hibernate.org |
37. Simple Hibernate query problem (bugging me for days) forum.hibernate.orgHello everyone! The following Hibernate problem keeps me bugging for ages. The query itself is quite simple. The objects are: Clip and License. Clip has the following method: @ManyToMany public Set |
38. A problem of many-to-one query forum.hibernate.orgI have two tables called "Homework" and "Course". There is a property "course_id" in "Homework" as the foreign key joining the table "Course". And I use Hibernate Synchronizer to general the mapping files and DAO classes. The problem is: I want to get all homework of a course by course_id. The mapping script of the column "course_id" is as bellowed: Code: ... |
39. problem with HQL parametrized query forum.hibernate.orgName and version of the database you are using:MySQL 5.0 I have a problem when trying the following: I want to search with 2 drop down boxes and a submit button. Here's the code and do not be scarry of it's length because for you it may be very simple : Code: public static List |
40. Many to many criteria query problem forum.hibernate.orgHi, I have following problem: I have two tables: table of calls and table of attributes. Those two tables are in many to many relation. For example: calls: 'call1', 'call2' attributes: 'category1', 'category2', 'priority1', 'priority2' Lets assume that call 'call1' has two attributes: 'category1' and 'priority1'. Call 'call2' has also two attributes: 'category1' and 'priority2' Using criteria api I'm trying to ... |
41. problems with criteria queries forum.hibernate.org |
42. problems with criteria queries forum.hibernate.org |
43. union all -HQL query problem forum.hibernate.orgString sqlQuery="select pat.outletCode, pa.patientNo,pat.patientDrugRequiredMasterDRDDate, pa.patientNo,pat.drugSlNo,pa.patientName "+ "from PatientDrugRequiredMaster pat,Patient pa where pat.patientNo=pa.patientNo and pat.billMasterSlNo is null and "+ "pat.drugCancel is null and pat.pharmacy.pharmacyCode=:code"+ " UNION ALL "+ "select patDr.outletCode, ip.patient.patientNumber,patDr.patientDrugRequiredMasterDRDDate,ip.patient.patientNumber,patDr.drugSlNo,ip.patientName"+ " from PatientDrugRequiredMaster patDr,IPAdmission ip where patDr.IPAdmission.inPatientNumber=ip.inPatientNumber and patDr.billMasterSlNo is null and"+ " patDr.drugCancel is null and patDr.pharmacy.pharmacyCode=:code and ip.inPatientDISC is null"; Query query = session.createQuery(sqlQuery) .setParameter("code","I001"); while above query is ... |
44. One to many selection - Problem with simple select forum.hibernate.orgHello, i have the following simple tables: Table 1: NAME Field1: NAME_ID Field2: NAME Table 2: NAME_ALIAS Field1: ALIAS_ID Field2: NAME_ID Field3: ALIAS_NAME So every NAME-object has a set of NAME_ALIAS objects. I want to select all NAME objects that have a String like "123" in NAME.NAME OR NAME_ALIAS.ALIAS_NAME. I tried the following but it doesnt work: Criteria crit = getSession().createCriteria(Name.class); ... |
45. Query rewrite problem forum.hibernate.orgHi We're building an application where all database requests go through a facade so that the actual hibernate session is hidden from the developer. For example, the developer could call a listObject() method which takes as input two parameters, the class of the returned objects and a list of filters (our own class). With this information we can build the HQL ... |
46. [JPA] Problem with query forum.hibernate.orgHibernate version: Entity Manager: 3.4.0.GA, the rest are bundled libs Hi. I am no sure if this is the right place to ask this, but... I am currently learning EJB3 and JPA, I am using Glassfish v2, and I use the default TopLink essentials and Hibernate as providers to test this and that. There is a class Item: id, name, desc; ... |
47. HQL query to SQL problem forum.hibernate.orgNewbie Joined: Wed Dec 17, 2008 6:38 am Posts: 4 Hi, I wish you all a Happy New Year! I have a problem with a HQL query and I hope you can help me find what's wrong. I have an entity called Travel that is related to some Activity, Proposal or ProjectBaseline objects. An activity, proposal or projectbaseline can have multiple ... |
48. problem when calculate query recordCount forum.hibernate.org |
49. Problems with a simple? HQL query forum.hibernate.org |
50. Problem with "HQL Query" forum.hibernate.orgHi all, Is the first time that I use Hibernate in a web application project, I have a problem using "HQL Query". The "Hibernate Mapping Files and POJOs" and HibernateUtil are created by wizard. IDE: NetBeans 6.5.1 Frameworks used: Spring web MVC 2.5 Struts 2 Hibernate 3.2.5 Informix drivers: ifxjdbc.jar ifxjdbcx.jar ifxlang.jar ifxlsupp.jar ifxsqlj.jar ifxtools.jar hibernate.cfg.xml: |
51. Strange Informix/Hibernate query problem forum.hibernate.org |
52. Hibernate query problem forums.oracle.com |