All,

I'm trying to do an inner join within Hibernate, but I'm having some
difficulties and am hoping there's some knowledgeable people on the list.

I have two objects: a Session object and an Account object, which can be 
joined in a query with session.field = account.field4; however, I don't 
have any mappings defined in the Hibernate .hbm.xml files to this effect.

        Table Structure, session.field1 = account.field4:

          Session       Account
          -------       -------
          id            id
          field1  <-|   field3
          field2    |-> field4

Even though I don't have the mappings defined between objects in the 
Hibernate configuration files (for reasons I won't go into), I want to do 
an inner join and return objects of type Session only if account.field3 
equals a particular value.  In SQL, I could do this using something like:

        SELECT * FROM session
        LEFT JOIN account ON Session.field1 = account.field4
        WHERE account.field3 = 'value'

However, I can't seem to get Hibernate to perform this kind of 
functionality.  This is what I'm using as a Hibernate Query right now:

        String query =
         "FROM session IN CLASS org.express.test.Session " +
         "WHERE field1 = '" + field1 + "' ";

Can someone point me in the right direction?  Thanks, in advance.

--          _ 
__ __ ___ _| | William R. Lorenz <[EMAIL PROTECTED]> 
\ V  V / '_| | http://www.clevelandlug.net/ ; "Every revolution was 
 \./\./|_| |_| first a thought in one man's mind." - Ralph Waldo Emerson 




-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise 
Linux in the Boardroom; in the Front Office; & in the Server Room 
http://www.enterpriselinuxforum.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to