-->
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: Issue updating records with attachments using merge()
PostPosted: Tue Jan 11, 2011 7:45 pm 
Newbie

Joined: Fri Nov 07, 2008 12:00 pm
Posts: 3
Issue updating records with attachments using merge() as the cascade level as orphan deletes.

This issue tested with Spring 3.0.0 and Hibernate 3.5.5-Final and ojdbc5 also. We are still facing the same issue.

Exception occured while saving xxx 4863
org.springframework.dao.DataIntegrityViolationException: not-null property references a null or transient value: com.xxx.xxx.service.xxx.dto.XxxAttachmentDTO.attachmentData; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: com.xxx.xxx.service.xxx.dto.XxxAttachmentDTO.attachmentData
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:648)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.merge(HibernateTemplate.java:813)
at com.xxx.xxx.service.xxx.dao.XxxDAOImpl.update(XxxDAOImpl.java:207)
at com.xxx.xxx.service.xxx.dao.XxxDAOImpl$$FastClassByCGLIB$$7771e46c.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:77)
at com.xxx.xxx.service.common.aspect.around.ResponseTimeProfilerAspect.profileResponseTime(ResponseTimeProfilerAspect.java:39)


<hibernate-mapping>
<class name="......OrderLineDTO"
table="ORDER_LINES" dynamic-update="true">
<id name="lineId" type="long" column="LINE_ID" length="15">
<generator class="sequence">
<param name="sequence">xyz</param>
</generator>
</id>
..................................
..................................
..................
<property name="installationDetailClob" type="clob" column="ORDER_LINE_ATTRIBUTES_MAP"
not-null="false" lazy="true" />
<property name="attathmentMetadataClob" type="clob" column="ORDER_ATTACHMENT_METADATA"
not-null="false" lazy="true"/>

<!-- Associations -->
<!-- bi-directional many-to-one association to OrderHeader -->

<many-to-one name="orderHeader"
class="......"
fetch="select">
<column name="HEADER_ID" not-null="true" length="15" />
</many-to-one>

<!--
bi-directional many-to-one association to SmartHand
-->
<set name="smartHands" inverse="true" lazy="false"
cascade="all,delete-orphan">
<key>
<column name="LINE_ID" /><!-- a foreign key in SMART_HANDS referencing the primary key of this table.
-->
</key>
<one-to-many
class="...................SmartHandDTO" />
</set>
</class>
</hibernate-mapping>

DAO Code snippet:

public void update(OrderHeaderDTO orderHeaderDTO)
throws DataAccessException { getOrdersHibernateTemplate().merge(orderHeaderDTO); }


Steps to create the issue:

1. Create a table with clob column and have some other columns. Have one column with timestamp.
2. Insert a record in to it.
3. Now create detached object with new operator and populate all the information programatically including pk. Populate clob column and timestamp with different data than already persisted data.
3. Now do merg operation on this object, we find only timestamp column is part of update query but not clob column.


Top
 Profile  
 
 Post subject: Re: Issue updating records with attachments using merge()
PostPosted: Wed Jan 12, 2011 6:49 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

[list=]
[*] This is the wrong forum. Your question should go the Hibernate User forum
[*] You really should post the code for your entities as well and especially the code in between opening and closing the session
[*] If you think there is a bug I recommend you create a testcase and attach it to a Jira issue. Creating the testcase might also help you to narrow down the problem
[/list]


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.