net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey

Atlassian JIRA | Nick Faiz [OLD] | 1 decade ago
  1. 0

    org.springframework.orm.hibernate.HibernateSystemException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey; nested exception is net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey at net.sf.hibernate.impl.SessionImpl.checkNullability(SessionImpl.java:1277) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:928) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1388) at org.springframework.orm.hibernate.HibernateTemplate$13.doInHibernate(HibernateTemplate.java:344) at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:200) at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:341) at bucket.core.persistence.hibernate.HibernateObjectDao.saveRaw(HibernateObjectDao.java:151) at bucket.core.persistence.hibernate.HibernateObjectDao.save(HibernateObjectDao.java:121) at com.atlassian.confluence.links.DefaultLinkManager.saveLink(DefaultLinkManager.java:60) at com.atlassian.confluence.links.DefaultLinkManager.updateOutgoingLinks(DefaultLinkManager.java:171) 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)

    Atlassian JIRA | 1 decade ago | Nick Faiz [OLD]
    net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey
  2. 0

    org.springframework.orm.hibernate.HibernateSystemException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey; nested exception is net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey at net.sf.hibernate.impl.SessionImpl.checkNullability(SessionImpl.java:1277) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:928) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1388) at org.springframework.orm.hibernate.HibernateTemplate$13.doInHibernate(HibernateTemplate.java:344) at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:200) at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:341) at bucket.core.persistence.hibernate.HibernateObjectDao.saveRaw(HibernateObjectDao.java:151) at bucket.core.persistence.hibernate.HibernateObjectDao.save(HibernateObjectDao.java:121) at com.atlassian.confluence.links.DefaultLinkManager.saveLink(DefaultLinkManager.java:60) at com.atlassian.confluence.links.DefaultLinkManager.updateOutgoingLinks(DefaultLinkManager.java:171) 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)

    Atlassian JIRA | 1 decade ago | Nick Faiz [OLD]
    net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey
  3. 0

    I get an error when I import my snipsnap database. The error is as follows: CONFLUENCE System Error A system error has occurred. If this problem persists - please notify your Confluence administrator of this problem. If you experience problems getting to this support page, please send an email to confluence-support@atlassian.com with the following information: a description of your problem cut & paste the error and system information found below attach the application server log file Cause: org.springframework.orm.hibernate.HibernateSystemException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey; nested exception is: net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey Stack Trace: [hide] org.springframework.orm.hibernate.HibernateSystemException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey; nested exception is: net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey at net.sf.hibernate.impl.SessionImpl.checkNullability(SessionImpl.java:1220) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:882) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:819) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:742) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:719) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1331) at org.springframework.orm.hibernate.HibernateTemplate$8.doInHibernate(HibernateTemplate.java:312) at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:147) at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:310) at com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao.save(HibernateObjectDao.java:148) at com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao.save(HibernateObjectDao.java:94) at com.atlassian.confluence.links.DefaultLinkManager.saveLink(DefaultLinkManager.java:46) at com.atlassian.confluence.links.DefaultLinkManager.updateOutgoingLinks(DefaultLinkManager.java:190) at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:59) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:201) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at com.atlassian.confluence.util.profiling.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:17) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:196) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:135) at $Proxy0.updateOutgoingLinks(Unknown Source) at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:59) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:125) at $Proxy1.updateOutgoingLinks(Unknown Source) at com.atlassian.confluence.core.DefaultContentEntityManager.saveContentEntity(DefaultContentEntityManager.java:41) 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 org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:59) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:201) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:153) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:196) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:135) at $Proxy2.saveContentEntity(Unknown Source) at com.atlassian.confluence.user.DefaultUserAccessor.savePersonalInformation(DefaultUserAccessor.java:246) 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 org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:59) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:201) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at com.atlassian.confluence.util.profiling.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:17) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:196) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:135) at $Proxy5.savePersonalInformation(Unknown Source) 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 org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:59) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:201) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:153) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:196) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:135) at $Proxy6.savePersonalInformation(Unknown Source) at com.atlassian.confluence.importexport.impl.snipsnap.SnipSnapImporter.importUserDescription(SnipSnapImporter.java:266) at com.atlassian.confluence.importexport.impl.snipsnap.SnipSnapImporter.importSnips(SnipSnapImporter.java:225) at com.atlassian.confluence.importexport.impl.snipsnap.SnipSnapImporter.importAll(SnipSnapImporter.java:136) at com.atlassian.confluence.importexport.impl.snipsnap.SnipSnapImporter.doImport(SnipSnapImporter.java:99) at com.atlassian.confluence.importexport.DefaultImportExportManager.importAs(DefaultImportExportManager.java:40) 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 org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:59) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:201) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:153) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:196) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:135) at $Proxy21.importAs(Unknown Source) at com.atlassian.confluence.importexport.actions.ImportSnipSnapAction.doRestore(ImportSnipSnapAction.java:25) at com.atlassian.confluence.importexport.actions.AbstractImportAction.execute(AbstractImportAction.java:44) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:173) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor.intercept(DefaultWorkflowInterceptor.java:58) at com.atlassian.confluence.core.ConfluenceWorkflowInterceptor.intercept(ConfluenceWorkflowInterceptor.java:32) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.atlassian.confluence.core.ConfluenceValidationInterceptor.intercept(ConfluenceValidationInterceptor.java:18) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.atlassian.confluence.security.actions.PermissionCheckInterceptor.intercept(PermissionCheckInterceptor.java:40) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:116) at com.opensymphony.webwork.dispatcher.ServletDispatcher.serviceAction(ServletDispatcher.java:182) at com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:162) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:129) at com.atlassian.confluence.util.profiling.ProfilingPageFilter.parsePage(ProfilingPageFilter.java:36) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:61) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:161) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at com.atlassian.seraph.filter.LoginFilter.doFilter(LoginFilter.java:181) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at com.atlassian.johnson.filters.JohnsonFilter.doFilter(JohnsonFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:83) at com.atlassian.confluence.setup.SpringSessionInViewFilter.doFilterInternal(SpringSessionInViewFilter.java:32) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:39) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at com.atlassian.util.profiling.filters.ProfilingFilter.doFilter(ProfilingFilter.java:132) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at com.atlassian.core.filters.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:38) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619) at java.lang.Thread.run(Thread.java:536) Referer URL: http://localhost:8181/admin/snipsnapimport-start.action System Information: System Date: Monday, 09 Feb 2004 System Time: 09:57:00 Java Version: 1.4.1_03 Java Vendor: Sun Microsystems Inc. JVM Version: 1.0 JVM Vendor: Sun Microsystems Inc. JVM Implementation Version: 1.4.1_03-b02 Java Runtime: Java(TM) 2 Runtime Environment, Standard Edition Java VM: Java HotSpot(TM) Client VM User Name: ncampbel User Timezone: GMT-05:00 Operating System: Windows XP 5.1 OS Architecture: x86 Total Memory: 127 MB Free Memory: 84 MB Used Memory: 43 MB Uptime: 4 minutes, 35 seconds Version: 1.0rc1 Build Number: 36

    Atlassian JIRA | 1 decade ago | Noah Campbell
    net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Consider this object model ob 3 classes: A Flow has a collection of Vertexes, and the Vertexes are connected by Edges, i.e. each Edge has a source and a sink Vertex, while a Vertex has a collection of source and sink Edges. When I create a simple graph consisting of one Flow, two Vertexes and one Edge between them and call Session.saveOrUpdate(), I get the following exception. With the debugger I found out that the source vertex and the edge had been assigned primary keys while the sink vertex still had the unsaved value of -1. The source code is below the exception. net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: detached.Edge.sourceVertex at net.sf.hibernate.impl.SessionImpl.checkNullability(SessionImpl.java:1211) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:873) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:817) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:740) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:717) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1322) at detached.Test.testDetachedObjects(Test.java:35) at detached.Test.main(Test.java:17) package detached; import junit.framework.TestCase; import net.sf.hibernate.HibernateException; import net.sf.hibernate.Session; import net.sf.hibernate.SessionFactory; import net.sf.hibernate.cfg.Configuration; public class Test extends TestCase { public static void main( String[] args ) throws HibernateException { (new Test()).testDetachedObjects(); }//main() public void testDetachedObjects() throws HibernateException { Configuration configuration = new Configuration(); configuration.addClass( Flow.class ); configuration.addClass( Vertex.class ); configuration.addClass( Edge.class ); SessionFactory sessionFactory = configuration.buildSessionFactory(); Session session = sessionFactory.openSession(); Flow flow = new Flow(); Vertex source = new Vertex(); flow.addVertex( source ); Vertex sink = new Vertex(); flow.addVertex( sink ); Edge edge = new Edge(); source.addSourceEdge( edge ); sink.addSinkEdge( edge ); session.saveOrUpdate( edge ); session.flush(); }//testDetachedObjects() }//Test package detached; import java.io.Serializable; public abstract class DomainObject implements Serializable { public static String id( DomainObject domainObject ) { return domainObject == null ? "null" : String.valueOf( domainObject.getId() ); }//id() public static final long UNSAVED_VALUE = -1; public DomainObject() { _id = UNSAVED_VALUE; }//DomainObject() public String toString() { int index = getClass().getName().lastIndexOf('.') + 1; return getClass().getName().substring( index ) + ": id=" + _id; }//toString() public boolean equals( Object object ) { if( object == null ) return false; if( object == this ) return true; if( ! object.getClass().equals( getClass() ) ) return false; // Cannot compare new objects when their primary key hasn't been assigned yet. if( ((DomainObject) object).getId() == UNSAVED_VALUE || getId() == UNSAVED_VALUE ) return false; if( ((DomainObject) object).getId() == getId() ) return true; return false; }//equals() public int hashCode() { return hashKey().hashCode(); }//hashCode() public String hashKey() { return getClass().getName() + getId(); }//hashCode() protected long _id; public long getId() { return _id; }//getId() protected void setId( long id ) { _id = id; }//setId() }//DomainObject package detached; import java.util.HashSet; import java.util.Set; /** * @hibernate.class table="FLOW" */ public class Flow extends DomainObject { public Flow() { _vertices = new HashSet(); }//Flow() public String toString() { return super.toString() + " vertices=" + _vertices.size(); }//toString() /** * This method is only needed for the Hibernate mapping. * @hibernate.id column="FLOW_ID" type="long" generator-class="native" unsaved-value="-1" */ public long getId() { return super.getId(); }//getId() private Set _vertices; /** * @hibernate.set role="vertices" cascade="all-delete-orphan" lazy="false" inverse="true" * @hibernate.collection-key column="FLOW_ID" * @hibernate.collection-one-to-many class="detached.Vertex" */ public Set getVertices() { return _vertices; }//getVertices() public void setVertices( Set vertices ) { assert vertices != null : "vertices != null"; _vertices = vertices; }//setVertices() public void addVertex( Vertex vertex ) { assert vertex != null : "vertex != null"; assert ! _vertices.contains( vertex ) : "! _vertices.contains( vertex )"; _vertices.add( vertex ); vertex.setFlow( this ); }//addVertex() public void removeVertex( Vertex vertex ) { assert vertex != null : "vertex != null"; assert _vertices.contains( vertex ) : "_vertices.contains( vertex )"; boolean removed = _vertices.remove( vertex ); assert removed : "_vertices.remove( vertex )"; }//addVertex() }//Flow package detached; import java.util.HashSet; import java.util.Set; /** * @hibernate.class table="FLOW_VERTEX" */ public class Vertex extends DomainObject { public Vertex() { _sourceEdges = new HashSet(); _sinkEdges = new HashSet(); }//Vertex public String toString() { return super.toString() + " flow=" + id( _flow ); }//toString() /** * This method is only needed for the Hibernate mapping. * @hibernate.id column="VERTEX_ID" type="long" generator-class="native" unsaved-value="-1" */ public long getId() { return super.getId(); }//getId() private Flow _flow; /** * @hibernate.many-to-one column="FLOW_ID" not-null="true" class="detached.Flow" */ public Flow getFlow() { return _flow; }//getFlow() public void setFlow( Flow flow ) { assert flow != null : "flow != null"; _flow = flow; }//setFlow() private Set _sourceEdges; /** * @hibernate.set role="sourceEdges" cascade="all-delete-orphan" lazy="false" inverse="true" * @hibernate.collection-key column="SOURCE_VERTEX_ID" * @hibernate.collection-one-to-many class="detached.Edge" */ public Set getSourceEdges() { return _sourceEdges; }//getSourceEdges() public void setSourceEdges( Set edges ) { assert edges != null : "edges != null"; _sourceEdges = edges; }//setSourceEdges() public void addSourceEdge( Edge edge ) { assert edge != null : "edge != null"; assert ! _sourceEdges.contains( edge ) : "! _sourceEdges.contains( edge )"; _sourceEdges.add( edge ); edge.setSourceVertex( this ); }//addSourceEdge() public void removeSourceEdge( Edge edge ) { assert edge != null : "edge != null"; assert _sourceEdges.contains( edge ) : "_sourceEdges.contains( edge )"; _sourceEdges.remove( edge ); }//addSourceEdge() public boolean isSourceEdge( Edge edge ) { return _sourceEdges.contains( edge ); }//isSourceEdge() private Set _sinkEdges; /** * @hibernate.set role="sinkEdge" cascade="all-delete-orphan" lazy="false" inverse="true" * @hibernate.collection-key column="SINK_VERTEX_ID" * @hibernate.collection-one-to-many class="detached.Edge" */ public Set getSinkEdges() { return _sinkEdges; }//getSinkEdges() public void setSinkEdges( Set edges ) { assert edges != null : "edges != null"; _sinkEdges = edges; }//setSinkEdges() public void addSinkEdge( Edge edge ) { assert edge != null : "edge != null"; assert ! _sinkEdges.contains( edge ) : "! _sinkEdge.contains( edge )"; _sinkEdges.add( edge ); edge.setSinkVertex( this ); }//addSinkEdge() public void removeSinkEdge( Edge edge ) { assert edge != null : "edge != null"; assert _sinkEdges.contains( edge ) : "_sinkEdge.contains( edge )"; _sinkEdges.remove( edge ); }//addSinkEdge() public boolean isSinkEdge( Edge edge ) { return _sinkEdges.contains( edge ); }//isSourceEdge() }//Vertex package detached; /** * @hibernate.class table="FLOW_EDGE" */ public class Edge extends DomainObject { public Edge() { }//Edge() public String toString() { return super.toString() + " sourceVertex=" + id( _sourceVertex ) + " sinkVertex=" + id( _sinkVertex ); }//toString() /** * This method is only needed for the Hibernate mapping. * @hibernate.id column="FLOW_EDGE_ID" type="long" generator-class="native" unsaved-value="-1" */ public long getId() { return super.getId(); }//getId() private Vertex _sourceVertex; /** * @hibernate.many-to-one column="SOURCE_VERTEX_ID" not-null="true" class="detached.Vertex" */ public Vertex getSourceVertex() { return _sourceVertex; }//getSourceVertex() public void setSourceVertex( Vertex vertex ) { assert vertex != null : "vertex != null"; _sourceVertex = vertex; }//setSourceVertex() private Vertex _sinkVertex; /** * @hibernate.many-to-one column="SINK_VERTEX_ID" not-null="true" class="detached.Vertex" */ public Vertex getSinkVertex() { return _sinkVertex; }//getSinkVertex() public void setSinkVertex( Vertex vertex ) { assert vertex != null : "vertex != null"; _sinkVertex = vertex; }//setSinkVertex() }//Edge

    Hibernate JIRA | 1 decade ago | Felix L J Mayer
    net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: detached.Edge.sourceVertex
  6. 0

    Consider this object model ob 3 classes: A Flow has a collection of Vertexes, and the Vertexes are connected by Edges, i.e. each Edge has a source and a sink Vertex, while a Vertex has a collection of source and sink Edges. When I create a simple graph consisting of one Flow, two Vertexes and one Edge between them and call Session.saveOrUpdate(), I get the following exception. With the debugger I found out that the source vertex and the edge had been assigned primary keys while the sink vertex still had the unsaved value of -1. The source code is below the exception. net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: detached.Edge.sourceVertex at net.sf.hibernate.impl.SessionImpl.checkNullability(SessionImpl.java:1211) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:873) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:817) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:740) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:717) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1322) at detached.Test.testDetachedObjects(Test.java:35) at detached.Test.main(Test.java:17) package detached; import junit.framework.TestCase; import net.sf.hibernate.HibernateException; import net.sf.hibernate.Session; import net.sf.hibernate.SessionFactory; import net.sf.hibernate.cfg.Configuration; public class Test extends TestCase { public static void main( String[] args ) throws HibernateException { (new Test()).testDetachedObjects(); }//main() public void testDetachedObjects() throws HibernateException { Configuration configuration = new Configuration(); configuration.addClass( Flow.class ); configuration.addClass( Vertex.class ); configuration.addClass( Edge.class ); SessionFactory sessionFactory = configuration.buildSessionFactory(); Session session = sessionFactory.openSession(); Flow flow = new Flow(); Vertex source = new Vertex(); flow.addVertex( source ); Vertex sink = new Vertex(); flow.addVertex( sink ); Edge edge = new Edge(); source.addSourceEdge( edge ); sink.addSinkEdge( edge ); session.saveOrUpdate( edge ); session.flush(); }//testDetachedObjects() }//Test package detached; import java.io.Serializable; public abstract class DomainObject implements Serializable { public static String id( DomainObject domainObject ) { return domainObject == null ? "null" : String.valueOf( domainObject.getId() ); }//id() public static final long UNSAVED_VALUE = -1; public DomainObject() { _id = UNSAVED_VALUE; }//DomainObject() public String toString() { int index = getClass().getName().lastIndexOf('.') + 1; return getClass().getName().substring( index ) + ": id=" + _id; }//toString() public boolean equals( Object object ) { if( object == null ) return false; if( object == this ) return true; if( ! object.getClass().equals( getClass() ) ) return false; // Cannot compare new objects when their primary key hasn't been assigned yet. if( ((DomainObject) object).getId() == UNSAVED_VALUE || getId() == UNSAVED_VALUE ) return false; if( ((DomainObject) object).getId() == getId() ) return true; return false; }//equals() public int hashCode() { return hashKey().hashCode(); }//hashCode() public String hashKey() { return getClass().getName() + getId(); }//hashCode() protected long _id; public long getId() { return _id; }//getId() protected void setId( long id ) { _id = id; }//setId() }//DomainObject package detached; import java.util.HashSet; import java.util.Set; /** * @hibernate.class table="FLOW" */ public class Flow extends DomainObject { public Flow() { _vertices = new HashSet(); }//Flow() public String toString() { return super.toString() + " vertices=" + _vertices.size(); }//toString() /** * This method is only needed for the Hibernate mapping. * @hibernate.id column="FLOW_ID" type="long" generator-class="native" unsaved-value="-1" */ public long getId() { return super.getId(); }//getId() private Set _vertices; /** * @hibernate.set role="vertices" cascade="all-delete-orphan" lazy="false" inverse="true" * @hibernate.collection-key column="FLOW_ID" * @hibernate.collection-one-to-many class="detached.Vertex" */ public Set getVertices() { return _vertices; }//getVertices() public void setVertices( Set vertices ) { assert vertices != null : "vertices != null"; _vertices = vertices; }//setVertices() public void addVertex( Vertex vertex ) { assert vertex != null : "vertex != null"; assert ! _vertices.contains( vertex ) : "! _vertices.contains( vertex )"; _vertices.add( vertex ); vertex.setFlow( this ); }//addVertex() public void removeVertex( Vertex vertex ) { assert vertex != null : "vertex != null"; assert _vertices.contains( vertex ) : "_vertices.contains( vertex )"; boolean removed = _vertices.remove( vertex ); assert removed : "_vertices.remove( vertex )"; }//addVertex() }//Flow package detached; import java.util.HashSet; import java.util.Set; /** * @hibernate.class table="FLOW_VERTEX" */ public class Vertex extends DomainObject { public Vertex() { _sourceEdges = new HashSet(); _sinkEdges = new HashSet(); }//Vertex public String toString() { return super.toString() + " flow=" + id( _flow ); }//toString() /** * This method is only needed for the Hibernate mapping. * @hibernate.id column="VERTEX_ID" type="long" generator-class="native" unsaved-value="-1" */ public long getId() { return super.getId(); }//getId() private Flow _flow; /** * @hibernate.many-to-one column="FLOW_ID" not-null="true" class="detached.Flow" */ public Flow getFlow() { return _flow; }//getFlow() public void setFlow( Flow flow ) { assert flow != null : "flow != null"; _flow = flow; }//setFlow() private Set _sourceEdges; /** * @hibernate.set role="sourceEdges" cascade="all-delete-orphan" lazy="false" inverse="true" * @hibernate.collection-key column="SOURCE_VERTEX_ID" * @hibernate.collection-one-to-many class="detached.Edge" */ public Set getSourceEdges() { return _sourceEdges; }//getSourceEdges() public void setSourceEdges( Set edges ) { assert edges != null : "edges != null"; _sourceEdges = edges; }//setSourceEdges() public void addSourceEdge( Edge edge ) { assert edge != null : "edge != null"; assert ! _sourceEdges.contains( edge ) : "! _sourceEdges.contains( edge )"; _sourceEdges.add( edge ); edge.setSourceVertex( this ); }//addSourceEdge() public void removeSourceEdge( Edge edge ) { assert edge != null : "edge != null"; assert _sourceEdges.contains( edge ) : "_sourceEdges.contains( edge )"; _sourceEdges.remove( edge ); }//addSourceEdge() public boolean isSourceEdge( Edge edge ) { return _sourceEdges.contains( edge ); }//isSourceEdge() private Set _sinkEdges; /** * @hibernate.set role="sinkEdge" cascade="all-delete-orphan" lazy="false" inverse="true" * @hibernate.collection-key column="SINK_VERTEX_ID" * @hibernate.collection-one-to-many class="detached.Edge" */ public Set getSinkEdges() { return _sinkEdges; }//getSinkEdges() public void setSinkEdges( Set edges ) { assert edges != null : "edges != null"; _sinkEdges = edges; }//setSinkEdges() public void addSinkEdge( Edge edge ) { assert edge != null : "edge != null"; assert ! _sinkEdges.contains( edge ) : "! _sinkEdge.contains( edge )"; _sinkEdges.add( edge ); edge.setSinkVertex( this ); }//addSinkEdge() public void removeSinkEdge( Edge edge ) { assert edge != null : "edge != null"; assert _sinkEdges.contains( edge ) : "_sinkEdge.contains( edge )"; _sinkEdges.remove( edge ); }//addSinkEdge() public boolean isSinkEdge( Edge edge ) { return _sinkEdges.contains( edge ); }//isSourceEdge() }//Vertex package detached; /** * @hibernate.class table="FLOW_EDGE" */ public class Edge extends DomainObject { public Edge() { }//Edge() public String toString() { return super.toString() + " sourceVertex=" + id( _sourceVertex ) + " sinkVertex=" + id( _sinkVertex ); }//toString() /** * This method is only needed for the Hibernate mapping. * @hibernate.id column="FLOW_EDGE_ID" type="long" generator-class="native" unsaved-value="-1" */ public long getId() { return super.getId(); }//getId() private Vertex _sourceVertex; /** * @hibernate.many-to-one column="SOURCE_VERTEX_ID" not-null="true" class="detached.Vertex" */ public Vertex getSourceVertex() { return _sourceVertex; }//getSourceVertex() public void setSourceVertex( Vertex vertex ) { assert vertex != null : "vertex != null"; _sourceVertex = vertex; }//setSourceVertex() private Vertex _sinkVertex; /** * @hibernate.many-to-one column="SINK_VERTEX_ID" not-null="true" class="detached.Vertex" */ public Vertex getSinkVertex() { return _sinkVertex; }//getSinkVertex() public void setSinkVertex( Vertex vertex ) { assert vertex != null : "vertex != null"; _sinkVertex = vertex; }//setSinkVertex() }//Edge

    Hibernate JIRA | 1 decade ago | Felix L J Mayer
    net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: detached.Edge.sourceVertex

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. net.sf.hibernate.PropertyValueException

      not-null property references a null or transient value: com.atlassian.confluence.links.OutgoingLink.destinationSpaceKey

      at net.sf.hibernate.impl.SessionImpl.checkNullability()
    2. net.sf.hibernate
      SessionImpl.saveOrUpdate
      1. net.sf.hibernate.impl.SessionImpl.checkNullability(SessionImpl.java:1277)
      2. net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:928)
      3. net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
      4. net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779)
      5. net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
      6. net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1388)
      6 frames
    3. Hibernate
      HibernateTemplate.saveOrUpdate
      1. org.springframework.orm.hibernate.HibernateTemplate$13.doInHibernate(HibernateTemplate.java:344)
      2. org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:200)
      3. org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:341)
      3 frames
    4. bucket.core.persistence
      HibernateObjectDao.save
      1. bucket.core.persistence.hibernate.HibernateObjectDao.saveRaw(HibernateObjectDao.java:151)
      2. bucket.core.persistence.hibernate.HibernateObjectDao.save(HibernateObjectDao.java:121)
      2 frames
    5. com.atlassian.confluence
      DefaultLinkManager.updateOutgoingLinks
      1. com.atlassian.confluence.links.DefaultLinkManager.saveLink(DefaultLinkManager.java:60)
      2. com.atlassian.confluence.links.DefaultLinkManager.updateOutgoingLinks(DefaultLinkManager.java:171)
      2 frames
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:324)
      4 frames