Hi!
After adding the annotation processor hibernate-jpamodelgen there are errors in logs on application startup:
ERROR org.hibernate.metamodel.internal.MetadataContext - HHH015007: Illegal argument on static metamodel field injection : com.example.Group_#products; expected type : org.hibernate.metamodel.model.domain.internal.SingularAttributeImpl; encountered type : javax.persistence.metamodel.ListAttribute
I am mapping json collection to List, just like in How to map a JSON collection using JPA and Hibernate - Vlad Mihalcea. The mapping works fine, but how can I fix metamodel, so that Group_#products wouldn’t be null? Do you have any suggestions how to manage with this error?
My entity looks like this:
@Entity
@Access(FIELD)
@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)
class Group {
@Type(type = "jsonb")
@Column(columnDefinition = "json")
List<Product> products;
}
Generated metamodel looks like this:
public abstract class Group_ {
public static volatile ListAttribute<Group, Product> products; // null after startup
public static final String PRODUCTS = "products";
}
Hibernate version - 5.4.33.Final
Database - postgres
Products column type - jsonb