Issue Details (XML | Word | Printable)

Key: NXP-812
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Bogdan Stefanescu
Reporter: Ruslan Spivak
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Nuxeo Enterprise Platform

deployment order mechanism + hibernate persistence provider

Created: 31/03/07 17:14   Updated: 23/04/07 13:07
Component/s: Runtime
Affects Version/s: None
Fix Version/s: 5.1 M2

Time Tracking:
Not Specified

Resolution Date: 23/04/07 13:07
Require Callback: No
Participants: Bogdan Stefanescu and Ruslan Spivak
Tags:


 Description  « Hide
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.


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Ruslan Spivak added a comment - 31/03/07 17:15 - edited
Bogdan's comment:
------------------------------------

A possible approach to solve this type of problems would be to modify
the deployment order logic and instead of using "require" tags to
control the order
we could use "after" and/or "before" tags