-->
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: facing Problem with bidirectional realtionship
PostPosted: Sun Mar 05, 2006 10:20 am 
Newbie

Joined: Sun Nov 27, 2005 9:09 am
Posts: 2
Hi All

I am using hibernate 2.0.I am facing some problem with bidirectional relationship.
Here is my mapping file contents.

<class name="com.Text" table="TEXT">
<meta attribute="class-description">
Text
</meta>
<id name="sysKey" type="int" column="TEXT_SYSKEY">
<meta attribute="scope-set">public</meta>
<!-- This generator is used when the primary key is a natural key instead of a surrogate key-->
<generator class="native"/>
</id>
<property name="version" column="VERSION" type="int"/>
<property name="size" type="int"/>
<set name="Types" table="Types_Text_ASSOC" inverse="false" lazy="true" cascade="save-update">
<meta attribute="field-description">Types Associated with Text through Type_Text_Assoc table</meta>
<key column="TEXT_SYSKEY"/>
<many-to-many column="TYPE_SYSKEY" class="com.Type"/>
</set>
</class>


I am having collection Types in my class ,that is created for representing association between Type & Text.

Everything is working fine.But when i am updating the types of a Text object it is deleting all recrods from Type_Text_Assoc table and then inserting again.
It is not updating the data in table ,it should update the exiting and delete/insert other nwe/old elements.

It is a problem for me because a trigger is on my database on delete of any row from Type_Text_assoc table

Waiting for response


Regards
Sudhir


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 06, 2006 3:50 am 
Regular
Regular

Joined: Tue Dec 14, 2004 5:21 am
Posts: 104
Location: india
plz provide the implementation codes and class/mapping for both sides of association

_________________
sHeRiN
thanks for your ratings ...... :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 06, 2006 5:32 am 
Newbie

Joined: Sun Nov 27, 2005 9:09 am
Posts: 2
Hi

Here is DAO class


package com.text;


import java.util.*;

/**
* Created by IntelliJ IDEA.
* To change this template use Options | File Templates.
*/

public class Text
{
private Set types; // TYPES
private int version;
private int size;
private String sysKey;


public Set getTypes() {
return serviceInfoTypes;
}

public void setTypes(Set types) {
this.types = types;
}

public int getVersion() {
return version;
}

public void setVersion(int version) {
this.version = version;
}

public int getSize() {
return size;
}

public void setSize(int size) {
this.size = size;
}


public String getSysKey() {
return sysKey;
}

public void setSysKey(String sysKey) {
this.sysKey = sysKey;
}


}


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.