JPA 2.0, hiberante 3.5, jars & persistence.xml location
Posted
by phmr
on Stack Overflow
See other posts from Stack Overflow
or by phmr
Published on 2010-04-18T15:10:04Z
Indexed on
2010/04/18
15:13 UTC
Read the original article
Hit count: 605
I'm building a desktop application using hibernate 3.5 & JPA 2.0.
I have 2 jars,
the lib, which defines every entity and DAO, packages looks like this :
org.my.package.models
org.my.package.models.dao
org.my.package.models.utils
In org.my.package.utils I defined my hibernate utility class for getting EM & EMF instances, which means the lib is bound to a Persistence Unit name but that's not a problem for now (anyway you can recommend me a better way to manage that)
the second jars is built as follow:
org.my.package.app
META-INF is defined on the root of the project which means in my jar I can find this directories directly in the root:
META-INF/
META-INF/persistence.xml
org/
org/my/
...
org/my/package/app/Main.class
META-INF/
When I run the app, hibernate doesn't managed to find persistence.xml it throws an exception something like "package or class for PersistenceUnitName not found".
I googled a bit about the problem but I can't get the source code organisation right.
Any help ?
© Stack Overflow or respective owner