mnimer / dphibernate

Automatically exported from code.google.com/p/dphibernate
0 stars 0 forks source link

New children entities in collections not persisted #62

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When persisting a new object with a collection of child properties that are 
also new entities, the children in the collection are not persisted.

Eg:
{{{
    var author:Author = Author.withName("Some guy");
    var book:Book = getNewBook("Getting Real",author);
    author.books.addItem(book);
}}}

It is expected here that both `author` and `book` will be persisted as new 
entities.  However, `book` is not persisted.

Original issue reported on code.google.com by martypit...@gtempaccount.com on 16 Mar 2011 at 3:56

GoogleCodeExporter commented 9 years ago
Fixed in r298

Original comment by martypit...@gtempaccount.com on 16 Mar 2011 at 3:56

GoogleCodeExporter commented 9 years ago
Apparently this is still happening after r298

Original comment by martypit...@gtempaccount.com on 16 Mar 2011 at 2:32

GoogleCodeExporter commented 9 years ago

Original comment by martypit...@gtempaccount.com on 16 Mar 2011 at 2:33

GoogleCodeExporter commented 9 years ago
Not exactly sure where to put this code in the server side, so I wrote my own 
postUpdateInterceptor for my specific classes in the meantime. At least this 
successfully works with ManyToMany associations.

http://www.17od.com/2006/11/09/problem-with-hibernate-many-to-many-association/

Original comment by robert.b...@gmail.com on 21 Jul 2011 at 12:22