2 Replies Latest reply on May 13, 2005 4:11 AM by Emmanuel Bernard

    Entity persisting itself

    Bernhard Messerer Newbie

      Hi all!

      I have the problem that I have an object model with not-so-many entities but they have quite complex relationships with each other and a change to one entity can result in the auto-creation of quite a few others... at least that's how its supposed to work.
      Now the problem occurs that it is difficult saving the entities (because its difficult to know which ones got created).
      Generally, I have two options now: Either cascading a lot, which I fear it makes persisting slow, or entities save "themselves", probably even in the constructor.
      The question is: Can an EJB3 entity access the EntityManager? With @Inject? Can it then persist "itself"? in the constructor?
      Any hints very welcome!

      kind regards,