this would only work when using ID broker. That's why it is not implemented
like that.


fedor.

-------------------------------
Any expressions expressed here only express my own expressions.

> -----Original Message-----
> From: joe black [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 27, 2001 11:43 PM
> To: Turbine Developer
> Subject: Generate ID when OM is created, can I?
> 
> 
> 
> Suppose ClassRoom is an OM
> 
> ClassRoom classRoom=new ClassRoom();
> classRoom.set...
> ...
> classRoom.save();  
> ...
> 
> A primary key will be generated and retreived in the save() 
> method, how? After inserting, select the latest record which 
> have the equivalent attributes( could it be a little 
> dangerous? ), I guess. Anyway, maybe the select operation 
> cost more than inserting and the user didn't want the 
> generated ID at all.
> 
> Can IDBroker make a new ID for an OM as soon as this OM is 
> created?  If could, we can do like this...
> 
> ClassRoom classRoom=new ClassRoom(); //It has an ID now
> Student s1=new Student();  
> s1.setClassRoomId(classRoom.getId().getBigDecimal().intValue()
> ); //or Student s1=classRoom.createNewStudent();
> s1.set....
> ...
> 
> Student s2=new Student();
> s2.setClassRoomId(classRoom.getId().getBigDecimal().intValue());
> s2.set...
> ...
> 
> classRoom.set....
> ...
> 
> s1.save(conn);
> s2.save(conn);
> classRoom.save(conn);
> conn.commit()
> 
> Just a thought  ;-)Get more from the Web.  FREE MSN Explorer 
> download : http://explorer.msn.com
> 

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

Reply via email to