• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

identifier of an instance of <class> was altered from old to null

 
Sheriff
Posts: 9671
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I'm stuck in a problem. I have an EJB application with a persistence unit. Somehow a few records of a class got corrupted because of which the whole application almost broke. There is a class which has an id field. Now this id mechanism is weird so I'll show the structure of the class



The database has both id and userId columns. The id column is the primary key. Somehow the userId column's value was set to null for some records (id was ok as it is PK so cannot be null). But due to the getId method returning userId's value, I got this exception



Now I searched on the internet and found that this might happen because of ManyToOne relationship. Taking a look at the class structure, can anyone think of any cause of the problem. I can post the source of the related classes if you want.

I would be very much thankful for any help as I'm really stuck here...

(I've changed the class names because of my company policies but I've taken every care to make sure I don't make any mistakes)
 
It's a tiny ad. At least, that's what she said.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic