Hey guys,
There are some reasons why I assume either a JAR structure or a directory from these
URLs.
The contract between the app server and the persistence provider is defined by
javax.persistence.spi.PersistenceUnitInfo
When the container creates a PU, it calls
/**
| * Called by the container when an EntityManagerFactory
| * is to be created.
| *
| * @param info Metadata for use by the persistence provider
| * @param map A Map of integration-level properties for use
| * by the persistence provider (may be null if no properties
| * are specified).
| * @return EntityManagerFactory for the persistence unit
| * specified by the metadata
| */
| public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo
info, Map map);
Specifically the interesting bits of the contract are
/**
| * Interface implemented by the container and used by the
| * persistence provider when creating an EntityManagerFactory.
| */
| public interface PersistenceUnitInfo {
| [...]
|
| /**
| * @return The list of JAR file URLs that the persistence
| * provider must examine for managed classes of the persistence
| * unit. Each jar file URL corresponds to a named <jar-file>
| * element in the persistence.xml file.
| */
| public List<URL> getJarFileUrls();
|
| /**
| * @return The URL for the jar file or directory that is the
| * root of the persistence unit. (If the persistence unit is
| * rooted in the WEB-INF/classes directory, this will be the
| * URL of that directory.)
| */
| public URL getPersistenceUnitRootUrl();
|
| [...]
| }
The reading of the JavaDoc (and the intend of the spec) is that the persistence provider
expect either a directory or a JAR file.
I scan the root URL for 3 reasons:
- get the annotated classes
- get hbm.xml files
- get ORM.xml files
2 is proprietary to Hibernate of course.
Even if we define a proprietary abstraction implemented by JBoss AS and passed as an
argument to createContainerEntityManagerFactory (in the Map), it does not solves the whole
problem.
JBoss AS has to conform to the PersistenceUnitInfo contract so that other providers can
bootstrap :)
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4109018#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...