-->
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.  [ 2 posts ] 
Author Message
 Post subject: Repeated column in mapping for entity
PostPosted: Wed Aug 10, 2005 7:56 pm 
Newbie

Joined: Tue Jul 19, 2005 1:28 pm
Posts: 17
Hi,
I am facing a problem with delete operation. My DB schema is like this

Entity A
---------
Pk - FacilityId
Some other fields

Entity B
--------
Pk - FieldId
Some other fields

Join Table C
--------------
Pk- FacilityId, FieldId

FacilityId references A.FacilityId
FieldId references B.FieldId
Some other fields


My classes are class A with FacilityId as id, class B with FieldId as id, class C with Class D as id, class D with classA, class B as the Id.

I declared a set object in class A with one-to-many relationship for class C. Inserting class C objects into the set is working perfectly fine and rows are inserted into C. But when I invoke clear function on the set, the rows are not getting deleted and it says that a foreign key constraint fails in table C. I read this somewhere and tried to make key element of the set in Entity A's mapping file to not-null = "true" but then an exception is generated saying that


Repeated column in mapping for entity class C, FacilityId should be mapped with insert="false" , update="false". I can only declare update="false" as an attribute of the key element. Where should I put insert attribute?. Only putting update generates the same exception.

What is the correct way to delete objects. Please give some advice.

Thanks in advance

Phani


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 5:52 pm 
Senior
Senior

Joined: Tue Jan 11, 2005 5:03 pm
Posts: 137
Location: Montreal, Quebec
Post your mapping please.

Usualy I put this in the <many-to-one [...] insert="false" update="false"> or in the <property [...] insert="false" update="false"> attributes if the key is used in the primary key.

Regards,

Etienne.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.