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)