org.hibernate.PropertyValueException: not-null property references a null or transient value : org.hibernate.bugs.Person.createDate

Hibernate JIRA | zhouyanming | 8 months 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

    {code:java} @Column(nullable = false) @CreationTimestamp private Date createDate; {code} {code:java} org.hibernate.PropertyValueException: not-null property references a null or transient value : org.hibernate.bugs.Person.createDate at org.hibernate.engine.internal.Nullability.checkNullability(Nullability.java:92) at org.hibernate.action.internal.AbstractEntityInsertAction.nullifyTransientReferencesIfNotAlready(AbstractEntityInsertAction.java:115) at org.hibernate.action.internal.AbstractEntityInsertAction.makeEntityManaged(AbstractEntityInsertAction.java:124) at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:279) at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:254) at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:241) at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:326) at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:275) at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:182) at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:125) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192) at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:177) at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73) at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:682) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:674) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:669) {code} If hibernate-validator present, it works fine.

    Hibernate JIRA | 8 months ago | zhouyanming
    org.hibernate.PropertyValueException: not-null property references a null or transient value : org.hibernate.bugs.Person.createDate
  2. 0

    Getting error with basic one-to-many mapping

    Stack Overflow | 3 years ago | user3181365
    org.hibernate.PropertyValueException: not-null property references a null or transient value : Address._Person.addressesBackref
  3. 0

    A property of an {{@Embeddable}} is defined with {{@Basic(optional = false)}} Attempting to override the non-optional column where the embeddable is {{@Embedded}} in an entity using {{@AttributeOverride(... column = @Column(nullable = true))}} No warning is logged nor is any exception raised until an attempt it made to persist an entity with a null value for the relevant column at which point the following exception is raised (see attached testcase): {noformat} org.hibernate.PropertyValueException: not-null property references a null or transient value : org.hibernate.test.annotations.embeddables.NullableOverrideTest$TestEntity.aCode at org.hibernate.engine.internal.Nullability.checkNullability(Nullability.java:92) at org.hibernate.action.internal.AbstractEntityInsertAction.nullifyTransientReferencesIfNotAlready(AbstractEntityInsertAction.java:115) at org.hibernate.action.internal.AbstractEntityInsertAction.makeEntityManaged(AbstractEntityInsertAction.java:124) at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:241) at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:213) at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:200) at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:325) at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:272) at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:178) at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192) at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:177) at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73) at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:679) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:671) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:666) at org.hibernate.test.annotations.embeddables.NullableOverrideTest.testUnsetNullable(NullableOverrideTest.java:44) {noformat} If {{@Basic}} cannot be overridden in this manner, but there should be a warning or exception raised.

    Hibernate JIRA | 1 year ago | Stephen Fikes
    org.hibernate.PropertyValueException: not-null property references a null or transient value : org.hibernate.test.annotations.embeddables.NullableOverrideTest$TestEntity.aCode
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    A property of an {{@Embeddable}} is defined with {{@Basic(optional = false)}} Attempting to override the non-optional column where the embeddable is {{@Embedded}} in an entity using {{@AttributeOverride(... column = @Column(nullable = true))}} No warning is logged nor is any exception raised until an attempt it made to persist an entity with a null value for the relevant column at which point the following exception is raised (see attached testcase): {noformat} org.hibernate.PropertyValueException: not-null property references a null or transient value : org.hibernate.test.annotations.embeddables.NullableOverrideTest$TestEntity.aCode at org.hibernate.engine.internal.Nullability.checkNullability(Nullability.java:92) at org.hibernate.action.internal.AbstractEntityInsertAction.nullifyTransientReferencesIfNotAlready(AbstractEntityInsertAction.java:115) at org.hibernate.action.internal.AbstractEntityInsertAction.makeEntityManaged(AbstractEntityInsertAction.java:124) at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:241) at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:213) at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:200) at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:325) at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:272) at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:178) at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192) at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:177) at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73) at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:679) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:671) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:666) at org.hibernate.test.annotations.embeddables.NullableOverrideTest.testUnsetNullable(NullableOverrideTest.java:44) {noformat} If {{@Basic}} cannot be overridden in this manner, but there should be a warning or exception raised.

    Hibernate JIRA | 1 year ago | Stephen Fikes
    org.hibernate.PropertyValueException: not-null property references a null or transient value : org.hibernate.test.annotations.embeddables.NullableOverrideTest$TestEntity.aCode
  6. 0

    Hibernate 5: SaveOrUpdateEventListener is not working

    Stack Overflow | 6 months ago | Kuldeep Yadav
    org.hibernate.PropertyValueException: not-null property references a null or transient value : com.inbhiwadi.model.Opportunity.createdOn

  1. Victor_IT 1 times, last 3 weeks ago

Root Cause Analysis

  1. org.hibernate.PropertyValueException

    not-null property references a null or transient value : org.hibernate.bugs.Person.createDate

    at org.hibernate.engine.internal.Nullability.checkNullability()
  2. Hibernate
    SessionImpl.save
    1. org.hibernate.engine.internal.Nullability.checkNullability(Nullability.java:92)
    2. org.hibernate.action.internal.AbstractEntityInsertAction.nullifyTransientReferencesIfNotAlready(AbstractEntityInsertAction.java:115)
    3. org.hibernate.action.internal.AbstractEntityInsertAction.makeEntityManaged(AbstractEntityInsertAction.java:124)
    4. org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:279)
    5. org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:254)
    6. org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:241)
    7. org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:326)
    8. org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:275)
    9. org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:182)
    10. org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:125)
    11. org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192)
    12. org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38)
    13. org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:177)
    14. org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32)
    15. org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73)
    16. org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:682)
    17. org.hibernate.internal.SessionImpl.save(SessionImpl.java:674)
    18. org.hibernate.internal.SessionImpl.save(SessionImpl.java:669)
    18 frames