Null list returned from hibernate query with embedded id

前端 未结 4 1257
独厮守ぢ
独厮守ぢ 2020-12-31 12:52

I have an entity with an embedded key. The entity has only the key as a field and the key has 7 fields, some of which can be null.

When I run the following query:

4条回答
  •  攒了一身酷
    2020-12-31 13:19

    In general it's probably not a good idea to have nullable columns as a part of composite id. In my case it was required because I had a view created using outer join and I faced exactly the same problem as you described. I was able to solve it using information provided on https://hibernate.atlassian.net/browse/HHH-1109. I used NullableStringType provided in the attachment to this Hibernate Jira. In my composite id class I used:

    @Type(type = "nl.pinkroccade.quarant.common.model.hibernate.type.NullableStringType")
    private String nullableField;
    

提交回复
热议问题