Actually you can't. Did this work? I wouldn't rely upon it...

Troy McKinnon wrote:

Sorry everyone - I didn't realize you could use straight sql in the
createQuery() method.

Anyway for those who might not know:

Query q = session.createQuery(
                    "select count(x.name) from Table_1 x, Table_2 y "+
             " where length (x.name) > 11 and x.name= y.name(+) and y.type
is null");
            result = q.list();
            for(Iterator iterator = result.iterator(); iterator.hasNext();)
{
                Object result = (Object) iterator.next();
                System.out.println("result = " + result);
            }

Will work similar to using straight JDBC.


Again my apologies!


Troy

----- Original Message ----- From: "Troy McKinnon" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, November 08, 2003 1:46 AM
Subject: [Hibernate] Outer join question




I have been reading thru the documentation on the hibernate query language
regarding joins and other 'sql' queries.

I noticed that in every case of a join the 2 tables have an association.
(constraint)

I was wondering if it is still possible to do the join without the

relation.


This example is trivial but it gets my point across:
select x.name from Table_One x, Table_Two y

where x.name = y.name (+)

and y.type is null

Or similarly:

select x.name from Table_One x, Table_Two y

where x.name = y.someothername (+)

and y.type is null



I don't want to 'force' the mapping as in:

<class Table_one>
    <id>
 <one-to-one ... class=Table_2>
<..>

Because I feel that that would limit me from doing a similar join on say
Table_3.yetanothername

This is probably a very simple answer and I just am not getting it. But I
would appreciate your help in understanding.



Thanks

Troy


------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel




------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel

-- Gavin King JBoss Group +61 410534454 http://hibernate.org



-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to