https://anonsvn.jboss.org/repos/hibernate/core/trunk/entitymanager/src/ma...
is your best shot.
Enumeration<URL> xmls = Thread.currentThread()
| .getContextClassLoader()
| .getResources( "META-INF/persistence.xml" );
| if ( ! xmls.hasMoreElements() ) {
| log.info( "Could not find any META-INF/persistence.xml file in the
classpath");
| }
| while ( xmls.hasMoreElements() ) {
| URL url = xmls.nextElement();
| log.trace( "Analysing persistence.xml: {}", url );
| List<PersistenceMetadata> metadataFiles = PersistenceXmlLoader.deploy(
| url,
| integration,
| cfg.getEntityResolver(),
| PersistenceUnitTransactionType.JTA ); //might be RESOURCE_LOCAL in EE?
| for ( PersistenceMetadata metadata : metadataFiles ) {
| String provider = metadata.getProvider(); //could be used for a shortcut if
Hibernate
| List<String> classes = metadata.getClasses();
| //same for mappingFiles can be orm.xml or hbm.xml with Hibernate
| Set<String> jarFiles = ...; //need to scan these for @Entity @Embedded
@MappedSuperclass
| boolean exclude = metadata.getExcludeUnlistedClasses();
| //if exclude == true => do not scan @Entity @Embedded @MappedSuperclass in the
*main* jar
|
| }
| }
you will also need orm.xml parsing and check for , <mapped-superclass > and
consider as the default package.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224062#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...