Yep, and if you did want to select, say multiple objects where the
first ID was 1 you could always go through OQL to select them, and
this would also work if you just didn't have a second key (or at least
it should).

'SELECT c FROM com.foo.Object c WHERE c.id1 = $1'

Or something like that should do the trick.

-Nick

On 8/4/05, Werner Guttmann <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I am afraid this won't work with Castor, as identity columns have to carry a 
> meaningful value.
> 
> Regards
> Werner
> 
> wg> -----Original Message-----
> wg> From: Vijayanand Sukumar [mailto:[EMAIL PROTECTED]
> wg> Sent: Thursday, August 04, 2005 4:42 AM
> wg> To: [email protected]
> wg> Subject: [castor-user] Problem in using db.load when
> wg> mutilple Columns
> wg> are used as Primary Key
> wg>
> wg>
> wg> All,
> wg>
> wg> I have a oracle view that I mapped to a Jdo. The view has
> wg> two columns that
> wg> combine to form the identity for the JDO.
> wg>
> wg> <class name="com.foo.Object" identity="id1 id2" >
> wg> ...
> wg>             <field name="id1" type="long">
> wg>                     <sql name="ID1" type="bigint"/>
> wg>             </field>
> wg>             <field name="id2" type="string">
> wg>                     <sql name="ID2" type="bigint"/>
> wg>             </field>
> wg> </class>
> wg>
> wg> Where id2 may or may not be null in the view.
> wg>
> wg> This object is queried by using
> wg>
> wg> db.load(com.foo.Object.class,new Complex(new Long(1),new
> wg> String("2"),Database.ReadOnly);
> wg>
> wg> This works fine. The problem arises when there is no id2.
> wg>
> wg> I tried using
> wg>
> wg> db.load(com.foo.Object.class,new Complex(new Long(1),new
> wg> String(""),Database.ReadOnly);
> wg>
> wg> Which did not work and tried using
> wg>
> wg> db.load(com.foo.Object.class,new Complex(new
> wg> Long(1),null,Database.ReadOnly);
> wg>
> wg> Which also did not work.
> wg>
> wg> Can someone please help me on how to specify the nullable
> wg> field in db.load ?
> wg>
> wg>
> wg> Thanks
> wg>
> wg> Vijay
> wg>
> wg>
> wg>
> wg>
> wg> -------------------------------------------------
> wg> If you wish to unsubscribe from this list, please
> wg> send an empty message to the following address:
> wg>
> wg> [EMAIL PROTECTED]
> wg> -------------------------------------------------
> wg>
> wg>
> 
> -------------------------------------------------
> If you wish to unsubscribe from this list, please
> send an empty message to the following address:
> 
> [EMAIL PROTECTED]
> -------------------------------------------------
> 
>

-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to