0
votes

I'm actually finishing a Desktop App That implements JPA for DB Communication. I Have a JPA Util class that does the following:

private EntityManagerFactory emf = new EntityManagerFactory();

emf = Persistence.getEntityManagerFactory("default");

This "default" value is defined for my persistence.xml contained in the META-INF source folder and it works properly while using Eclipse.

What happens is that when i compile it, it doesn`t recognizes this folder as a source folder inside the jar file and says that: "there are no entity manager set as default" or something like that. I need to know if somebody can help me call my persistence.xml file into my PersistenceManagerFactory without having to use a source folder for it (it seems that getEntityManagerFactory does it for itself)

Thanks

2
Which JPA implementation are you using?yusuf

2 Answers

1
votes

Ensure the jar is on your classpath, as well as your JPA provider and the JPA persistence.jar.

What is the full exception stack?

0
votes

Try looking for it on the classppath

emf = Persistence.getEntityManagerFactory("classpath:default");