I am using JPA-Hibernate and 2.0 M5. I have followed all of the upgrade
notes.
Now, if I have 2 classes (say class A and class B). Suppose an object of
class A can contain one or many class B objects. 

If I have a method like this in my page controller:
and suppose all the B objects have already been initialized with a reference
to "a".
saveObjects(A a, List bList){

    //In 2.0 M4, I was able to do this:
    getAManager().save(a);
    for(int i = 0; i<bList.size(); i++){
        B b =bList.get(i);
        getBManager().save(b);
    }

    //In 2.0 M5, I have to do this:
    a = getAManager().save(a);
    for(int i = 0; i<bList.size(); i++){
         B b =bList.get(i);
        b.setA(a); //EVEN THOUGH THIS IS ALREADY SET FOR B, but since "a"
has been saved now, I have to
        //set it again, otherwise I get some very strange behavior with new
objects of class A being created FOR EACH NEW B.
        //why is this required?
        b = getBManager().save(b);
    }

}

Also, the caching is working very strangely with m5. If I add another B to A
(note that the A object is not updated at all, as B holds a reference to A),
and I try to refresh my page with a tree listing of A and then all the Bs
under it, the new B does not show up unless I initiate a new session. This
was also working fine with m4.

-- 
View this message in context: 
http://www.nabble.com/2.0-M5-DAO-upgrade-issue-tf4280031s2369.html#a12182560
Sent from the AppFuse - User mailing list archive at Nabble.com.

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

Reply via email to