-->
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.  [ 1 post ] 
Author Message
 Post subject: Delete subclass problem
PostPosted: Sun Apr 04, 2010 8:41 pm 
Newbie

Joined: Sun Apr 04, 2010 8:27 pm
Posts: 2
Hi there,

I write a program which contains "user" and "staff" class. And the "staff" class is subclass of "user".

public class User extends BaseModel
{
protected boolean gender;

protected String name;

/* getter & setter */
}

public class Staff extends User
{
/* Link to User class ("many-to-one" relationship) */
private User supervisor;

private double salary;

/* getter & setter */
}


And in hbm file, I use "join-subclass" to configure them.

<class name="User" table="USER">
<id name="id" column="ID" type="string" length="32">
<generator class="uuid"/>
</id>

<property name="gender" column="GENDER" not-null="true" />
<property name="name" column="NAME" length="100" not-null="true" />

<joined-subclass name="com.crazysoft.db.domainobj.user.staff.Staff" table="STAFF">
<key column="ID"/>
<property name="salary" column="SALARY" not-null="true" />
<many-to-one name="supervisor" column="SUPERVISOR" class="User" not-null="true" />
</joined-subclass>
</class>


And the problem is every time, I delete the staff object, hibernate always deletes the related user object as well.

So, is there a way to only remove staff object and keep the related user object?

Thanks for help!


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

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.