Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-812

deployment order mechanism + hibernate persistence provider

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.1 M2
    • Component/s: Runtime

      Description

      From my mail to dev list:
      --------------------------------------------------
      ...
      It's about "placeful service" and packages that want to contribute
      @Entity beans to that service.

      Currently we already have "notification service" contributing bean to
      placeful service, which is done in deployment-fragment.xml of
      notification service:
      ...
      <extension target="persistence#CLASS">
      <class>org.nuxeo.ecm.platform.ec.notification.UserSubscription</class>
      </extension>
      ...

      Above will become part of persistence.xml file inside
      nxplacefulservice-facade.jar directory in nuxeo.ear on jboss startup:

      <persistence>
      <persistence-unit name="nxplacefulservice">
      <jta-data-source>java:/DefaultDS</jta-data-source>
      <class>
      org.nuxeo.ecm.platform.ec.notification.UserSubscription
      </class>

      <properties>
      <property name="hibernate.hbm2ddl.auto" value="update"/>
      <property name="jboss.entity.manager.jndi.name"
      value="java:/nxplacefulservice"/>
      </properties>
      </persistence-unit>
      </persistence>

      So far so good.

      But the problem is that on jboss startup Hibernate persistence provider
      will do scan of jars to find @Entity beans defined in persistence.xml
      file and in our case if notification service is not yet deployed
      provider fails to find that @Entity bean.

      This leads to the fact that we need explicitely modify
      nxplacefulservice-facade's deployment-fragment.xml to include required
      jar containing @Entity bean(s) so that it is deployed before Hibernate
      analyzes persitence.xml file in placeful service:
      ...
      <require>nxnotificationservice.jar</require>
      ...

      which sucks, but actually does its job.

      The implications are that at the moment every package contributing
      @Entity beans to placeful service will need also to modify placeful
      service's deployment-fragment.xml to include itself as required to allow
      Hibernate provider to find @Entity beans.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: