-->
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: hibernate many-to-one referential-integrity save and update
PostPosted: Thu Sep 03, 2015 4:02 am 
Newbie

Joined: Thu Sep 03, 2015 3:13 am
Posts: 1
Hi

i am Stuck In Mapping with hibernate many-to-one referential-integrity when operation performed save and update

I got exception Could not commit JPA transaction nested exception is javax.persistence.RollbackException
<composite-id name="id" class="com.org.entities.OrgOrderLineCommentRouteId">
<key-property name="orderKey" type="long">
<column name="ORDER_KEY" precision="12" scale="0" />
</key-property>
<key-property name="orderLineKey" type="long">
<column name="ORDER_LINE_KEY" precision="12" scale="0" />
</key-property>
<key-property name="orderLineCommentKey" type="long">
<column name="ORDER_LINE_COMMENT_KEY" precision="12" scale="0" />
</key-property>
<key-property name="commentTypeKey" type="byte">
<column name="COMMENT_TYPE_KEY" precision="2" scale="0" />
</key-property>
<key-property name="divisionKey" type="short">
<column name="DIVISION_KEY" precision="4" scale="0" />
</key-property>

</composite-id>
<many-to-one name="orgUserByUserKeyUpdated" class="com.org.entities.OrgUser" update="false" insert="false" fetch="select">
<column name="USER_KEY_UPDATED" precision="10" scale="0" not-null="true" />
<column name="DIVISION_KEY" precision="4" scale="0" not-null="true" />
</many-to-one>



In this mapping when i remove the
update="false" insert="false" from
orgUserByUserKeyUpdated then it says division_key must be declare
update="false" insert="false" and when i remove
DIVISION_KEY it says foriegnkey and primakey must match.
because OrgUser has following structure.

<class name="com.org.entities.OrgUser" table="ORG_USER">
<composite-id name="id" class="com.org.entities.OrgUserId">
<key-property name="userKey" type="java.lang.Long">
<column name="USER_KEY" precision="10" scale="0" />
</key-property>
<key-property name="divisionKey" type="java.lang.Short">
<column name="DIVISION_KEY" precision="4" scale="0" />
</key-property>
</composite-id>



i am stuck any one have idea how to resolve.


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.