[JIRA] Created: (CAY-859) Cayenne agent misses JPA entity classes that were loaded before their PersistenceUnits

From: Andrus Adamchik (JIRA) ("Andrus)
Date: Sun Sep 02 2007 - 06:21:50 EDT

  • Next message: Andrus Adamchik (JIRA): "[JIRA] Created: (CAY-860) JPA no joins created for to-many relationship"

    Cayenne agent misses JPA entity classes that were loaded before their PersistenceUnits
    --------------------------------------------------------------------------------------

                     Key: CAY-859
                     URL: https://issues.apache.org/cayenne/browse/CAY-859
                 Project: Cayenne
              Issue Type: Improvement
              Components: Cayenne JPA
        Affects Versions: 3.0
                Reporter: Andrus Adamchik
                Assignee: Andrus Adamchik
                 Fix For: 3.0

    In a command line application running with Cayenne agent , the following code would result in exceptions about Artist not being persistent:

    Class.forName("test.Artist");

    EntityManagerFactory emf = Persistence
                                    .createEntityManagerFactory("cayenne-tutorial");
    EntityManager em = emf.createEntityManager();
    tx = em.getTransaction();
    tx.begin();
    em.createQuery("delete from Artist").executeUpdate();

    Since redefining already loaded classes is not possible (instrumentation spec prohibits adding fields to such classes for instance), the only solution I see is to trigger PersistentUnit loading from within the agent. I am going to make it optional as it slows down app startup. This will be an agent parameter "jpa-eager-load"

    -- 
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
    



    This archive was generated by hypermail 2.0.0 : Sun Sep 02 2007 - 06:22:19 EDT