Greetings all,

I am attempting to get a simple inheritance structure working under OJB 1.0rc4 running under Jboss with postgres. Here's the background:

Repository.xml fragment:

<class-descriptor
class="com.steelpagoda.fist.model.PersonImpl"
table="people"
>
<!--
<extent-class class-ref="com.steelpagoda.fist.model.StudentImpl" />
--> <field-descriptor
name="id"
column="pid"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="lastName"
column="lastname"
jdbc-type="VARCHAR"
/>
..snip..


</class-descriptor>

<class-descriptor
class="com.steelpagoda.fist.model.StudentImpl"
table="students"
>
<reference-descriptor name="super"
class-ref="com.steelpagoda.fist.model.PersonImpl">
<foreignkey field-ref="id" />
</reference-descriptor>


<field-descriptor
name="id"
column="pid"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="false"
/>
<field-descriptor
name="foo"
column="foo"
jdbc-type="VARCHAR"
/>
</class-descriptor>



Query code:
Criteria crit = new Criteria();
crit.addLike("upper(lastName)", "%" + searchString.toUpperCase() + "%");
Transaction tx = odmg.currentTransaction();
PersistenceBroker pb = ((NarrowTransaction) tx).getBroker();
QueryByCriteria q = QueryFactory.newQuery(PersonImpl.class, crit, false);
Collection retVal = pb.getCollectionByQuery(q);



Here's what I'm getting:


- This works fine as listed.
- If I query against a field in StudentImpl ("foo"), it returns me full-fledged studentImpl objects with the appropriate inherited fields populated (working as expected.)
- If I uncomment the extent-class in PersonImpl, I get a sql error stating lastname is not an attribute. (broken)
- If I try to query against StudentImpl as follows:


crit.addLike("upper(super.lastName)", "%" + searchString.toUpperCase() + "%");
....
QueryByCriteria q = QueryFactory.newQuery(StudentImpl.class, crit, false);


I get a "relation super does not exist" error (broken)

The same behavior is exhibited by the ODMG query interface (as I would expect.)

Any ideas? Sorry if this is a stupid user error.

--Sean



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



Reply via email to