org.hibernate.PropertyValueException: not-null property references a null or transient value : org.hibernate.test.annotations.embeddables.NullableOverrideTest$TestEntity.aCode

Hibernate JIRA | Stephen Fikes | 7 months ago
  1. 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 | 7 months ago | Stephen Fikes
    org.hibernate.PropertyValueException: not-null property references a null or transient value : org.hibernate.test.annotations.embeddables.NullableOverrideTest$TestEntity.aCode
  2. 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 | 7 months ago | Stephen Fikes
    org.hibernate.PropertyValueException: not-null property references a null or transient value : org.hibernate.test.annotations.embeddables.NullableOverrideTest$TestEntity.aCode
  3. 0

    Getting error with basic one-to-many mapping

    Stack Overflow | 2 years ago | user3181365
    org.hibernate.PropertyValueException: not-null property references a null or transient value : Address._Person.addressesBackref
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 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 | 3 months ago | zhouyanming
    org.hibernate.PropertyValueException: not-null property references a null or transient value : org.hibernate.bugs.Person.createDate
  6. 0

    Hibernate 5: SaveOrUpdateEventListener is not working

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

    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. 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()
    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:241)
      5. org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:213)
      6. org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:200)
      7. org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:325)
      8. org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:272)
      9. org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:178)
      10. org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
      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:679)
      17. org.hibernate.internal.SessionImpl.save(SessionImpl.java:671)
      18. org.hibernate.internal.SessionImpl.save(SessionImpl.java:666)
      18 frames
    3. org.hibernate.test
      NullableOverrideTest.testUnsetNullable
      1. org.hibernate.test.annotations.embeddables.NullableOverrideTest.testUnsetNullable(NullableOverrideTest.java:44)
      1 frame