Uploaded image for project: 'Hibernate ORM'
  1. HHH-12338

Incorrect metamodel for basic collections

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects versions: None
    • Fix versions: 5.3.0.CR1, 5.2.17
    • Components: metamodel
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      we have

      @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:

      @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

      root.get(Goods_.tags)
      

      get the NullPointerException error:

      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:

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

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: