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 Bart Molenkamp <b....@bizzdesign.nl> on 2005/02/16 12:50:03 UTC

[ODMG] Problem storing 1:n relationship

Hi,

I'm having a little problem storing 1:n relationships. I have a
relationship between class Review and class Evidence (1:n, a review has
a collection of evidence and and evidence instance is only known in one
review). When I create a new review, add the evidence (also new
instances) and then store it (thus an insert for the review and an
insert for every evidence instance) it works fine.

However, when I have an existing review, and I add new evidence to it,
then locking the review does not store the evidence when I commit the
ODMG transaction.

Why is the evidence stored when all objects are new, but not when the
review exists and the evidence is new?

I found two work-arounds:
1. Explicitly lock all the evidence before committing the transaction.
2. Set auto-update="object" on the collection descriptor of the evidence
inside the review class descriptor. But the documentation on this
explicitly tells me *not* to set these (leave them default).

Is this a bug, or am I doing something wrong?

Thanks,
Bart.

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: [ODMG] Problem storing 1:n relationship

Posted by Armin Waibel <ar...@apache.org>.
Hi Bart,

Bart Molenkamp wrote:
> Hi,
> 
> I'm having a little problem storing 1:n relationships. I have a
> relationship between class Review and class Evidence (1:n, a review has
> a collection of evidence and and evidence instance is only known in one
> review). When I create a new review, add the evidence (also new
> instances) and then store it (thus an insert for the review and an
> insert for every evidence instance) it works fine.
> 
> However, when I have an existing review, and I add new evidence to it,
> then locking the review does not store the evidence when I commit the
> ODMG transaction.
> 

did you try first locking the review and then add the new evidence?
If this doesn't work try to lock the new evidence too after adding to 
review.

We are working on a better detection-algorithm for OJB1.0.2 or 1.0.3. 
You could try pre-1.0.2 from CVS (OJB_1_0_RELEASE branch, trunk is 
unstable 1.1). Some changes are checked in, but there are some issue 
with proxy collections (materialization on commit, ...). Hope I can fix 
all problems within 1 week.

regards,
Armin


> Why is the evidence stored when all objects are new, but not when the
> review exists and the evidence is new?
> 
> I found two work-arounds:
> 1. Explicitly lock all the evidence before committing the transaction.
> 2. Set auto-update="object" on the collection descriptor of the evidence
> inside the review class descriptor. But the documentation on this
> explicitly tells me *not* to set these (leave them default).
> 
> Is this a bug, or am I doing something wrong?
> 
> Thanks,
> Bart.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org