Hello,

I have observed a behaviour in the PB query engine which
could be improved in my opinion.

I have a persistence-capable class 'Node' with a reference 
'parentNode' of type 'Node' (suitable to build a tree).

As usual with OJB, there is a (private) field 'parentNode_refid'
whose type corresponds to the primary key of class Node.  (long 
in my case.)  Here is a excerpt from my repository.xml: 

<field-descriptor name="parentNode_refid" ... />
<reference-descriptor name="parentNode" class-ref="Node">
  <foreignkey field-ref="parentNode_refid"/>
</reference-descriptor>

I want to formulate a query for all nodes that do not
have a parent node.  What I consider canaconical from the
documentation was:

criteria.addIsNull("parentNode"); // does not work

But that does not work.  Unfortunately, I does not through
an exception either.  The query will just return no objects.

What I have to write is:

    crit.addEqualTo("parentNode_refid", new Integer(0));

which is somewhat ugly because it uses the "secret" auxiliary
reference which I would like to hide from the developer.
(It is no big deal for our project because we have a 
layer on top of OJB where I can easily hide this.)

What do you think?

Olli


-- 
  Oliver Matz
  ppi Media GmbH
  Deliusstra�e 10
  D-24114 Kiel
  phone +49 (0) 43 1-53 53-422
  fax           +49 (0) 43 1-53 53-2 22
  email mailto:[EMAIL PROTECTED]
  web   www.ppi.de


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

Reply via email to