-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Hibernate deletes after insert
PostPosted: Mon May 10, 2010 12:30 pm 
Newbie

Joined: Mon Mar 08, 2010 3:44 am
Posts: 8
Hello.

I have 5 tables:

ATRIBUTES (ID_ATRIBUTES) ->
GRAFICS_ATRIBUTES (composed ID - ID_GRAFICS, ID_ATRIBUTES) ->
GRAFICS (ID_GRAFICS, ID_NODES) ->
NODES (ID_NODES) ->
NODES_ATRIBUTES (many to many ID_NODES, ID_ATRIBUTES) ->
ATRIBUTES (ID_ATRIBUTES)

I am trying to update the table GRAFICS and the table GRAFICS_ATRIBUTES.

When I try to update some of those tables, hibernate deletes all the NODES_ATRIBUTES with the ID_ATRIBUTE used in the GRAFICS_ATRIBUTES.

I can't see what's going on... some ideas?.

Thank you very much.


Top
 Profile  
 
 Post subject: Re: Hibernate deletes after insert
PostPosted: Tue May 11, 2010 12:36 pm 
Newbie

Joined: Mon Mar 08, 2010 3:44 am
Posts: 8
I am going to explain what I am doing so maybe that way somebody can see my mistake... this has been driving me crazy the last couple of days.

I am getting a list of GRAFICS so the user can choose one.

With this GRAFIC I get all its parameters again, including a HashSet of GRAFICS_ATRIBUTES and a HashSet of NODES.

The HashSet of GRAFICS_ATRIBUTES includes at the same time a HashSet of ATRIBUTES.

The user can pickup then a NODE from the GRAFIC HashSet and add new ATRIBUTES to the GRAFICS_ATRIBUTES or edit the ones that the GRAFIC already has.

If the user decides to add a new ATRIBUTE then I et a list of them with the ID_NODE.

When the user send all the form I construct the new GRAFIC_ATRIBUTES with the new ATRIBUTES or it edits the old GRAFIC_ATRIBUTES with the new changes and I edit the GRAFIC datas.

Then when I try to update the GRAFIC, to delete all the GRAFICS_ATRIBUTES (before insert them again) it always deletes in the table NODES_ATRIBUTES every row with an ID_ATRIBUTE ready to be inserted with a GRAFIC_ATRIBUTE.

Someone can see something wrong?


Top
 Profile  
 
 Post subject: Re: Hibernate deletes after insert
PostPosted: Tue May 11, 2010 12:38 pm 
Newbie

Joined: Mon Mar 08, 2010 3:44 am
Posts: 8
maqjav wrote:
The user can pickup then a NODE from the GRAFIC HashSet and add new ATRIBUTES to the GRAFICS_ATRIBUTES or edit the ones that the GRAFIC already has.


I forgot to say that those HashSet are proxies, so I have to deproxy them first.
I've been reading some bugs and it seems the proxies were creating a new session, isn't it?
Maybe I have my tables in different sessions so it's causing the crash in the NODES_ATRIBUTES class?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.