Hi Armin,

There's one thing which is not right clear to me.
If I have one object A which has 1:1 references to B,C,D
which have many 1:1 references, and I want to insert a
new A object which makes reference to a B, C, D objects 
(Which already exist). I mean, I just want to insert an A object which
refers to other existent objects.

What I try to do (and doesn't work) is:

ClassA a=new A();
ClassB b=getTheBObjectIWant(); //this works, I have my B Object!
a.setB(b);
service.Insert(a);


/**being service.Insert:**/

public void Insert(ClassA a)
{
        odmg = OJB.getInstance();
        db = odmg.newDatabase();
        Transaction tx = odmg.newTransaction();
        ComponentBO obj=(ComponentBO)newItem;
        tx.lock(obj, Transaction.WRITE);
}

/**and my repository_user.xml has**/
            auto-update="false"
            auto-delete="false"
            auto-retrieve="true"
/*in every single reference-descriptor*/


Am I doing this Insert right or am i loosing something?

I get the following exception:

etc. etc. etc...

"Caused by: java.sql.SQLException: ERROR:  Cannot insert a duplicate key
into unique index compmake_name_key"

being compmake an object from the third group (not referred directly
from A but from B)

Any help is welcome! :)


Greets,


Martin Ivan Levi

Universistat Politecnica de Catalunya
Centre Tecnologic de Transferencia de Calor



On Mon, 2004-05-17 at 14:28, Armin Waibel wrote:
> Hi Martin,
> 
> Martin I. Levi wrote:
> 
> > Oops!
> > 
> > I already found where the auto-xxx settings should be placed, sorry!
> > Anyway I still think you should put all these auto-xxx information
> > together.
> > 
> 
> The auto-xxx settings differ in each type of relation (1:1, 1:n, m:n) 
> and belongs only to the associated relation, thus we describe these 
> settings in sub-sections of relation section. I think to put all 
> auto-xxx setting together will be complex.
> 
> The auto-retrieve setting is equal in all relations and described together
> http://db.apache.org/ojb/tutorial3.html#auto-retrieve%20setting
> 
> An introduction to auto-xxx setting can be found her
> http://db.apache.org/ojb/tutorial3.html#Setting%20Load,%20Update,%20and%20Delete%20Cascading
> 
> regards,
> Armin



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

Reply via email to