-->
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: org.springframework.orm.hibernate3.HibernateSystemException
PostPosted: Sat Dec 11, 2010 12:08 am 
Newbie

Joined: Fri Dec 10, 2010 11:41 pm
Posts: 1
Hi Friends,
I am using Hibernate3 with Spring.
I am using one Bean class name : Samle.(With Annotations)
Inside that i am tryingn to map SOAP Recomendation is one bean using ManyToOne(FetchType.Lazy) like below..

@Entity
@Table(name="SOAP_SAMPLE")
@SequenceGenerator(name="SEQ_STORE",sequenceName="SOAP_SAMPLE_SEQ",allocationSize=1)
public class Sample implements Serializable{

/**
*
*/
private static final long serialVersionUID = -2103129994964857010L;

private Long sampleId;

private Date labDate;

private Date receivedDate;

private Long sampleNumber;

private Long oilAdded;

private Long msp;

private Long cycles;

private Long resampleHrs;

private Double filterWeight;

private Long filterHrs;

private String tsn;

private String tso;

private boolean conformingContainer;

private Date sampleDate;

private Long oilHrs;

private boolean unknownSample;

private Organization labOrganization;

private OilCode oilCode;

private Equipment equipment;

private String vehicleType;

private String vehicleSerialNumber;

private User responsibleEmployee;

private String maintenancePerformed;

private SOAPProcessStage processStage;

private SOAPRecommendation recommendation;

private String labComment;

private String internalComment;

private Date currentProcessStageEntryTime;

private SoapContact soapContact;

private User processStageUser;

private SoapContact sendKitToContact;

private String recommendationGivenUserName;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "SEND_KIT_TO")
public SoapContact getSendKitToContact() {
return sendKitToContact;
}

public void setSendKitToContact(SoapContact sendKitToContact) {
this.sendKitToContact = sendKitToContact;
}

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PRCS_STG_OWNR_USER_ID")
public User getProcessStageUser() {
return processStageUser;
}

public void setProcessStageUser(User processStageUser) {
this.processStageUser = processStageUser;
}

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="CONTACT_ID")
public SoapContact getSoapContact() {
return soapContact;
}

public void setSoapContact(SoapContact soapContact) {
this.soapContact = soapContact;
}

@Column(name="CURR_PRCS_STG_ENTRY_TM")
public Date getCurrentProcessStageEntryTime() {
return currentProcessStageEntryTime;
}

public void setCurrentProcessStageEntryTime(Date currentProcessStageEntryTime) {
this.currentProcessStageEntryTime = currentProcessStageEntryTime;
}


@Column(name="INTERNAL_COMMENT")
public String getInternalComment() {
return internalComment;
}

public void setInternalComment(String internalComment) {
this.internalComment = internalComment;
}

@Column(name="LAB_COMMENT")
public String getLabComment() {
return labComment;
}

public void setLabComment(String labComment) {
this.labComment = labComment;
}

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="SAMPLE_RCMD_CD")
public SOAPRecommendation getRecommendation() {
return recommendation;
}

public void setRecommendation(SOAPRecommendation recommendation) {
this.recommendation = recommendation;
}

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="PRCS_STAGE_ID")
public SOAPProcessStage getProcessStage() {
return processStage;
}

public void setProcessStage(SOAPProcessStage processStage) {
this.processStage = processStage;
}

@Column(name="MNTC_PRFM")
public String getMaintenancePerformed() {
return maintenancePerformed;
}

public void setMaintenancePerformed(String maintenancePerformed) {
this.maintenancePerformed = maintenancePerformed;
}

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="ANALYST_USER_ID")
public User getResponsibleEmployee() {
return responsibleEmployee;
}

public void setResponsibleEmployee(User responsibleEmployee) {
this.responsibleEmployee = responsibleEmployee;
}
@ManyToOne(targetEntity = EquipmentBean.class,fetch = FetchType.LAZY)
@JoinColumn(name="EQUIPMENT_ID")
public Equipment getEquipment() {
return equipment;
}

public void setEquipment(Equipment equipment) {
this.equipment = equipment;
}
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="LAB_ORG_ID")
public Organization getLabOrganization() {
return labOrganization;
}

public void setLabOrganization(Organization labOrganization) {
this.labOrganization = labOrganization;
}

@Column(name="LAB_DT")
public Date getLabDate() {
return labDate;
}

public void setLabDate(Date labDate) {
this.labDate = labDate;
}

@Column(name="VEHICLE_SERIAL_NUM")
public String getVehicleSerialNumber() {
return vehicleSerialNumber;
}

public void setVehicleSerialNumber(String vehicleSerialNumber) {
this.vehicleSerialNumber = vehicleSerialNumber;
}

@Column(name="SAMPLE_VEHICLE_TYPE")
public String getVehicleType() {
return vehicleType;
}

public void setVehicleType(String vehicleType) {
this.vehicleType = vehicleType;
}

@Column(name="SAMPLE_RCV_DT")
public Date getReceivedDate() {
return receivedDate;
}

public void setReceivedDate(Date receivedDate) {
this.receivedDate = receivedDate;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="OIL_CD")
public OilCode getOilCode() {
return oilCode;
}

public void setOilCode(OilCode oilCode) {
this.oilCode = oilCode;
}

@Column(name="SAMPLE_DT")
public Date getSampleDate() {
return sampleDate;
}

public void setSampleDate(Date sampleDate) {
this.sampleDate = sampleDate;
}

@Column(name="OIL_HOURS")
public Long getOilHrs() {
return oilHrs;
}

public void setOilHrs(Long oilHrs) {
this.oilHrs = oilHrs;
}
@Column(name="UNKNOWN_SAMPLE_DT_IND")
@Type(type="yes_no")
public boolean isUnknownSample() {
return unknownSample;
}

public void setUnknownSample(boolean unknownSample) {
this.unknownSample = unknownSample;
}
@Column(name="SAMPLE_NUM")
public Long getSampleNumber() {
return sampleNumber;
}

public void setSampleNumber(Long sampleNumber) {
this.sampleNumber = sampleNumber;
}

@Column(name="OIL_ADDED")
public Long getOilAdded() {
return oilAdded;
}

public void setOilAdded(Long oilAdded) {
this.oilAdded = oilAdded;
}

@Column(name="FILTER_HOURS")
public Long getFilterHrs() {
return filterHrs;
}

public void setFilterHrs(Long filterHrs) {
this.filterHrs = filterHrs;
}
@Column(name="TSN")
public String getTsn() {
return tsn;
}

public void setTsn(String tsn) {
this.tsn = tsn;
}
@Column(name="TSO")
public String getTso() {
return tso;
}

public void setTso(String tso) {
this.tso = tso;
}

@Column(name="CONTAN_CNFRM")
@Type(type="yes_no")
public boolean isConformingContainer() {
return conformingContainer;
}

public void setConformingContainer(boolean conformingContainer) {
this.conformingContainer = conformingContainer;
}

@Column(name="CYCLES")
public Long getCycles() {
return cycles;
}

public void setCycles(Long cycles) {
this.cycles = cycles;
}

@Column(name="MSP")
public Long getMsp() {
return msp;
}

public void setMsp(Long msp) {
this.msp = msp;
}
@Id
@Column(name="SAMPLE_ID")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="SEQ_STORE")
public Long getSampleId() {
return sampleId;
}

public void setSampleId(Long sampleId) {
this.sampleId = sampleId;
}

@Column(name="FILTER_WEIGHT")
public Double getFilterWeight() {
return filterWeight;
}

public void setFilterWeight(Double filterWeight) {
this.filterWeight = filterWeight;
}

@Column(name="RESAMPLE_HOURS")
public Long getResampleHrs() {
return resampleHrs;
}

public void setResampleHrs(Long resampleHrs) {
this.resampleHrs = resampleHrs;
}


/**
* @return Returns the createdByUserId.
*/
@Column(name = "CREATED_BY_USER_ID", nullable = false, updatable = false)
public String getCreatedByUserId() {
return super.getCreatedByUserId();
}

/**
* @return Returns the createdOnDate.
*/
@Column(name = "CREATED_ON_DT", nullable = false, updatable = false)
public Date getCreatedOnDate() {
return super.getCreatedOnDate();
}

/**
* @return Returns the updatedByUserId.
*/
@Column(name = "UPDATED_BY_USER_ID", nullable = false)
public String getUpdatedByUserId() {
return super.getUpdatedByUserId();
}

/**
* @return Returns the updatedOnDate.
*/
@Column(name = "UPDATED_ON_DT", nullable = false)
public Date getUpdatedOnDate() {
return super.getUpdatedOnDate();
}

/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString()
{
return "Sample Number : "+this.getSampleNumber()+" ,Lab code : "+this.getLabOrganization().getLabCode()
+" Sample Date : "+this.getSampleDate()+" Received Date :"+this.getReceivedDate()+
" Equipment : "+this.getEquipment().getEquipSerialNum()+" Equipment Hierarchy : "+this.getEquipment().getEquipmentHierarchy().getHierarchyName();
}

/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode()
{
return this.getSampleNumber().intValue() * Long.valueOf(this.getLabOrganization().getOrgId()).intValue()
* Long.valueOf(this.getReceivedDate().getTime()).intValue();
}

/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object object)
{
if(object instanceof Sample)
{
Sample sample = (Sample)object;
if(sample.getSampleId().equals(this.getSampleId()) && sample.getSampleNumber().equals(this.getSampleNumber()) && sample.getSampleDate().equals(this.getSampleDate())
&& sample.getLabOrganization().getLabCode().equals(this.getLabOrganization().getLabCode()) &&
sample.getReceivedDate().equals(this.receivedDate) && sample.getEquipment().equals(this.getEquipment()))
{
return true;
}else{
return false;
}
}else{
return false;
}
}

}


ChildBean : SOAP Recommendation is:

@Entity
@Table(name = "SOAP_ANLYSS_RCMD")
public class SOAPRecommendation implements Serializable{
/**
*
*/
private static final long serialVersionUID = -3621069472867178095L;

private String code;

private String description;

@Id
@Column(name="RCMD_CD")
public String getCode() {
return code;
}

public void setCode(String code) {
this.code = code;
}

@Column(name="RCMD_DESC")
public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

/**
* @return Returns the createdByUserId.
*/
@Column(name = "CREATED_BY_USER_ID", nullable = false, updatable = false)
public String getCreatedByUserId() {
return super.getCreatedByUserId();
}

/**
* @return Returns the createdOnDate.
*/
@Column(name = "CREATED_ON_DT", nullable = false, updatable = false)
public Date getCreatedOnDate() {
return super.getCreatedOnDate();
}

/**
* @return Returns the updatedByUserId.
*/
@Column(name = "UPDATED_BY_USER_ID", nullable = false)
public String getUpdatedByUserId() {
return super.getUpdatedByUserId();
}

/**
* @return Returns the updatedOnDate.
*/
@Column(name = "UPDATED_ON_DT", nullable = false)
public Date getUpdatedOnDate() {
return super.getUpdatedOnDate();
}

public SOAPRecommendation()
{

}

public SOAPRecommendation(SOAPAnalysisRecommendationEnum recommendationEnum)
{
this.code = recommendationEnum.getRecommendationCode();
}

/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString()
{
return "Recommendation Code : "+this.getCode()+" Description : "+this.getDescription();
}

/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode()
{
return this.getCode().length() * this.getDescription().length();
}

/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object object)
{
if(object instanceof SOAPRecommendation)
{
SOAPRecommendation recommendation = (SOAPRecommendation)object;
if(recommendation.getCode().equals(this.getCode()) && recommendation.getDescription().equals(this.getDescription()))
{
return false;
}else{
return false;
}
}else{
return false;
}
}
}


From DAO Class I am trying save Sample Object with changed recomendation from UI using ..getHibernateTemplate().update(sample) and i tried getHibernateTemplate().saveOrUpdate(sample).

But it is giving error like:

[12/11/10 9:33:11:342 IST] 00000033 SystemOut O <ZingErrorRecord><fqcn>com.honeywell.zing.web.base.ZingExceptionResolver</fqcn><methodName>resolveException</methodName><code>ZING-SAMPLE-401</code><message><![CDATA[Runtime Exception]]></message><stackTrace><![CDATA[com.honeywell.zing.web.base.exception.ZingRuntimeException: ZING-SAMPLE-401
at com.honeywell.zing.web.sample.dao.SampleDAOImpl.updateSample(SampleDAOImpl.java:279)
at com.honeywell.zing.web.telemetry.soap.soapdetails.manager.SoapDetailsManagerImpl.updateSample(SoapDetailsManagerImpl.java:628)
at com.honeywell.zing.web.telemetry.soap.soapdetails.manager.SoapDetailsManagerImpl.saveOrUpdateResults(SoapDetailsManagerImpl.java:604)
at com.honeywell.zing.web.telemetry.soap.soapdetails.controller.SoapResultsController.onSubmit(SoapResultsController.java:134)
at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:267)
at com.honeywell.zing.web.base.ZingFormController.processFormSubmission(ZingFormController.java:408)
at com.honeywell.zing.web.base.ZingFormController.handlePOSTFlow(ZingFormController.java:251)
at com.honeywell.zing.web.base.ZingFormController.handleRequestInternal(ZingFormController.java:169)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:989)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:930)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:39)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)
at com.honeywell.zing.web.base.LocaleFilter.doFilterInternal(LocaleFilter.java:73)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
at com.honeywell.zing.web.filter.HTTPContentValidationFilter.doFilterInternal(HTTPContentValidationFilter.java:56)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
at com.honeywell.zing.web.filter.EncodingFilter.doFilterInternal(EncodingFilter.java:45)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:761)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:673)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:498)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:464)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:111)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:383)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
Caused by: org.springframework.orm.hibernate3.HibernateSystemException: identifier of an instance of com.honeywell.zing.base.sample.SOAPRecommendation was altered from R to N; nested exception is org.hibernate.HibernateException: identifier of an instance of com.honeywell.zing.base.sample.SOAPRecommendation was altered from R to N
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:676)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:890)
at com.honeywell.zing.web.sample.dao.SampleDAOImpl.updateSample(SampleDAOImpl.java:275)
... 56 more
Caused by: org.hibernate.HibernateException: identifier of an instance of com.honeywell.zing.base.sample.SOAPRecommendation was altered from R to N
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:58)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:157)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:113)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.springframework.orm.hibernate3.HibernateTemplate$28.doInHibernate(HibernateTemplate.java:892)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
... 59 more
]]></stackTrace><timestamp>12/11/2010 09:33:11</timestamp><threadName>WebContainer : 2</threadName><hostName>IE11LT3B1L5BS</hostName></ZingErrorRecord>
[12/11/10 9:33:11:342 IST]


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.