1 Reply Latest reply on Dec 3, 2012 4:30 PM by smarlow

    OSGi JPA Support in AS7

    thomas.diesler

      Relates to: https://issues.jboss.org/browse/AS7-5476

       

      In AS7 we a maven module osgi/integration/jpa - this is where all the OSGi/JPA related code should go.

      Ultimately we would like to run the OSGi JPA TCK on AS7 and it should pass.

        • 1. Re: OSGi JPA Support in AS7
          smarlow

          I have a few questions below about R5 section 127.4.6 + 127.4.7:

          section 127.4.6 Registering the Entity Manager Factory Builder Service

           

          Once the Persistence Bundle is ready, a JPA Provider must register an Entity Manager Factory Builder

          service for each assigned Persistence Unit from that Persistence Bundle.

           

          The Entity Manager Factory Builder service must be registered with the service properties listed in Service Registrations on page 441. The Entity Manager Factory Builder service is registered under the org.osgi.service.jpa.EntityManagerFactoryBuilder name. This interface is using the JPA packages and is therefore bound to one of the two supported versions, see Dependencies on page 432.   The Entity Manager Factory Builder service enables the creation of a parameterized version of an Entity Factory Manager by allowing the caller to specify configuration properties. This approach is necessary if, for example, the Persistence Unit is not complete.

           

          section 127.4.7 Registering the Entity Manager Factory

           

          A complete Persistence Unit is configured with a specific relational database driver, see JDBC Access in JPA on page 436. A JPA Provider must have an Entity Manager Factory service registered for each assigned and complete Persistence Unit when:

           

          *  The originating Persistence Bundle is ready, and

          *  A matching Data Source Factory service is available.  Matching a Data Source Factory service to a Persistence Unit is discussed in Database Access on page 443.

           

          A JPA Provider must track the life cycle of the matching Data Source Factory service; while this service is unavailable the Entity Manager Factory service must also be unavailable. Any active Entity Managers created by the Entity Manager Factory service become invalid to use at that time.  The Entity Manager Factory service must be registered with the same service properties as described for the Entity Manager Factory Builder service, see Service Registrations on page 441. It should be registered under the following name:

           

          javax.persistence.EntityManagerFactory

           

          The EntityManagerFactory interface is from the JPA packages and is therefore bound to one of the two supported versions, see Dependencies on page 432.

           

          An Entity Manager Factory is bound to a Data Source Factory service because its assigned Persistence Unit was complete.  However, a Client Bundle could still provide JDBC configuration properties for the createEntityManager(Map) method. This not always possible, see Rebinding on page 443.

          Will the  AS OSGi JPA codebase contain the code that creates the Entity Manager Factory service.  The above sections refer specifically to the JPA provider handling this part.