Hi,
I am getting a net.sf.hibernate.PropertyValueException when trying to insert a record into a table. Please help. Given below are the necessary details.
Thanks in advance.
Hibernate version: 2.0
Contents of .hbm.xml file
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.1
http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->
<class
name="sg.gov.ciris.entity.MtUuidLink"
table="MT_UUID_LINK"
>
<id
name="linkedUuid"
type="java.lang.Long"
column="LINKED_UUID"
>
<generator class="assigned" />
</id>
<property
name="activeUuid"
type="java.lang.Long"
column="ACTIVE_UUID"
not-null="true"
length="14"
/>
<property
name="activeId"
type="java.lang.String"
column="ACTIVE_ID"
not-null="true"
length="9"
/>
<property
name="linkedId"
type="java.lang.String"
column="LINKED_ID"
not-null="true"
length="9"
/>
<property
name="deptCd"
type="java.lang.String"
column="DEPT_CD"
length="7"
/>
<property
name="linkedTy"
type="java.lang.String"
column="LINKED_TY"
not-null="true"
length="1"
/>
<property
name="createBy"
type="java.lang.String"
column="CREATE_BY"
insert="true"
update="false"
not-null="true"
length="9"
/>
<property
name="createDt"
type="java.sql.Timestamp"
column="CREATE_DT"
not-null="true"
length="7"
/>
<property
name="updBy"
type="java.lang.String"
column="UPD_BY"
insert="true"
update="true"
not-null="true"
length="9"
/>
<property
name="lastTimestp"
type="java.sql.Timestamp"
column="LAST_TIMESTP"
not-null="true"
length="11"
/>
<!-- Associations -->
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
try {
this.getSession().save(entity);
this.getSession().flush();
}
catch (HibernateException e) {
e.printStackTrace();
logger.error(e);
throw new DaoException(e.getMessage());
} catch (Exception e) {
e.printStackTrace();
// throw new DaoException(e.getMessage());
}
Stack trace of exception that occurs:
net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: sg.gov.ciris.entity.MtUuidLink.linkedId
at net.sf.hibernate.impl.SessionImpl.checkNullability(SessionImpl.java:1287)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:939)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:868)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:790)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:749)
at sg.gov.ciris.dao.MtUuidLinkDao.createUuidLinkRecord(MtUuidLinkDao.java:428)
at sg.gov.ciris.idm.MtMgrBean.createUuidLinkRecord(MtMgrBean.java:2862)
at sg.gov.ciris.idm.MtMgr_lpphm8_ELOImpl.createUuidLinkRecord(MtMgr_lpphm8_ELOImpl.java:219)
at sg.gov.ciris.idm.delegate.MtDelegate.createUuidLinkRecord(MtDelegate.java:1320)
at idm.linkFin.LinkFinController.processLinkFin(LinkFinController.jpf:230)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.bea.wlw.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:1507)
at com.bea.wlw.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:1433)
at com.bea.wlw.netui.pageflow.FlowController.internalExecute(FlowController.java:764)
at com.bea.wlw.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:211)
at com.bea.wlw.netui.pageflow.FlowController.execute(FlowController.java:594)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:650)
at com.bea.wlw.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:527)
at com.bea.wlw.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:152)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6722)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Database being used:
Oracle