Hi,
I working hard at the m:n issue for the odmg-api. Think in upcoming 1.0.2 the hassle with m:n will be fixed.
Till the new release is out, you can try the way described by Bart (but recommend to use tx.flush() by casting tx to TransactionExt instead of tx.checkpoint, because when rollback is needed) or to use the underlying PB-api to store the m:n relations.
regards, Armin
Brian Chaplin wrote:
I'm having the same problem. Is there an elegant solution to this in OJB? Bart Molenkamp wrote:
Hi,
I've a problem storing objects using m:n relations. Suppose I have a class Person, and a class Project, and an m:n relationship between them (classic example). Now, in a single transaction, I want to create a new person instance, a new project instance, set a relationship between them, and then store them both (add them to the database because they're new) by committing the transaction. But I get an error, because of an insert on table "person_project" which says that I violate a constraint: when storing the person instance, it also stores the relationship but the project isn't stored in the database yet.
I could work-around this by first creating a new person, a new project, storing them both (transaction.checkpoint()) and then setting the relationship, and commit() the transaction. But is there anyway that I can tell OJB to do this transparently?
Thanks, Bart.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
