-->
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: Prevent Child to update its Parent
PostPosted: Tue Aug 21, 2007 7:42 am 
Newbie

Joined: Tue Aug 21, 2007 7:11 am
Posts: 2
Hi there.

I have a unidirectional many-to-one mapping. There is a requirement that child entity should not be able to update the parent entity.

The mapping is following:
Code:
<hibernate-mapping package="com.system.dao.hibernate">
    <class name="com.system.Budget" table="BUDGET">
        <id name="id" column="ID" type="long">
            <generator class="sequence">
                <param name="sequence">SEQ_BUDGET</param>
            </generator>
        </id>
        <property name="name" column="NAME" type="string"/>

        <join table="SECURITY_OBJECT" subselect="select OBJECT_ID, SECURITY_GROUP_ID from SECURITY_OBJECT so where so.SECURITY_OBJECT_TYPE_CODE = 'BUDGET'" inverse="true" optional="true">
            <key column="OBJECT_ID"/>
            <many-to-one name="securityGroup" column="SECURITY_GROUP_ID" class="com.system.security.SecurityGroup" lazy="false" update="false" insert="false" cascade="none" />
        </join>
    </class>
</hibernate-mapping>


According to the requirement i mentioned above, the following code:
Code:
Budget budget = budgetDao.findById(4L);
budget.getSecurityGroup().setName("the new name");
budgetDao.update(budget);

shouldn't issue "UPDATE SECURITY_GROUP" sql statement. But it does :-(

How can i make that securityGroup wouldn't became updated while saving Budget entity?


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.