How to use criteriaBuilder.nullLiteral(MyEnum.class) for 6.1.7.Final Version

Hi!
I am migrating to 6.1.7.Final and now got one issue for this line

selections.add(criteriaBuilder.nullLiteral(userType.class)); //UserType is an enum

Here I am getting error : UserType is not a managed type.

Can someone help me how can I solve this issue in this version?

I dont want to upgrade the version to the latest stable, because there I get another problem related to @FilterDef.

I have same @FilterDef(name = “userFilter”, parameters = @ParamDef(name = “user_id”, type = LongJavaType.class)) in all of my entities.

Or if someone suggests to use latest version, could you please tell me with an example how can I solve this @FilterDef issue as well ?

I would really love to hear from you guys!

Your problem sounds very similar to [HHH-16803] - Hibernate JIRA, which was fixed in version 6.2.7. You will have to update to a supported version, as 6.1 is no longer supported.

I have same @FilterDef(name = “userFilter”, parameters = @ParamDef(name = “user_id”, type = LongJavaType.class)) in all of my entities

Why? A @FilterDef is used to define a filter, there should only be one for each filter name, you should simply only define it once in your model.

1 Like