1 Reply Latest reply on Jan 3, 2007 6:16 PM by vk101

    EJB 3.0 questions

      The specification says that "Synchronization to the database does not involve a refresh of any managed entities unless the refresh operation is explicitly invoked on those entities."

      What would a refresh() do that synchronization with the database (e.g. at transaction commit time) would not? If the entities are synchronized to the database, doesn't that mean that the database and entity are the same...what, then, does a refresh() do, and in what cases should you call it?

        • 1. Re: EJB 3.0 questions

          Some more questions:

          2) Why is an exception thrown if an entity is persisted but it has relationships to new or removed entities without a cascade? Isn't the whole point of the cascade setting to give the flexibility of which relationships should be persisted?

          3) Many examples of detached entities give the example of a TRANSACTION-scoped EntityManager after the transaction has committed. But in an SLSB, how would you even have access to that detached entity (unless you serialize it and send it on its way...). Isn't the SLSB after the transaction commits gone, which would leave you no way to get to the detached entity reference, right?