• Post Reply Bookmark Topic Watch Topic
  • New Topic

Serious error in JPA with @Version  RSS feed

Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am trying to use JPA entity class to insert and update records in to Java Durby Database and i am using @Version.

I m using NetBeans 6.1,Java Durby as a database

following is my table in database :

create table STUDENT
RNO int primary key,
FNAME varchar(20) ,
LNAME varchar(20),
M1 int,
M2 int,
AVEG double,
RES varchar(20),

Following is my Entity calass :

I am using Oracle Toplink as Persistance Provider :

Following is my Persistance Unit's persistence.xml file :

Following is a Client code i am using to Insert a Record :

The above code works completely fine and it inserts a record in to database with VERSION = 1

but wen i try to update the same record by following code i m getting an error :
Update code :

when i run the above program i ger following error in output window :

While updating the version should become 2 but instead i get the above error.

I m getting the same problem while using the same entity class in EJB also with glassfish server & Durby DB
I have no idea from where this java.lang.NullPointerException is coming from

IF I REMOVE @Version FROM ENTITY CLASS THE CODE WORKS FINE it then updates the record.

please let me know if i have made any mistakes .


With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!