• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Serious error in JPA with @Version

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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),
VERSION int
)

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 .

Thanks

 
reply
    Bookmark Topic Watch Topic
  • New Topic