Konrad wrote:
Hello.
In the database, I have an 'int4' (Postgresql) field called 'parentId'. It is a foreign key reference that may be null.
I'm mapping this 'int4' database field to an Integer Java field.
Database ========
Type ---- id:int4 prnt_id:int4
Java ====
Type.class ---------- Integer id; Integer parentId;
Mapping =======
<class name="Type" identity="id">
<map-to table="type"/>
<field name="id" type="integer">
<sql name="id" type="integer"/>
</field>
<field name="parentId" type="integer">
<sql name="prnt_id" type="integer"/>
</field>
I tried to do a query for when the 'parentId' value is null, but no results are being returned:
Query oql = db.getQuery("SELECT Type t where t.parentId=$1"); oql.bind(null);
Konrad,
There are two functions defined in the Lexer named is_defined() and is_undefined(). is_defined() will translate into is not null and is_undefined() will translate into is null. In your case above, is_undefined() can be used like so:
select Type t where is_undefined( t.parentId )
HTH.
Bruce
--
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\\"F9E<G)E=\\$\\!F<FEI+F-O;0\\`\\`");'
The Castor Project http://www.castor.org/
Apache Geronimo http://incubator.apache.org/projects/geronimo.html
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
