• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in JPA fetch

 
sudha murty
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using JPA for db transactions.
My problem is, I am able to insert the data in the tables properly, but while fetching the data, it gives the following exception:

java.lang.NoClassDefFoundError: javax/persistence/Persistence

The error is on the line --
EntityManagerFactory emf = Persistence.createEntityManagerFactory("testjpa");

There are two classes in persistence.xml
The code snippet for insert and fetch is similar. I mean the entityManager initialization and all.
Please help.

Thanks,
Sudha
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!