Null list returned from hibernate query with embedded id

前端 未结 4 1270
独厮守ぢ
独厮守ぢ 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:34

    I had the same issue no exception and a list of nulls the same size as the query result. I started commenting out stuff and comparing to another EmbeddedId JPA. Here is what I found out, all columns in the EmbeddedId must be non null add nullable = false to Columns on the @AttributeOverride and in the @Embedded id class. Remove null columns from the PK class.

    I don't know why this works but it did.

提交回复
热议问题