hello people! in my attempt to learn a bit faster the use of spring and hibernate i read few chapter on books and created a simple java project from netbeans 6.7. I've decided to use the hibernate annotations instead of mapping files.so in my pojo i import javax.persistence.*; and i have an error that javax doesn't exist.what sound surprising to me.is it because it's a simple java application? i come from .Net background and the main idea about this mini project is to consume (DAOs) it as i would use a class library project in .Net.How to solve or i would just have to create another project type. if yes which one? thanks for reading.
+1
A:
This sounds like a classpath issue. are you adding the jar with javax.persistence to your classpath
akf
2009-07-09 12:14:56
hello thanks for your quick response.In the project under libraries nodes i have jdk1.6 and the whole rest of libraries i'm using.i'm a bit confuse about your statement.insn't javax a java fundamental i mean by that inside java itself?if no please kindly tell me where to find the javax.persistence jar in my C:\Program Files\Java\jdk1.6.0_13\ or C:\Program Files\Java\jre6. thanks
black sensei
2009-07-09 12:29:32
Java persistence api is not a part of jdk.
Mercer Traieste
2009-07-09 12:59:31
+1
A:
Which edition of NetBeans did you install? Did you install the one with Java Web and EE support? The Java Persistence API is part of Java EE, so the standard Java SE installation won't have the necessary libraries packaged.
aberrant80
2009-07-09 13:04:22
thanks for the reply.i installed the netbeans 6.7 all packages included.i have the java web and ee but just that i didn't start a web application nor a entreprize application.i thought they are just huge for this small demo i'm struggling with.so there is no way i can get it working on a simple java project?
black sensei
2009-07-09 13:20:33
If it's the full suite, then the library should be in there. I'm just working off my memory here, but if you go to your project properties, there should be a way to add a library or a dependency. You should be able to find the Hibernate library there.
aberrant80
2009-07-10 03:05:18
A:
You can probably add the persistence dependency via some artifact/facet that you need to set on the project. It should be there already, just have to find it.
But if you don't get anywhere, just google for persistence.jar (that's the name for the interface definitions of JPA).
Michael Wiles
2009-07-09 13:49:39
thanks you all for your response.I 've finally for now use mapping files.thanks again!
black sensei
2009-07-10 14:29:58