These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Basics zum Thema joining
PostPosted: Tue Jan 16, 2007 12:44 pm 
Newbie

Joined: Tue Jan 16, 2007 12:37 pm
Posts: 2
Hibernate version:

3.0

Name and version of the database you are using:

Oracle


Hallo,

das Joinen wirft bei mir einige Fragen auf. Ich moechte zwei Tabelle/Objekte *ohne* hard-coded mapping joinen. Das hier geht nicht:

Code:
from table1 t1 inner join table2 t2 where t1.id=t2.id and t1.id=foo

-> QuerySyntaxException: Path expected for join.


Aber das hier funktioniert:

Code:
from table1 t1, table2 t2 where t1.id=t2.id and t1.id=foo


Mir ist unklar, wieso das so ist. Die ganz grosse Frage, die sich jetzt stellt, lautet: wie funktioniert ein outer join?

Danke fuer Ratschlaege
Timo


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 16, 2007 6:18 pm 
Newbie

Joined: Tue Feb 14, 2006 5:13 am
Posts: 18
hql erwartet als join argument nicht einen tabellennamen, sondern die property die als beziehung zu einer anderen tabelle konfiguriert ist. hast du das nicht explizit gemacht kannst du hql-join nicht verwenden.

das ist aber nicht weiter schlimm, solange dir inner joins genügen. moderne datenbanken erkennen ein verstecktes join in der where-klausel und erzeugen ebenso effizienten code wie mit einem join.

einen effizienten weg ein outer join über hql-where auszudrücken kenne ich hingegen nicht. wenn du also die join-bedingung nicht als hibernate mapping festlegen kannst, musst du m.e. mit einer native-sql query arbeiten.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.