we have
{code:java} @Entity public class Goods { @Id private Long id; @OneToMany private List<Product> productList; @Convert(converter = StringToListConverter.class) private List<String> tags; } {code}
which create Goods_ after compile:
{code:java} @StaticMetamodel(Goods.class) public abstract class Goods_ {
public static volatile SingularAttribute<Goods, Long> id; public static volatile ListAttribute<Goods, Product> productList; public static volatile ListAttribute<Goods, String> tags;
}
{code}
when we use Goods_.productList to create a path corresponding
{code:java} root.get(Goods_.tags) {code}
get the NullPointerException error:
{code:java} java.lang.NullPointerException at org.eclipse.persistence.internal.jpa.metamodel.proxy.AttributeProxyImpl.getName(AttributeProxyImpl.java:73) at org.eclipse.persistence.internal.jpa.querydef.FromImpl.get(FromImpl.java:285) {code}
but if we use root.get("tags") ,it runs correct.
In fact, Goods.tags has no reationship with other entity, we should treade it as a basic attribute,and get this:
{code:java} public static volatile SingularAttribute<Goods, List<String>> tags; {code}
|
|