1 Reply Latest reply on Sep 27, 2008 7:31 AM by swd847

    Odd behavior (maybe)-Confused programmer (likely?)

    meetoblivion

      I've noticed something, at least with my code (though I'm not sure if this is really seam related or just EJB-JPA in general, though I never encountered this before in 3.0)


      Let's say I'm editing an entity.  That entity has a list of another type of entity.  From what i've read, if i want to add a new entity and associate it with this parent entity, it should simply be a matter of instantiating the new entity, setting the values, adding it to the list, and persisting the parent.


      If I do this with a plain EJB tied to a web service, it works fine.  I pull the entity out of the db, create the new child, add it, persist it, it works fine.


      When I try a similar thing with seam, it results in an exception dealing with transient objects - the new one i created.  To fix this, i added code to persist the new entity first then save the parent.  That approach seems too cumbersome for me.  I'm using Extended persistence context, in case it matters.  I forget the type used in the web service one, not my code.