Skip to content

Failed null mapping on read-only JoinColumn in table assertions #797

@Quentin-Claeyssen

Description

@Quentin-Claeyssen

Description
A Cucumber step verifying the table content fails when an entity contains a @ManyToOne relationship marked as read-only (insertable = false, updatable = false).

Environment

  • Current Version: 2.3.10 (Failing)
  • Java/Hibernate context: JPA Entity with Lazy fetching.

Entity Configuration
The issue occurs on entities with the following mapping:

@Entity
public class MyEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    // ... other fields

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "my_other_object_id", insertable = false, updatable = false)
    private MyOtherObject myOtherObject;
}

Steps to Reproduce
Define a .feature file that checks for a null value in the relationship column.

Run the test using version 2.3.10.

Cucumber snippet:

And the my_entity table contains exactly:
  | id | ... | myOtherObject |
  | 1  | ... | {{null}}      |

Actual Behavior
If I don't specify the column, it tells me that the two objects are not the same size.
And when I specify {{null}}, it tells me that the column is not null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions