aspose file tools*
The moose likes Object Relational Mapping and the fly likes identifier of an instance of <class> was altered from old to null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "identifier of an instance of <class> was altered from old to null" Watch "identifier of an instance of <class> was altered from old to null" New topic
Author

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

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

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)


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: identifier of an instance of <class> was altered from old to null
 
Similar Threads
EJB3.0 example
How to link existing record from database table in ManyToMany Uni-directional relationship
LazyInitializationException Help please
Apache Derby Sql Statement's
JPA: incomplete SQL query