table « Query « JPA Q&A





1. Querying "extension tables" using Hibernate    stackoverflow.com

I am having a querying issue in Hibernate. I have a table, 'test', with existing data. I have a requirement where I can not modify the schema of the ...

2. Hibernate N+1 from select across multiple tables    stackoverflow.com

Given the following hibernate query:

String sql = "select distinct changeset " +
    "from Changeset changeset " +
    "join fetch changeset.changeEntries as changeEntry " +
  ...

3. Using Hibernate to do a query involving two tables    stackoverflow.com

I'm inexperienced with sql in general, so using Hibernate is like looking for an answer before I know exactly what the question is. Please feel free to correct any misunderstandings ...

4. Hibernate query on four tables    stackoverflow.com

I have three tables.

  • question ( forumId as FK)
  • answer (questionId as FK)
  • forum
  • forum member (forumId as FK)
There can be multiple forums so i want to add a method that returns me all answer ...

5. How do I port query with join across multiple tables from JDOQL to HQL    stackoverflow.com

I am porting an application for KodoJDO to Hibernate. I have a query that goes across 4 tables in the db, and 3 objects in the java code. In English the query is ...

6. how to write hibernate criteria query for two different tables    stackoverflow.com

I have these two classes @Table(name="candidateinfo") Class CandidateInfo{ .... @OneToMany CandidateResume candidate; .... } @Table(name="candidateResume") Class CandidateResume{ .... @ManyToOne CandidateInfo candidates; ....... } Now i want to add two restrictoins from 2 different classes(as above) in the below criteria for this i have Criteria crit ...

7. Ignore false login in table    stackoverflow.com

i have a table which contains users login and logout dates. When app crashes and user logins again it can look like this:

user | log_in_out | date

john | login   ...

8. Joining three table with a hibernate query    stackoverflow.com

I'm terribly sorry to bother Stack Overflow with yet another question on those hibernate queries, but it's been four hours or so I've tried to fix this issue, with no success ...

9. Execute sql CREATE TABLE query in Hibernate    stackoverflow.com

I need to dynamically create a table using a Java method and tranform all its rows into a list of Mapping class objects. The questions are..

  • Is there a way to execute ...





10. Hibernate multi-table query handling    stackoverflow.com

I have 4 tables

  1. Titles having the following fields, id (PK), Name, AuthorId(FK) & PublishedId(FK)
  2. Author having id(FK), Author Name & Contact Details
  3. Publisher having, id(PK), Publisher Name & RegionId(FK)
  4. Region having, id(PK), Region Name, ...

11. HQL Editor not appending table name in query    forums.netbeans.org

I am building a very simple ap that pretty much follows the Hibernate in NetBeans tutorial, but I've run into a snag. The Hibernate.cfg.xml and all of the mapping files and POJOs created just fine and seem to be correctly formed, but when I try to execute a query with the HQL editor, it refuses to append the table name in ...

12. Hibernate Query for multiple tables    coderanch.com

Hi, I ran my test cases with a direct table which deals with one table one mapping file one pojo. If I want to get data from multiple tables for a given identifier do I have to create pojo with attributes quried from multiple tables ?. Can I right a straight SQL and execute using Hibernate for this scenario? If a ...

13. querying problem with Hibernate when we use multiple tables in query    coderanch.com

If you are using projections then it returns a two dimensional Object array Object[][]. Or you can create a new class that has the attributes of the projection, then in your Query statement use "select new MyObject(o.a, o.b, o.c)..." But your MyObject must have a constructor that takes those exact arguments. Mark

14. HQL create & drop table queries    coderanch.com

You can't do it via HQL. If you think about it, its not really a valid thing to want to do. HQL works with mapped objects in a SessionFactory; what you are trying to do is remove the underlying table without removing the mapped object, which is asking for trouble. You can do this via SQL, since Hibernate allows you to ...

15. hibernate failed to find table or store procedure suddenly    coderanch.com

I am using Hibernate with EJB and sybase ASE database. In the application i suddenly get exception like below. The exception may last for few minutes and after that application starts working smoothly. Can somebody please help and let me know why suddenly hibernate session could not find the table com.sybase.jdbc2.jdbc.SybSQLException: FirmActTb not found. Specify owner.objectname or use sp_help to check ...

16. Query two tables using hibernate    coderanch.com

I have SQL query select p.name, start_date, end_date from pay p, emp n where id =16940 and p.name=n.name and n.status = 'employed'; It extracts name,start_date and end_date from the pay table where name at the pay table and emp table are the same and the id=16940 and in the emp table the status must be employed. How do I implement this ...





17. How to query a thirt-party datatabase table with Hibernate CriteriaBuilder/JPA?    coderanch.com

Hello, With Spring 3.5.1, I want to write a Service Facade class and a Service Entity class to query a database table that come with Liferay 5.2.8 (EE SP4). But there is some problem when the framework try to hook up with the entity bean. When I deploy the WAR file to liferay hot deploy directory, it thrown the following exception: ...

18. Why each hibernate3 query is making full tables scans?    coderanch.com

Hi, I have recently deployed a struts-hibernate application to my server. However mysql runtime information says that "Handler_read_rnd_next" variable is too much than what it should be. Therefore I decided to enable MySQL query logging to find out what queries make full table scans. Found hibernate is running following statement before executing each and every SQL statement. SHOW FULL TABLES FROM ...

19. Hibernate hangs when querying large tables?    forum.hibernate.org

I have been using Hibernate for a few years. In the last few days, I encountered a problem which I now seem to run out of ideas. I need to run a query to a few tables, each of which has tens of millions of rows. The query is something like this (pseudo code): Code: select count(A.ID), A.GROUP_ID from A inner ...

21. Derived Table query    forum.hibernate.org

22. hibernate query bwt two tables.    forum.hibernate.org

Hi, I have the following schema. TABLE A ..NAME TABLE B ..A.ID ..NAME TABLE C ..A.ID ..NAME I would like to select all TABLE A NAME and display in a panel as a list. now I have a search box that searches as the user types. I would like to search not only for TABLE.A.NAME, but if the user types TABLE.B.NAME ...

23. Hibernate multiple tables join query    forum.hibernate.org

I am now using hibernate as ORM in my application I am not that familiar with join query. So my question is as dipicted below: Scenario: I have got three tables. Order Table PK ID ORDER_CODE STATUS 1 jialhe001 ORDERED 2 jialhe002 ORDERED OrderProduct Table PK (Order_PK) (Product_PK) ID ORDER_ID QTY PROD_CODE 1 1 10 XXD 2 1 12 YYD Product ...

24. How does Hibernate determine table ordering in FROM clause?    forum.hibernate.org

I'm examining Hibernate-generated SQL statements for performance tuning purposes, and would like to know whether it is possible to influence Hibernate to choose a particular ordering of tables in the FROM clause. A known optimization for Oracle and other databases that use cost-based optimization is to manipulate the ordering of tables in the FROM clause. This can influence the query plan ...

25. querying two tables using criteria    forum.hibernate.org

Hi, I have two tables that share the same heading_key column. I am using the following statement using criteria to retrieve the headingcode: org.hibernate.Criteria criteria = getPersistenceEngine() .getPersistenceSession().getHibernateSession() .createCriteria(Heading.class, "h") .createCriteria("customer", "c"); criteria.setFetchMode("customer", FetchMode.JOIN) .add(Restrictions.eq("h.headingKey", "c.headingKey" )) .add(Restrictions.eq("c.customerId", Long.parseLong(customerId))) .setProjection(Projections.distinct(Projections.projectionList() .add(Projections.property("h.headingCode").as(headingCode")))); list = criteria.list(); my xml files are defined: customer:

26. Unable to find physical table: `Color`    forum.hibernate.org

27. cannot query from >2 tables    forum.hibernate.org

hi, i have a problem in query using hibernate. i already have a sql query from four tables, and its successfully tested in my oracle (i use oracle db). Code: select e.empidentitynum from (((Hrm_Employee e join Hrm_Officialhistory o on e.empid = o.empid) join Hrm_Jobtitles j on j.jobtitleid = o.newjobtitle ) join Hrm_Jobspecification s on s.jobspecid = j.jobspecid ) where s.jobspecname like ...

28. Table or view not found querying on sublcass    forum.hibernate.org

Select new mars.DetailsGrid(lp.psn_pin,lp.seq_num,lp.phone,count(distinct src.srcname),min(src.date_reported),max(src.date_reported),count(src.date_reported)) " + "From CaseHistory lp Join lp.casehistoryphonevaluelink src "+ ...

29. ENVERS querying without @Audited tables    forum.hibernate.org

We have tables that are modified outside of the application (etl loads) that need to also be included in the audit of changes. We can handle the app and etl changes using triggers, but if we follow the ENVERS table structure would it be possible to additional Criteria querying apis without having to set the entity as @Audited? Basically setting the ...

30. Hibernate Query Criteria to output a Join Table and get spec    forum.hibernate.org

Criteria criteria = session.createCriteria(CartItems.class,"cartitems"); criteria.add(Restrictions.eq("userId", userId)); criteria.add(Restrictions.eq("status", status)); criteria.createAlias("product", "product"); ...

31. what is this: Adding missing FROM-clause entry for table...?    forum.hibernate.org

When performing a delete from a hibernate session, it does everything fine, but gives me 1 row like this for each delete I requested: [JDBCExceptionReporter] NOTICE: Adding missing FROM-clause entry for table "unilog" What is this? where is it coming from? my delete looks like: Code: String queryString="from UnilogLightWeight u where u.pillangoPeriodID=? and u.unilogDate=? and u.unilogProductTypeID=? and unilog.profitcenterID=?"; Object [] ...

32. Execute a Query using the table directly.    forum.hibernate.org

What I want to do is execute a query from the table directly, without using the class. Ex: I 've got a table named "TableClients" with the attributes "id", "name" and "status", and I've got a Class named "Clients" with the attributes "id" and "name". Now I want to execute the following query: SELECT id, name FROM TableClients WHERE status = ...

33. HQL with no "select", 2 "tables"..    forum.hibernate.org

... which is exactly what I've done (after getting an exception before I included it), but it never hurts to know, because I (or someone else) is going to need that information at some point. I could answer the question myself, but then, who gains from that except for me?? No-one. Putting the question on the group means that someone else ...

34. Shadow tables and query tuning    forum.hibernate.org

We are currently looking at Hibernate and I have a few questions regarding it, 1) How to fine tune the queries which Hibernate generates? Our DBA needs to fine tune the query which hibernate generates for loading saving etc. Is that possible? 2) We have shadow tables for each table for audit purpose, Can somebody suggest a corect procedure to insert ...

38. Querying history tables with criteria    forum.hibernate.org

Hello, I have the following table structure: CREATE TABLE MEPPBX ( ID numeric PRIMARY KEY NOT NULL, PHAR numeric NOT NULL, BOX numeric NOT NULL, BEGINN date NOT NULL, END date NULL, GRND numeric NULL, FOREIGN KEY (PHAR) REFERENCES MEPP(ID), FOREIGN KEY (BOX) REFERENCES MEBOX(ID)); create table MEBOX( ID NUMBER(22) PRIMARY KEY not null, BOX VARCHAR2(3) not null, VERSION NUMBER(22)) CREATE ...

39. How to query all entries of a table    forum.hibernate.org

Hi ! I have a Table called countries. It contains two fields (ID_COUNTRY, NAME). I also have a Bean with the name CountryImpl with getter and setter methods for the id and name. can anybody tell me how i can make a query (using hibernate of course) that returns me a list containing all entries of the table COUNTRIES. It should ...

40. Tablespace clause and CREATE TABLE    forum.hibernate.org

[b]Hibernate version:[/b] 2.1.6 [b]Mapping documents:[/b] Not applicable [b]Code between sessionFactory.openSession() and session.close():[/b] Not applicable [b]Full stack trace of any exception that occurs:[/b] Not applicable [b]Name and version of the database you are using:[/b] DB2 390, DB2 400 [b]The generated SQL (show_sql=true):[/b] Not applicable [b]Debug level Hibernate log excerpt:[/b] Not applicable Question: Is there a way to code or configure Hibernate so ...

41. a very simple select * from table problem...    forum.hibernate.org

Hi, I know the answer to this question is going to be very simple, but i've been so used to bringing back a single record into a map using either: 1. (User)query.uniqueResult() or 2. (User)session.load(User.class, userID) type queries, that now that I want to return the contents of an entire table i'm lost. How do i say: select * from table ...

42. Cross tables query    forum.hibernate.org

I have two persistent entities mapped to two different tables. In my objectial model I do not hold any connection between then (one to one or many to one or many to many). I have a simple query that retrieves records from one of the tables but with implicit join between the two tables, for example: select entity from tests.Entity as ...

43. many-to-many with join table and order-by    forum.hibernate.org

...

44. How to write a query interacting with two tables    forum.hibernate.org

Hi all, when we write a query in hibernat we use a bean having all the properties as there in the table.But If I have to write a query interacting with two tables then how to do this.Like I have two tables having 10 and 8 columns.I want to select 4 columns from each.How should I write this query.What will happen ...

45. Query on multiple table, one might be empty    forum.hibernate.org

Hibernate version: 2 Name and version of the database you are using: Oracle 9i Let's say I have a pojo called Person, wich contains the fields name, age and id. I also have a pojo called Races, that contains the fields date, raceNumber racer (instance of Person) and id. If a person has raced 3 times, my database will have in ...

46. Criteria: how to join three tables with single select?    forum.hibernate.org

[b]Problem:[/b] Having relations between three entities AInformation - one-to-one - BInformation - many-to-one - Classification how to force Criteria to use joining between these tables in only one single select? For the attached mapping a second select is performed what becomes a problem when quering for not a single object but ie. the whole list. Adding setFetchMode(..., FetchMode.JOIN) does not help. ...

47. HQL Querying from 2 tables..didn't work    forum.hibernate.org

Hi, i'm a HQL newbie...i got 2 tables Player and Manager(Many to 1 relationship)..the SQL equivalent is below.. SELECT * FROM Player ply INNER JOIN Holiday hol ON ply.holidayid = hol.id WHERE (ply.club LIKE 'AC Milan') AND (hol.date like '20050622') means i want to get the list of players where they play for AC Milan and went for a holiday on ...

48. Hibernate Query for multiple tables    forum.hibernate.org

Hi, I ran my test cases with a direct table which deals with one table one mapping file one pojo. If I want to get data from multiple tables for a given identifier do I have to create pojo with attributes quried from multiple tables ?. Can I right a straight SQL and execute using Hibernate for this scenario? If a ...

49. Criteria Query : .in() on same object/table    forum.hibernate.org

50. Querying from more than one table    forum.hibernate.org

51. Strange problem: same table is linked twice in the sql query    forum.hibernate.org

Hi, I have a strange problem. The problem is that when a query is executed, I find that the same table is linked twice. I am not sure why this is happening. I am using hibernate 3.0.5 the query that i executed was select classified from ModuleDVO as classified, CustomerGeographyDVO as cust where cust.geographyDVOs.countryDVO.countryName=:countryName and cust.geographyDVOs.id= classified.geographyid and cust.customerDVO.customerid=123456 The configuration ...

52. How do you query within a joined table?    forum.hibernate.org

55. querying system tables    forum.hibernate.org

MrSqueezles wrote: Since not all databases have system tables, I don't think Hibernate provides this functionality. You could map the tables, then run the queries through Hibernate, but I think it would be better for you to just query the database directly. I'd recommend using plain old JDBC, not Hibernate. It's really interesting that you suggest this because that is what ...

57. Using tables in Queries    forum.hibernate.org

I have a n:m mapping with a mapping table which isn't a class in my model. How can I access the reference table in my query string? I habe tried to write something like ps.getByQuery( " select ag from ...

58. Too many table names in the query    forum.hibernate.org

Hibernate version: 3.0.5 Full stack trace of any exception that occurs: 13:44:07,486 DEBUG - ... com.sybase.jdbc3.jdbc.SybSQLException: Too many table names in the query. The maximum allowable is 50. at com.sybase.jdbc3.tds.Tds.a(Unknown Source) at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.queryLoop(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.executeQuery(Unknown Source) at com.sybase.jdbc3.jdbc.SybPreparedStatement.executeQuery(Unknown Source) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120) at org.hibernate.loader.Loader.getResultSet(Loader.java:1272) at org.hibernate.loader.Loader.doQuery(Loader.java:391) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218) at ...

59. HQL for exists (select 1 from junction_table)?    forum.hibernate.org

... from role where exists (select 1 from group_role gr join group g using(group_id) join user u using(user_id) ...

60. Problem with a query -with to tables -:)    forum.hibernate.org

61. user HQL to query a table    forum.hibernate.org

Guys, thanks a lot for answers. Now I am having this realistic scenario and i am stuck with how i can use HQL to query what I want.. I have 2 classes, Person.java and Role. java (A person can possess multiple roles, e.g. a person can be a student, a researcher, an employee at the same time...) Role.java class is a ...

62. forcing hibernate to use seperate queries for join tables    forum.hibernate.org

Suppose we have: Code: @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @Table(schema = "scott", name = "tb_animal") @DiscriminatorColumn(discriminatorType = DiscriminatorType.STRING, name = "brand") @SequenceGenerator(name = "mysequence", allocationSize = 1, sequenceName = "sq_animal") public class Animal implements Serializable { @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "mysequence") ...

63. HQL Select using many-to-many join table problem!    forum.hibernate.org

HQL Select problem: I am trying to build an application that dynamically builds queries depending on what table fields a user wants to view and i am having a few problems selecting property values through a join table. I have a many-to-many table mapping going through a join table: Code: ...

64. Criteria Query o n multilpe tables    forum.hibernate.org

Newbie Joined: Fri Nov 17, 2006 12:18 pm Posts: 6 Hibernate version: 3.0.2 Hello I have the following mapping documents: Mapping documents: Entity Name: Angioescanografia

65. select in different tables    forum.hibernate.org

Hi all, i'm a principiant im hibernate, and i have some problems... so my problem is: I have two tables, software and licenses... One software have one or more licenses. ok so far so good. my problem now is that i have a grid in my jsp file, and i need to put a button in any row, to delete a ...

66. selecting from 2 table    forum.hibernate.org

67. Query with intermediate table (set) problem    forum.hibernate.org

I have this code which was working with hibernate 3.1.3 but for other reasons i had to install 3.2.3 this morning and now i get a Code: org.hibernate.QueryException: illegal attempt to dereference collection when i try to execute de code Code: int count = ((Integer) session.createQuery("select count(*) from Appellant ap where (ap.sectors in (:sectorsIds))").setParameterList("sectorsIds", sectorsIdArray).iterate().next()).intValue(); where sectorsIdArray is an array ...

69. Table name with spaces 'Order Details' in northwind    forum.hibernate.org

Hi, I need to know how to represent a table in the xml mapping file with a name like Order Details in the northwind Database? ie, the table name contain spaces. How do I write that table name in the OrderDetails.hbm.xml file mapping? I do the following and it now works, any help would be appreciated ...

70. Select from multiple tables using one-to-many mappping    forum.hibernate.org

Newbie Joined: Mon Jun 18, 2007 2:29 am Posts: 16 Dear hibernate developers, I need to select some values from the VOR table. I have the vognum in hand which is the primary key in VOG table which refernced vognum in VOR table. Please help me how to write the one to many mapping and how to select the values after ...

71. Ora-01031 when selecting from a table with priveledge    forum.hibernate.org

Hi guys, I'm having serius problems with Hibernate3 and Oracle10g. When my app is trying to SELECT from some table (ex. mytable), using the correct mapped object, I'm getting a "ORA-01031 Insufficient Privileges", although the current user has all the privileges needed for the app in order to access the superuser schema objects (I mean the owner for those tables). The ...

72. Using a spcified table name for a Criteria or HQL query    forum.hibernate.org

Hello, I have a hibernate query which I would like to be able to use with a table name as a parameter. The tables all have the same structures, but since they are created on a regular basis, I'd rather not have to make a new class mapping for each one. In short, can I create a query for a class, ...

74. missing FROM-clause entry for table    forum.hibernate.org

Hi! When I use a element to do a multi-column unique constraint, I get the error "missing FROM-clause entry for table" if I try to access one of my association: Code: ... ...

75. select with multiples table    forum.hibernate.org

How make the query in hibernet. help me please: SELECT c.contacts_members_id, m.dname, p.nick, p.status_connection, p.location, p.member_type FROM contacts c, invitation_contacts i, members m, profiles p WHERE ( c.contacts_members_id = i.members_id AND c.member_id = i.invitation_contacts_members_id AND i.accepted = 'TRUE' AND c.contacts_members_id = m.id AND p.member_id=m.id AND c.member_id = 284 ) OR ( c.member_id = i.members_id AND c.contacts_members_id = i.invitation_contacts_members_id AND i.accepted = ...

77. Can't figure out how to replace or use derived table query    forum.hibernate.org

Newbie Joined: Fri Feb 22, 2008 7:28 pm Posts: 2 I want to find the number of active sessions for a given date range grouped by 2 fields. The keys being: We show a zero at the start time for any GROUP1, GROUP2 that had at least one session in the given range if there are no active sessions at the ...

78. join on the same table twice in a query    forum.hibernate.org

Hi, I'm wondering if there is way to join on the same table twice in a query ? SELECT t1, t2, t3, t4, t5, t6, t7, t8 FROM TbCollection AS t1, TbObject AS t2 LEFT outer JOIN t2.stringValues as t3 with t3.AttributesId = 1 LEFT outer JOIN t2.stringValues as t4 with t4.AttributesId = 2 LEFT outer JOIN t2.dateValues as t5 with ...

79. problem in ordering two table abject in one    forum.hibernate.org

I am facing a unique problem. I have three different tables say Task, StepGroup and Step. The relation between these tables is a many to many. In other words :a Task can have number of StepGroups and also a number of Steps. :a StepGroup can have a number of Steps and also can be in a number of Tasks : a ...

80. using joined table query    forum.hibernate.org

Hi I am new to hibernate and had a question on join table . I have few tables as follows: eg. - product - productdetails - testing session - Assesment - AssesmentTestLookup - Test productdetails table is used to lookup testingSessions for a particular product. product --> productdetails ( 1 to many relationship ) productdetails --> testingsession ( 1 to many ...

81. how to query in a linked table?    forum.hibernate.org

Hi Gurus, I have two tables namely Usr and Newbie, I'd like to return a list of usr from newbie, this works: select usr from Newbie order by rand() this works, now I'd like to return only those Usrs that has a valid avatar, here is the query: select usr from Newbie where usr.avatar is not null order by rand() this ...

82. Three table queries    forum.hibernate.org

Thanks for your reply mate but below is my code with trace Code: public class Samplehiber { public static final Logger log = Logger.getLogger(Samplehiber.class); public List DeviceLastTrack(int mid) { List result; Session session = HibernetUtil.getSessionFactory().openSession(); ...

83. many-to-many + join table = external sql-query won't work    forum.hibernate.org

Hello, Having the mapping below, I can't manage to have the sql-query producing results. I checked all conditions in isolation and everything else works except for the join table PRODUCT_ORDER_REL_ when I try doing the inner join Product / ProductOrder / Order I get no rows even though loading an Order loads all associated products. The PRODUCT_ORDER_REL_ table does not have ...

84. ordering by related tables with Criteria    forum.hibernate.org

Hi folks! I'm wondering how to build a little complex order query with criteria. Criteria c = .... c.addOrder( Order.desc("id")) // it works fine. c.addOrder( Order.desc("contactinfo")) // it works fine. c.addOrder( Order.desc("contactinfo.name")) // it doesnt and it gives me: org.hibernate.QueryException: could not resolve property: contactinfo.name of: ... Any Idea?? I have reviewed my hbm and contactinfo exists and have a name ...

85. select a sub-select with the same table    forum.hibernate.org

Hi, I have the problem with HQL select command getHibernateTemplate().find("select.....") I have the main select with 2 tables tender and tender_bid (conected by id columns) and in the where condition is sub-select with the same table as in main select (tender_bid). the problem is, main-select and sub-select has the same alias for tender_bid table. HQL command: Code: return getHibernateTemplate().find("select new com.freightservice.model.TenderCarrierBestBidInformationResultItem(" ...

86. Hibernate query using multipe tables    forum.hibernate.org

Hi guys, I have an SQL query which I need to translate to Hibernate: SELECT * FROM LeaseCars JOIN Contract ON Contract.LeaseCarID = LeaseCars.LeaseCarID WHERE Contract.ContractStatus = HISTORY; Already got this piece of Hibernate code to work: public List getUnusedCars() { return baseDAO.getCarsByCriteria(Restrictions.eq("carStatus", "0"), Restrictions.eq("brand", "Subaru")); } This uses one table, so I'm stuck on joining multiple tables in one query. ...