Maksimenko Alexander wrote:
I'm using 1.0.1 version
ojb doesnt produce exception but it generates

SELECT A0.GROUP_ID,A0.ID FROM USER A0 WHERE A0.GROUP_ID = ?
instead of:
SELECT A0.GROUP_ID,A0.ID FROM USER A0, group1 a1 WHERE A0.GROUP_ID = a1.id and a1.manager_id=?



AFAIK Jakob fixed some bugs in conjunction with query references. So I recommend to give upcoming OJB 1.0.2 from OJB_1_0_RELEASE branch a change.


regards,
Armin



Armin Waibel wrote:

Hi,

your mapping and query seems ok. Could you post the stack trace? Did you try latest from CVS OJB 1.0.x branch (branch OJB_1_0_RELEASE)?
In OJB test-suite we have a similar test ReferenceTest#testDeepPathQuery(), this test pass.


regards,
Armin

Maksimenko Alexander wrote:

hi!

it's wondering but I found out that its difficult to use interface driven design with ojb ;(
lets consider a simple 2-table example:


interface User{Integer getId(),Group getGroup()},
class UserImpl implements User{private Integer id; private Group group; access methods}


interface Group{Integer getId(),User getManager()},
class GroupImpl implements Group{private Integer id;privarte User manager; access methods}


What repository descriptor should be to get correct results with the following query:

QueryByCriteria query = QueryFactory.newQuery(User.class,new Criteria());
query.getCriteria().addEqualTo("group.manager.id",new Integer(4));
Collection users = broker.getCollectionByQuery(query);


Standard approach in mapping is not working ;(

<class-descriptor class="test.ojb.datamodel.User">
<extent-class class-ref="test.ojb.datamodel.impl.UserImpl"/>
</class-descriptor>
<class-descriptor class="test.ojb.datamodel.impl.UserImpl" table="USER" factory-class="test.ojb.datamodel.impl.FactoryImpl"
factory-method="createUser">
<field-descriptor name="id" column="ID" jdbc-type="INTEGER"
primarykey="true"
nullable="false"
autoincrement="true"
access="readonly"/> <field-descriptor name="groupId"
column="GROUP_ID"
jdbc-type="INTEGER"
access="anonymous"
/> <reference-descriptor
name="group"
class-ref="test.ojb.datamodel.Group"
proxy="true"
>
<foreignkey field-ref="groupId"/>
</reference-descriptor> </class-descriptor>


<class-descriptor class="test.ojb.datamodel.Group">
<extent-class class-ref="test.ojb.datamodel.impl.GroupImpl"/>
</class-descriptor>
<class-descriptor class="test.ojb.datamodel.impl.GroupImpl" table="GROUP1" factory-class="test.ojb.datamodel.impl.FactoryImpl"
factory-method="createGroup">
<field-descriptor name="id" column="ID" jdbc-type="INTEGER"
primarykey="true"
nullable="false"
autoincrement="true"
access="readonly"/> <field-descriptor name="managerId"
column="MANAGER_ID"
jdbc-type="INTEGER"
access="anonymous"
/> <reference-descriptor
name="manager"
class-ref="test.ojb.datamodel.User"
proxy="true"
>
<foreignkey field-ref="managerId"/>
</reference-descriptor> </class-descriptor>





--------------------------------------------------------------------- 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]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to