[hibernate-dev] Discovering/configuring package-info
Steve Ebersole
steve at hibernate.org
Mon Mar 18 12:09:22 EDT 2013
Out of curiosity, where is this documented as being supported?
On Mon 18 Mar 2013 08:34:29 AM CDT, Steve Ebersole wrote:
> The spec does not say anything about explicitly specifying packages.
> I was not aware of handling for that in the old code which I have been
> trying to de-spaghetti for some time, I can add that capability back in.
>
> On 03/18/2013 08:22 AM, Christian Bauer wrote:
>> Trying to upgrade to 4.3-SNAPSHOT, the
>> EntityManagerFactoryBuilderImpl.indexResource() is failing for my
>> persistence.xml configuration in Java SE with
>> Persistence.createEntityManagerFactory():
>>
>> <persistence-unit name="SimplePU">
>> <jta-data-source>myDS</jta-data-source>
>> <class>org.jpwh.model</class>
>> <class>org.jpwh.model.simple.Item</class>
>> <class>org.jpwh.model.simple.User</class>
>> <class>org.jpwh.model.simple.Bid</class>
>> <class>org.jpwh.model.simple.Address</class>
>> <class>org.jpwh.model.simple.Category</class>
>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>> </persistence-unit>
>>
>> The <class>org.jpwh.model</class> was necessary in 4.1 to get the
>> package-info.java of that package included, it contains my
>> @GenericGenerators.
>>
>> [main ] TRACE - 13:57:28,926 -
>> nternal.ClassLoaderServiceImpl: trying via [new
>> URL("org/jpwh/model.class")]
>> [main ] TRACE - 13:57:28,926 -
>> nternal.ClassLoaderServiceImpl: trying via
>> [ClassLoader.getResourceAsStream("org/jpwh/model.class")]
>> Exception in thread "main" javax.persistence.PersistenceException:
>> [PersistenceUnit: SimplePU] Unable to open input stream for resource
>> org/jpwh/model.class
>> at
>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1133)
>>
>> at
>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.indexResource(EntityManagerFactoryBuilderImpl.java:337)
>>
>> at
>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildJandexIndex(EntityManagerFactoryBuilderImpl.java:315)
>>
>> at
>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.locateOrBuildJandexIndex(EntityManagerFactoryBuilderImpl.java:306)
>>
>> at
>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:205)
>>
>> at
>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:169)
>>
>> at
>> org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:43)
>>
>> at
>> org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:135)
>>
>> at
>> org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:81)
>>
>> at
>> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
>>
>> at
>> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
>>
>> at org.jpwh.env.JPA21Setup.<init>(JPA21Setup.java:19)
>> at org.jpwh.test.Test.main(Test.java:12)
>> Caused by: java.io.IOException: Stream closed
>> at
>> java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:151)
>> at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
>> at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
>> at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
>> at java.io.DataInputStream.readFully(DataInputStream.java:195)
>> at java.io.DataInputStream.readFully(DataInputStream.java:169)
>> at org.jboss.jandex.Indexer.verifyMagic(Indexer.java:387)
>> at org.jboss.jandex.Indexer.index(Indexer.java:630)
>> at
>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.indexResource(EntityManagerFactoryBuilderImpl.java:334)
>>
>>
>> It looks like the only way to currently get package-info picked up is
>> with automatic scanning. But in my case
>> scanningContext.isDetectClasses() is false…
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
More information about the hibernate-dev
mailing list