Re: Proper way to query non-decomposed M-to-N association

2004-01-25 Thread Sean P. Hawkins
Jakob,

That worked like a charm.  Thank you.

--Sean

Jakob Braeuchi wrote:

hi sean,

have you tried adding a collection-descriptor 'addresses' to 
StudentImpl as well ? ojb does not support inheritance of descriptors.

hth
jakob
Sean P. Hawkins wrote:

Hello all,

I have an application that has people (and subtypes of people) 
containing addresses.  I am trying to construct a query to return all 
people with a city like "x".  So far, I've been less than successful.

My repository looks like this:

  
 class="com.steelpagoda.fist.model.Person">
 
  
 
  
class="com.steelpagoda.fist.model.PersonImpl"
table="people"
  >
 
name="id"
column="pid"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
 />

... snip ...

 


 
... snip ...

  

 
  
class="com.steelpagoda.fist.model.StudentImpl"
table="students"
  >
 
class-ref="com.steelpagoda.fist.model.PersonImpl"
 >

 

 
... snip ...
  

  
 
name="id"
column="addressid"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
 />
 
name="company"
column="company"
jdbc-type="VARCHAR"
 />
 
name="line1"
column="line1"
jdbc-type="VARCHAR"
 />
 
name="line2"
column="line2"
jdbc-type="VARCHAR"
 />
 
name="line3"
column="line3"
jdbc-type="VARCHAR"
 />
 
name="city"
column="city"
jdbc-type="VARCHAR"
 />
 
name="state"
column="stateprov"
jdbc-type="VARCHAR"
 />
 
name="postalCode"
column="postalcode"
jdbc-type="VARCHAR"
 />
 
name="country"
column="country"
jdbc-type="VARCHAR"
 />

name="residents"
element-class-ref="com.steelpagoda.fist.model.PersonImpl"
auto-retrieve="true"
auto-update="false"
indirection-table="peopleaddresses"
 >


 

name="tags"
element-class-ref="com.steelpagoda.fist.model.PersonAddressTag"
orderby="personId"
sort="ASC"
 >

 
 
 
  
class="com.steelpagoda.fist.model.PersonAddressTag"
table="peopleaddresses"
  >
 
name="personId"
column="pid"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="false"
 />

 
 
  
I can query on any person field and get the expected behavior with 
regard to addresses contained in the addresses collection (e.g. the 
correct addresses are associated with the appropriate people.)  If I 
try the following code, however:

Criteria crit = new Criteria();
crit.addLike("addresses.city", "%something%");
QueryByCriteria q = QueryFactory.newQuery(Person.class, crit, false);
retVal = pb.getCollectionByQuery(q);
I either get everyone or no one returned.  Obviously, the generated 
SQL is missing a clause to limit the cartesian product on the join.  
What am I doing wrong?  Any help would be greatly appreciated.  A 
similar query through the ODMG interface behaved in the same way.

Thanks in advance.

Sean P. Hawkins
Steel Pagoda Information Systems, Inc.
www.steelpagoda.com


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


Re: Proper way to query non-decomposed M-to-N association

2004-01-25 Thread Jakob Braeuchi
hi sean,

have you tried adding a collection-descriptor 'addresses' to StudentImpl as well 
? ojb does not support inheritance of descriptors.

hth
jakob
Sean P. Hawkins wrote:
Hello all,

I have an application that has people (and subtypes of people) 
containing addresses.  I am trying to construct a query to return all 
people with a city like "x".  So far, I've been less than successful.

My repository looks like this:

  
 class="com.steelpagoda.fist.model.Person">
 
  
 
  
class="com.steelpagoda.fist.model.PersonImpl"
table="people"
  >
 
name="id"
column="pid"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
 />

... snip ...

 


 
... snip ...

  

 
  
class="com.steelpagoda.fist.model.StudentImpl"
table="students"
  >
 
class-ref="com.steelpagoda.fist.model.PersonImpl"
 >

 

 
... snip ...
  

  
 
name="id"
column="addressid"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
 />
 
name="company"
column="company"
jdbc-type="VARCHAR"
 />
 
name="line1"
column="line1"
jdbc-type="VARCHAR"
 />
 
name="line2"
column="line2"
jdbc-type="VARCHAR"
 />
 
name="line3"
column="line3"
jdbc-type="VARCHAR"
 />
 
name="city"
column="city"
jdbc-type="VARCHAR"
 />
 
name="state"
column="stateprov"
jdbc-type="VARCHAR"
 />
 
name="postalCode"
column="postalcode"
jdbc-type="VARCHAR"
 />
 
name="country"
column="country"
jdbc-type="VARCHAR"
 />

name="residents"
element-class-ref="com.steelpagoda.fist.model.PersonImpl"
auto-retrieve="true"
auto-update="false"
indirection-table="peopleaddresses"
 >


 

name="tags"
element-class-ref="com.steelpagoda.fist.model.PersonAddressTag"
orderby="personId"
sort="ASC"
 >

 
 
 
  
class="com.steelpagoda.fist.model.PersonAddressTag"
table="peopleaddresses"
  >
 
name="personId"
column="pid"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="false"
 />

 
 
  
I can query on any person field and get the expected behavior with 
regard to addresses contained in the addresses collection (e.g. the 
correct addresses are associated with the appropriate people.)  If I try 
the following code, however:

Criteria crit = new Criteria();
crit.addLike("addresses.city", "%something%");
QueryByCriteria q = QueryFactory.newQuery(Person.class, crit, false);
retVal = pb.getCollectionByQuery(q);
I either get everyone or no one returned.  Obviously, the generated SQL 
is missing a clause to limit the cartesian product on the join.  What am 
I doing wrong?  Any help would be greatly appreciated.  A similar query 
through the ODMG interface behaved in the same way.

Thanks in advance.

Sean P. Hawkins
Steel Pagoda Information Systems, Inc.
www.steelpagoda.com


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


Proper way to query non-decomposed M-to-N association

2004-01-24 Thread Sean P. Hawkins
Hello all,

I have an application that has people (and subtypes of people) 
containing addresses.  I am trying to construct a query to return all 
people with a city like "x".  So far, I've been less than successful.

My repository looks like this:

  
 class="com.steelpagoda.fist.model.Person">
 
  
 
  
class="com.steelpagoda.fist.model.PersonImpl"
table="people"
  >
 
name="id"
column="pid"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
 />

... snip ...

 


 
... snip ...

  

 
  
class="com.steelpagoda.fist.model.StudentImpl"
table="students"
  >
 
class-ref="com.steelpagoda.fist.model.PersonImpl"
 >

 

 
name="id"
column="pid"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
 />

... snip ...

  

  
 
name="id"
column="addressid"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
 />

 
name="company"
column="company"
jdbc-type="VARCHAR"
 />

 
name="line1"
column="line1"
jdbc-type="VARCHAR"
 />

 
name="line2"
column="line2"
jdbc-type="VARCHAR"
 />

 
name="line3"
column="line3"
jdbc-type="VARCHAR"
 />

 
name="city"
column="city"
jdbc-type="VARCHAR"
 />

 
name="state"
column="stateprov"
jdbc-type="VARCHAR"
 />

 
name="postalCode"
column="postalcode"
jdbc-type="VARCHAR"
 />
 
name="country"
column="country"
jdbc-type="VARCHAR"
 />
   
 
name="residents"
element-class-ref="com.steelpagoda.fist.model.PersonImpl"
auto-retrieve="true"
auto-update="false"
indirection-table="peopleaddresses"
 >


 
   
 
name="tags"
element-class-ref="com.steelpagoda.fist.model.PersonAddressTag"
orderby="personId"
sort="ASC"
 >

 
   
  
 
  
class="com.steelpagoda.fist.model.PersonAddressTag"
table="peopleaddresses"
  >
 
name="personId"
column="pid"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="false"
 />

 
name="addressId"
column="addressid"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="false"
 />

 
name="tag"
column="tag"
jdbc-type="VARCHAR"
primarykey="true"
autoincrement="false"
 />

  

I can query on any person field and get the expected behavior with 
regard to addresses contained in the addresses collection (e.g. the 
correct addresses are associated with the appropriate people.)  If I try 
the following code, however:

Criteria crit = new Criteria();
crit.addLike("addresses.city", "%something%");
QueryByCriteria q = QueryFactory.newQuery(Person.class, crit, false);
retVal = pb.getCollectionByQuery(q);
I either get everyone or no one returned.  Obviously, the generated SQL 
is missing a clause to limit the cartesian product on the join.  What am 
I doing wrong?  Any help would be greatly appreciated.  A similar query 
through the ODMG interface behaved in the same way.

Thanks in advance.

Sean P. Hawkins
Steel Pagoda Information Systems, Inc.
www.steelpagoda.com


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