Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2009
    Posts
    16
    Rep Power
    0

    Default EntityManager.refresh() works only on managed entities.

    Why can't EntityManager.refresh() work on detatched entities? Any reason behind this ?

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    If the EntityManager is container managed and of type PersistenceContextType.TRANSACTION then a transaction is required. Otherwise how does the implementation know which database to refresh from?

  3. #3
    Join Date
    Oct 2009
    Posts
    16
    Rep Power
    0

    Default

    Agreed.. transaction is required but what it has to do with detatched instance ?
    Moreover:
    P-331 says : "We use the method to undo changes made by the ItemManager client and return fresh entity data from the database."
    but when we call merge() (before refresh()), the changes made by the client will get reflected in the database.

Similar Threads

  1. Application-Managed EntityManager transaction type must be RESOURCE_LOCAL
    By CatchSandeepVaid in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 11-23-2009, 05:56 PM
  2. sound works then stops!
    By smileii in forum CLDC and MIDP
    Replies: 0
    Last Post: 09-26-2009, 12:06 AM
  3. Container Managed Persistence
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-27-2007, 10:16 AM
  4. Replies: 2
    Last Post: 06-30-2007, 03:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •