We're updating the issue view to help you get more done. 

Incorrect metamodel for basic collections

Description

we have

1 2 3 4 5 6 7 8 9 @Entity public class Goods { @Id private Long id; @OneToMany private List<Product> productList; @Convert(converter = StringToListConverter.class) private List<String> tags; }

which create Goods_ after compile:

1 2 3 4 5 6 7 8 @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; }

when we use Goods_.productList to create a path

1 root.get(Goods_.tags)

get the NullPointerException error:

1 2 3 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)

but if we use root.get("tags") ,it runs correct.

In fact, Goods.tags has no reationship with other entity, we should treat it as a basic attribute,and get this:

1 public static volatile SingularAttribute<Goods, List<String>> tags;

Environment

None

Status

Assignee

Unassigned

Reporter

helloztt

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major