Marcus Laranjeira

Greenhorn
+ Follow
since Jul 31, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Marcus Laranjeira

Problem solved!

I used SET instead of LIST!

Look at here and here!!!

Now it works!
Rahul,



I tried again with your suggestion and it did not work. Remains exactly the same problem.

Tested the various CASCADE options and there was no change in behavior.

Hello Rahul,

Thanks for your reply!

I did it already! Look at the exceptions:





Thanks again!
In some tests with Hibernate, to remove an entity that appears in 3 lines of an intermediate table, instead of removing it to 3 lines in this entity, he removed and inserted again ALL lines referring to those who remained in the intermediate table.

To understand better, see the code:

Entity TEAM:Entity TEAMTYPE:Entity INDIVIDUAL:Hibernate generated the following SQL script:The database was empty, so TeamTypes, Teams and individuals were added:In order to obtain such a situation that attend this diagram:



Then, the intermediate table was something like this:The problem I found is to remove the individual P7 with ID 7. Here he is on 3 teams, and correctly displayed on 3 lines of intermediate table with the correct relationship with the 3 teams.

The code to remove it is this:In implementing this, Hibernate should do everything I need, besides deleting the row relating to the individual, it should only delete 3 lines in the intermediate table. Except that instead he:I have also implemented a trigger in the database (Oracle) and it inserted as well as deleted. I suspected that the INSERTS were informational only. It does delete individual correctly. But it's inserting again into the intermediate table. The most strange is that after this operation the intermediate table is correct and no exceptions are thrown.

I can't understand why Hibernate is doing this.

For a table with 12 records, this is "peanuts", but imagine if I had 2,000,000 and remove 3? it would reinsert 1,999,997?

Where am I missing?

Regards from Brazil!