org.springframework.orm.hibernate3.HibernateSystemException: not-null property references a null or transient value: org.hibernate.jiratest.CreditCard.contact.mi; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: org.hibernate.jiratest.CreditCard.contact.mi org.hibernate.PropertyValueException: not-null property references a null or transient value: org.hibernate.jiratest.CreditCard.contact.mi

Hibernate JIRA | Ted Bergeron | 1 decade ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Originally posted on the forums: http://forum.hibernate.org/viewtopic.php?t=955445 Created a "simple" test case. (Are dao tests ever really simple?) Have a simple CreditCard, has a Contact, which has an Address. contact first and lastname are @NotNull. contact.mi and address.address2 are both optional fields. TestDaoHibernateJira.java sets up the object chain with all properties populated. The validator runs and asserts no invalidValues. The test case then sets mi and address2 to null. The validator is run again, and asserts no invalidValues. hibernate's saveOrUpdate(creditCard) method is called via the dao. When run, first hibernate reads the next creditcard id from the sequence. Then we get: org.springframework.orm.hibernate3.HibernateSystemException: not-null property references a null or transient value: org.hibernate.jiratest.CreditCard.contact.mi; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: org.hibernate.jiratest.CreditCard.contact.mi org.hibernate.PropertyValueException: not-null property references a null or transient value: org.hibernate.jiratest.CreditCard.contact.mi at org.hibernate.engine.Nullability.checkNullability(Nullability.java:84) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:265) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:114) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:529) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:521) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:517) at org.springframework.orm.hibernate3.HibernateTemplate$18.doInHibernate(HibernateTemplate.java:690) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:365) at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:687) at com.viz.web.persistence.hibernate.BaseDaoHibernate.save(BaseDaoHibernate.java:121) at org.hibernate.jiratest.TestDaoHibernateJira.testValidatorAndSave(TestDaoHibernateJira.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)

    Hibernate JIRA | 1 decade ago | Ted Bergeron
    org.springframework.orm.hibernate3.HibernateSystemException: not-null property references a null or transient value: org.hibernate.jiratest.CreditCard.contact.mi; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: org.hibernate.jiratest.CreditCard.contact.mi org.hibernate.PropertyValueException: not-null property references a null or transient value: org.hibernate.jiratest.CreditCard.contact.mi

    Root Cause Analysis

    1. org.springframework.orm.hibernate3.HibernateSystemException

      not-null property references a null or transient value: org.hibernate.jiratest.CreditCard.contact.mi; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: org.hibernate.jiratest.CreditCard.contact.mi org.hibernate.PropertyValueException: not-null property references a null or transient value: org.hibernate.jiratest.CreditCard.contact.mi

      at org.hibernate.engine.Nullability.checkNullability()
    2. Hibernate
      Nullability.checkNullability
      1. org.hibernate.engine.Nullability.checkNullability(Nullability.java:84)
      1 frame
    3. Hibernate
      SessionImpl.saveOrUpdate
      1. org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:265)
      2. org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
      3. org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:114)
      4. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
      5. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
      6. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
      7. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
      8. org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:529)
      9. org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:521)
      10. org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:517)
      10 frames
    4. Hibernate
      HibernateTemplate.saveOrUpdate
      1. org.springframework.orm.hibernate3.HibernateTemplate$18.doInHibernate(HibernateTemplate.java:690)
      2. org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:365)
      3. org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:687)
      3 frames
    5. com.viz.web
      BaseDaoHibernate.save
      1. com.viz.web.persistence.hibernate.BaseDaoHibernate.save(BaseDaoHibernate.java:121)
      1 frame
    6. org.hibernate.jiratest
      TestDaoHibernateJira.testValidatorAndSave
      1. org.hibernate.jiratest.TestDaoHibernateJira.testValidatorAndSave(TestDaoHibernateJira.java:74)
      1 frame
    7. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3 frames
    8. com.intellij.rt
      JUnitStarter.main
      1. com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
      1 frame