Reputation: 553
I have a spring-hibernate application and facing a strange issue. I have 2 separate instances of same app connecting to two different oracle databases. I have a function which uses hibernate's saveOrUpdate() method to update an object in DB. Also primary key of this entity is foreign key of number of tables.
Problem is when we update this entity's object, all the foreign references of this object in other tables are nullified in one of the DB though everything works fine in other DB. Because of this we are having lots of null foreign keys in the DB. I am not able to figure out why this is happening and what exactly needs to be done as for one db everything seems to work fine. Please help.
Upvotes: 3
Views: 147
Reputation: 1016
I suggest you first add foreign key constraint in other tables in oracle database. So whenever any process tries to nullify foreign key, that process will fail. Now advantage of this failure is, you will be able to exactly track where the problem is occuring.
If hibernate is messing up data (which should not be the case ideally) then exception trace will show hibernate classes in trace, else if some database trigger or something else in DB is causing issue then you will get SQL error code in exception stack trace.
So please try this & let us know what you find. May be you will get answer there itself.
Upvotes: 2