|
I have 2 objects o1 and o2.
They map 2 tables joined with a foreign
key
My database is Oracle 8i
I set 2 key generators in my mapping.xml
file.
<key-generator name="SEQUENCE"
alias="seqo1">
<param name="sequence" value="schema.o1"/> <param name="returning" value="false"/> <param name="trigger" value="true"/> </key-generator> when I set trigger=false; castor can't set the
sequence.
Can anybody manage to set trigger to true for
Oracle
So I set it to true and set a trigger for each
table
My main problem follow:
I want to create an Object2 wich references
Object1
I use the following code
Database db;
db = _jdo.getDatabase(); db.begin(); Object1 o1 =
new Object1();
o1.setName(....); (1) System.out.println ("o1
created:"+o1.getId());
Object2 o2 = new
Object2();
o2.setO1(o1); db.create(o2);
db.commit(); db.close();
In (1), I try to commit and open a new
transaction. but Castor never get the id generated by my sequence for the first
object so the second object always reference a null id of Object1.
any help will be appreciated.
jean-noel
|
