I'm new to JPA i 'm using eclipse Galileo and i want to run one JPA program
1) i had created one entity for table
2) i had created one test class to test the entity
3) i added Jpa.jar file in bulid path
But when i build the JPAproject it is showing one error Entity "TableName" has no id or embeded id
please giude me how to over come this i'm not using any hibernate and spring frame work just i'm running in stand alone application
The other one about @EmbeddedId means that you write a different class as the primary key and then you have a reference of it in your class and mark it with @EmbeddedId annotation.
I think if you can share your code we can point at exact location of error.
Hope this helps.
Might I suggest starting small and working up. Get something simple going.
I'd suggest using a primary key if you want to save your data. They're not optional in relational databases that use object relational mapping tools like Hibernate.
A good way to learn is to run programs and look at the result. Does it run? Does it work? Does it throw a runtime exception? Does it throw a runtime error?
Run the program! Then, if you run into a problem, explain the problem and we'll try and help you understand what is happening.
If you're not sure of the purpose of a primary key in a database table, you might want to start learning a bit more about databases and tables before jumping into JPA and Hibernate programming. The purpose of a primary key or id field in a JPA entity is really the same as the purpose in a database table.
However there is another thread which talks on the similar line.
Hibernate Mapping problem because no primary key in database
Error:javax.persistence.PersistenceException: Exception [EclipseLink-4021] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null]. Verify that you have set the expected driver class and URL. Check your login, persistence.xml or sessions.xml resource. The jdbc.driver property should be set to a class that is compatible with your database platform
but still im getting the runtime error when i execute the first statement
EntityManagerFactory factory = Persistence.createEntityManagerFactory("JPADemo", System.getProperties());
Please giude me how to run openjpa in j2se application i was struck from last two days
Also where is your persistence.xml located it should be in META-INF.
I think it is taking quite some time to fix your problem so i will say share your project structure and all the details like which all jars you have placed and where?