Hello,
I am experimenting with OJB to retrieve data. I have trouble to create a Join with
OJB. The OJB version is RC5.
1) Here is part of my repository file,
<class-descriptor
class="z_jmccoy.JmpibmsVO"
table="JMPIBMS2">
<field-descriptor id="1" name="msgID" column="MSID" jdbc-type="INTEGER"
primarykey="true" />
..
<field-descriptor id="22" name="unitRefKey" column="MSPUREF" jdbc-type="INTEGER" />
<reference-descriptor name="pUnit"
class-ref="z_jmccoy.PhpunitVO"
auto-retrieve="true">
<foreignkey field-ref="unitRefKey" />
</reference-descriptor>
</class-descriptor>
<class-descriptor
class="z_jmccoy.PhpunitVO"
table="PHPUNIT">
<field-descriptor id="1" name="unitRef" column="UREF#" jdbc-type="INTEGER"
primarykey="true" />
..
</class-descriptor>
2) Here is part of program,
broker = ServiceLocator.getInstance().findBroker();
Criteria criteria = new Criteria();
criteria.addEqualTo("pUnit.unitRef", new Integer(4));
Query q = QueryFactory.newQuery(JmpibmsVO.class, criteria);
results = broker.getCollectionByQuery(q);
3) Here is the SQL statement created with OJB,
SELECT
A0.MSVBY,A0.MSDBY,A0.MSTIME,A0.MSDTIME,A0.MSCHTM,A0.MSPACCT#,A0.MSTO,A0.MSVTIME,A0.MSTEXT,A0.MSRSTS,A0.MSFROM,A0.MSFLAG,A0.MSSTS,A0.MSPREL,A0.MSCHDT,A0.MSDATE,A0.MSID,A0.MSDDATE,A0.MSCHBY,A0.MSVDATE,A0.MSPUREF,A0.MSTYPE
FROM JMPIBMS2 A0 WHERE A0.MSPUREF = ?
I do not see any Join in SQL statement.
Any help from some quick mind? Thank you in advance!
Jay