From: Gavin K. <ga...@ap...> - 2002-11-06 15:38:26
|
Oh yeah, I expect this. MultiTableEntityPersister does some SQL generation itself thats not (yet) aware of Oracle-style outerjoins. Just do a search for "left outer join". This generated SQL is probably not being used if outerjoin fetching is enabled. I just noticed that currently MultiTableEntityPersister doesn't support loadWithLock(). So I guess thats also on the TODO list. ----- Original Message ----- From: "Wolfgang Jung" <w....@mi...> To: "Gavin King" <ga...@ap...> Cc: "hibernate list" <hib...@li...> Sent: Thursday, November 07, 2002 2:03 AM Subject: Re: [Hibernate] Normalized table mappings > On Wednesday 06 November 2002 15:19, Gavin King wrote: > > > Currently I have another problem with the OuterJoinGenerator: > > > The SQL created by the constructor of EntityLoader is always using ' LEFT > > > OUTER JOIN' > > > > > even if I use the OracleOuterJoinGenerator. I've added the a log > > > statement in the constructor > > > > > and it tells me that the sql 'select .... from foo left outer join bar on > > >....' was created withan OracleOuterJoinGenerator???!!!? > > > > I'm not following properly..... > > > > MultiTableEntityPersister produces some SQL with "left outer join" > > hardcoded, as you noted. Some refactoring is needed to fix this. But I'm > > pretty sure the SQL generation for outerjoin fetching never produces "LEFT > > OUTER JOIN" when the SQL dialect is set for Oracle. Surely you aren't > > seeing this when using EntityPersister? > > I've added the following logging code to the constructor of EntityLoader: > log.info("Built select=" + sql + " via " > + outerJoinGenerator.getClass().getName()); > > and get the following while running MultiTableTest: > .... > [junit] Nov 6, 2002 3:56:24 PM cirrus.hibernate.sql.Dialect <init> > [junit] INFO: Using dialect: cirrus.hibernate.sql.OracleDialect > .... > [junit] Nov 6, 2002 3:56:24 PM cirrus.hibernate.loader.OuterJoinLoader > <init> > [junit] INFO: Using JoinGenerator > cirrus.hibernate.loader.OracleOuterJoinGenerator > [junit] Nov 6, 2002 3:56:24 PM cirrus.hibernate.loader.EntityLoader <init> > [junit] INFO: Built select=SELECT rootc0.id_ AS id_, rootc01.amount as > amount10, rootc02.extraProp as extraProp8, rootc02.other2 as other29, > rootc0.count_ as count_0, rootc0.name as name1, rootc0.address as address2, > rootc0.date_ as date_3 FROM rootclass rootc0 left outer join submulti > rootc01 on rootc0.id_=rootc01.sid left outer join nuthasubclass rootc02 on > rootc0.id_=rootc02.sid WHERE rootc0.id_ = ? via > cirrus.hibernate.loader.OracleOuterJoinGenerator > [junit] Nov 6, 2002 3:56:24 PM > cirrus.hibernate.persister.MultiTableEntityPersister generateSelectString > [junit] INFO: Using select=select rootclass.id_, submulti.amount as > amount10, nuthasubclass.extraProp as extraProp8, nuthasubclass.other2 as > other29, rootclass.count_ as count_0, rootclass.name as name1, > rootclass.address as address2, rootclass.date_ as date_3 from rootclass, > submulti, nuthasubclass where rootclass.id_ = ? and > rootclass.id_=submulti.sid (+) and rootclass.id_=nuthasubclass.sid (+) > ..... > > Maybe the SQL-code from EntityLoader is never reached, but I have no clue, > where the sql-String from EntityLoader is comming from. > > > CU > -- > Wolfgang Jung, Softwareentwickler > Micromata_Objects GmbH Tel: +49 561 316793-0 > Marie-Calm Strasse 1, D-34131 Kassel Fax: +49 561 316793-11 > mailto:W....@mi... http://www.micromata.de |