i have opened an issue for this problem:
http://nagoya.apache.org/scarab/issues/id/OJB243
jakob
Jakob Braeuchi wrote:
hi peter,
how much did you pay to the ojb-crew to get an answer within two days ;)
anyway, the correct sql would look like this :
SELECT DISTINCT A0.gar* FROM Garage A0 LEFT OUTER JOIN Address A1 ON A0.garAddressOID=A1.addOID LEFT OUTER JOIN PersonAddress A1E0 ON A0.garAddressOID=A1E0.padOID ...
so imo this is a bug :(
jakob
Peter Wieland wrote:
Hi,
I posted the message below two days ago, and from my experience I would say
if there is no reply within two days, there's very few chance to have an
answer at all, that's way I annoy you one more time with this message.
This is quite important for us, so I would truly appreciate if someone from
the OJB staff (or any other who knows how it works) could give me some
hints.
I'd like to know if the problem I describe below is a known problem (or a
known fact, perhaps you do not consider it a problem?) and if anyone has any
suggestions how to proceed in the given case.
Thank you once again,
Peter
--- HIER BEGINNT DIE WEITERGELEITETE NACHRICHT ------------------------------ Von: [EMAIL PROTECTED] (Peter Wieland) Datum: 16.02.2004, 17:29:33 Betreff: Problem with inheritance mapping
Hi everyone,
I have two entity classes AddressImpl and PersonAddressImpl,
PersonAddressImpl extending AddressImpl (below the interesting parts of my
Mapping). A third class - GaragaeImpl - holds a reference to an AddressImpl
(might be an AddressImpl or a PersonAddressImpl).
<class-descriptor class="de.armax.ce.manager.entity.AddressImpl"
table="Address">
<extent-class class-ref="de.armax.ce.manager.entity.PersonAddressImpl"/>
<field-descriptor autoincrement="true" primarykey="true" column="addOID"
jdbc-type="VARCHAR" name="oID"/>
...
</class-descriptor>
<class-descriptor class="de.armax.ce.manager.entity.PersonAddressImpl"
table="PersonAddress">
<field-descriptor autoincrement="true" primarykey="true" column="padOID"
jdbc-type="VARCHAR" name="oID"/>
...
</class-descriptor>
<class-descriptor class="de.armax.ce.manager.entity.GarageImpl"
table="Garage">
...
<field-descriptor column="garAddressOID" jdbc-type="VARCHAR"
name="addressOID"/>
<reference-descriptor proxy="true" auto-delete="false"
auto-retrieve="true"
auto-update="false" class-ref="de.armax.ce.manager.entity.AddressImpl"
name="address">
<foreignkey field-ref="addressOID"/>
</reference-descriptor>
...
</class-descriptor>
As you can see, the primery key column has not the same name for the two tables (whereas the field name is the same for both classes). That's the source of my problem. I try to do a query by criteria with something like
Criteria crit = new Criteria();
crit.addEqualTo("address.aAddressField", aValue);
Collection result =
broker.getCollectionByQuery(QueryFactory.newQuery(GarageImpl.class, crit));
The generated SQL looks like
SELECT DISTINCT A0.gar* FROM Garage A0 LEFT OUTER JOIN Address A1 ON A0.garAddressOID=A1.addOID LEFT OUTER JOIN PersonAddress A1E0 ON A0.garAddressOID=A1E0.addOID ...
It seems that OJB is not aware of the different column names for the foreign
keys of PersonAddressImpl and AddressImpl entities (the problem only occurrs
for primary key columns, other columns are correctly mapped).
I would like to know if this is correct behaviour or not, in other words
does OJB allow the user to use different foreign key column names in one
extent or not. I would equally be interested in any suggestions how to get
my code running if possible without renaming the foreign key column of
PersonAddressImpl (this would break our global naming and design
conventions).
Thanks for any help,
Peter
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--- ENDE DER WEITERGELEITETEN NACHRICHT--------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
