Hi Jackob,
this is the class descriptor I currently use.
Thanks for help!
Alessandro
<class-descriptor class="db.DBObject" table="DBOBJECT">
<field-descriptor
name="name"
column="NAME"
jdbc-type="VARCHAR"
primarykey="true"
/>
<collection-descriptor
name="attributes"
auto-delete="true"
auto-update="true"
element-class-ref = "db.DBAttribute">
<inverse-foreignkey field-ref = "owner" />
</collection-descriptor>
</class-descriptor>
<class-descriptor
class="db.DBAttribute"
table="DBATTRIBUTE">
<field-descriptor
name="nname"
column="NAME"
primarykey="true"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="vvalue"
column="VALUE"
jdbc-type="VARCHAR"
/>
<field-descriptor
name="owner"
column="OWNER"
jdbc-type="VARCHAR"
primarykey="true"
access="anonymous"
/>
</class-descriptor>
> Da: Jakob Braeuchi <[EMAIL PROTECTED]>
> Data: Fri, 20 Feb 2004 21:57:23 +0100
> A: OJB Users List <[EMAIL PROTECTED]>
> Oggetto: Re: JOIN and aliases...is this a bug?
>
> hi alessandro,
>
> could you please post the class-descriptors ?
>
> jakob
>
> Alessandro Villamaina wrote:
>
> > Hi all,
> >
> > I have the following class declaration (pseudo code):
> >
> > class DBObject
> > private String name
> > private Collection attributes
> >
> > class DBAttribute
> > private String name
> > private String value
> >
> > when I execute a query like the following (with PB API):
> >
> > Criteria c = new Criteria();
> > c.addEqualsTo("attributes.name", "Ale");
> > Query q = QueryFactory.newQuery(DBObject.class, c);
> >
> > the generated SQL statement is
> >
> > SELECT A0.NAME FROM DBOBJECT A0 JOIN DBATTRIBUTE A1 ON A0.NAME=A1.OWNER WHERE name
> > = 'Ale';
> >
> > where OWNER is the column used by OJB to maintain references between an object and
> > its attributes as specified in the repository_user.xml.
> >
> > It seems OJB "forgets" to use the alias A1 to qualify the attribute name in the
> > WHERE clause; since both tables have such attribute, the query fails (using name
> > instead of A1.name is ambiguous).
> >
> > Is this a bug in OJB or am I doing something wrong?
> > Thanks,
> >
> > Alessandro
> >
> > ---------------------------------------------------------------------
> > 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]