Skip to content

Conversation

cwitteveen-cofano
Copy link

@cwitteveen-cofano cwitteveen-cofano commented Jul 8, 2024

When the Entity with @JdbcTypeCode(SqlTypes.ARRAY) the types of the fields are different than when the Entity with @JdbcTypeCode(SqlTypes.JSON) is loaded first.

If @JdbcTypeCode(SqlTypes.JSON) is loaded first, all subsequent fields of the same java type will be mapped to json.

EntityArray loaded first

Hibernate: 
    create table EntityArray (
        id bigint not null,
        listInteger integer array,
        listString varchar(255) array,
        primary key (id)
    )
Hibernate: 
    create table EntityJSON (
        id bigint not null,
        listInteger json,
        listString json,
        primary key (id)
    )
Hibernate: 
    create table EntityPlain (
        id bigint not null,
        listInteger integer array,
        listString varchar(255) array,
        primary key (id)
    )

EntityJSON loaded first

Hibernate: 
    create table EntityArray (
        id bigint not null,
        listInteger json,
        listString json,
        primary key (id)
    )
Hibernate: 
    create table EntityJSON (
        id bigint not null,
        listInteger json,
        listString json,
        primary key (id)
    )
Hibernate: 
    create table EntityPlain (
        id bigint not null,
        listInteger json,
        listString json,
        primary key (id)
    )

EntityPlain loaded first

Hibernate: 
    create table EntityArray (
        id bigint not null,
        listInteger integer array,
        listString varchar(255) array,
        primary key (id)
    )
Hibernate: 
    create table EntityJSON (
        id bigint not null,
        listInteger json,
        listString json,
        primary key (id)
    )
Hibernate: 
    create table EntityPlain (
        id bigint not null,
        listInteger integer array,
        listString varchar(255) array,
        primary key (id)
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant