You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by BOUESSAY Christian <cb...@businessdecision.com> on 2004/12/22 13:43:37 UTC

RE : [OJBDoclet] sequence + inheritance + anonymous key

Seems to almost work ... Thanks ;-)
 
But, there is another pb : we have references to other object in the super class declared with anonymous key;
when we use @ojb.modify-inherited name="nameOfReference" ignore="true" , the reference is not repeated in the extended class, but anonymous keys are.
 
How could we solve this?
 

	-------- Message d'origine-------- 
	De: Nouguier Olivier [mailto:olivier.nouguier@wanadoo.fr] 
	Date: mar. 21/12/2004 19:50 
	À: OJB Users List 
	Cc: 
	Objet: Re: [OJBDoclet] sequence + inheritance + anonymous key
	
	

	Hi
	
	http://www.mail-archive.com/ojb-user@db.apache.org/msg10447.html
	On Tue, 2004-12-21 at 18:10 +0100, BOUESSAY Christian wrote:
	> Hi,
	> 
	> We're using a database sequence manager ; when we insert an object, the next value of sequence is found; but how could we get the value of id?
	> 
	> for instance:
	> /**
	> * @ojb.class table="TableA"
	> *                   determine-extents="false"
	> */
	> Class A {
	> /**
	>  * @ojb.field primarykey="true"
	>  *                  autoincrement="database"
	>  *                  sequence-name="mySeq"
	>  */
	>  int id ;
	> 
	>  String creator;
	>  //...
	> }
	> 
	> /**
	> * @ojb.class table="tableB"
	> *                   include-inherited="false"
	> *
	> * @ojb.field name="id"
	> *                  jdbc-type="INTEGER"
	> *                  primarykey="true"
	> *
	> * @ojb.reference class-ref="....A"
	> *                         auto-retrieve="true"
	> *                         auto-update="true"
	> *                         auto-delete="true"
	> *                         foreignkey="id"
	> */
	> Class B extends A {
	>  String attr;
	>  // ...
	> }
	> 
	>
	> B obj = new B();
	> obj.setAttr("blabla...");
	> obj.store();
	> 
	> String id = obj.getId();
	> 
	> //-----------------> id is null, but maSeq.nextval was called ...
	> 
	>
	> We found that access is set to "readonly" for A and "anonymous" for B in 'repository_user.xml'.
	> And we would like to set these values to "readwrite"; how to do it?
	> (the annotation access="readwrite" doesn't work with others parameters ...)
	> 
	> Thanks.
	> 
	> Christian BOUESSAY
	> 
	--
	Nouguier Olivier <ol...@wanadoo.fr>
	
	
	
	---------------------------------------------------------------------
	To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
	For additional commands, e-mail: ojb-user-help@db.apache.org