We're updating the issue view to help you get more done. 

@OneToOne association with @JoinTable ignores optional attribute

Description

Entity A that contains:

1 2 3 @NotFound(action = NotFoundAction.IGNORE) @OneToOne(mappedBy = "a") private B b;

Entity B that contains:

1 2 3 4 5 @OneToOne @JoinTable(name = JOIN_TABLE, joinColumns = @JoinColumn(name = COLUMN_CASE_PRIMARY_KEY), inverseJoinColumns = @JoinColumn(name = COLUMN_CASE_PRIMARY_KEY_SIDE)) private A a;

Trying persist an object B with a = null causes the following exception

1 2 3 4 5 org.hibernate.PropertyValueException: not-null property references a null or transient value : 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.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:69) at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:623)

Environment

None

Status

Assignee

Andrea Boriero

Reporter

Andrea Boriero

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.9

Priority

Major