users@glassfish.java.net

Re: Please help me with integrating javax.persistence into GlassFish

From: <glassfish_at_javadesktop.org>
Date: Sun, 13 Jul 2008 00:36:10 PDT

Thank you Markus for your answer! I am not a beginner with Java, but i have only Java SE background, so i am new to the Java EE world. I started a job as a developer and was given the task to gain some initital experience in JPA. So i am a beginner with JPA and NetBeans.
I found out that the default implementation of JPA in GlassFish was provided by TopLink Essentials (through the 2 jars that you mentioned). I am trying to compile and run a simple web application which i got as an example from the official Sun Java EE 5 tutorial. So i suppose that it is the second case. However, both jars are present in the libraries imports in my app, so it should know that they exist and where to find them.
The problem is that my application cannot compile and the error i get is "package javax.persistence does not exist" which is caused by the import statement - import javax.persistence.*;

You say:

"or are you using TopLink inside of an enterprise application (ejb-jar file or
war file), then you just need the persistence.xml in either META-INF or
WEB-INF/classes/META-INF."

Going back to the file system i can see that the persistence.xml file is present in the META-INF directory. So it seems that this is all right too. Through the NetBeans IDE, project explorer, I can only see the WEB-INF section from all that you mention. I put the persistence.xml file in it (just in case) and compiled, but nothing changed. What seems to be the problem ?
[Message sent by forum member 'recursion' (recursion)]

http://forums.java.net/jive/thread.jspa?messageID=286220