title: Caused by: java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name [] on this ManagedType []
body: <p>So i have this kotlin project:</p>
  
  <pre><code>package com.example.demo
  
  import org.springframework.data.jpa.repository.JpaRepository
  import org.springframework.data.repository.CrudRepository
  import java.util.*
  import javax.persistence.*
  
  @MappedSuperclass
  abstract class ContainerEntity&lt;TData : DataEntity&gt; {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      var id: Int = 0
  
      @OneToOne(fetch = FetchType.EAGER, cascade = [CascadeType.ALL], optional = false)
      lateinit var data: TData
  }
  
  
  @MappedSuperclass
  abstract class DataEntity {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      var id: Int = 0
  
      val created = Date()
  }
  
  @Entity
  class Car : ContainerEntity&lt;CarData&gt;()
  
  @Entity
  class CarData : DataEntity() {
      var color = "red"
  }
  
  @Entity
  class Apple : ContainerEntity&lt;AppleData&gt;()
  
  @Entity
  class AppleData : DataEntity() {
      var age = 32
  }
  
  /**
   * WORKS
   */
  
  interface CarRepository : CrudRepository&lt;Car, Int&gt; {
      fun findByDataColor(color: String): Car?
  }
  
  
  /**
   * FAILS
   */
  
  interface AppleRepository : CrudRepository&lt;Apple, Int&gt; {
      fun findByDataAge(age: Int): Apple?
  }
  </code></pre>
  
  <p>Getting this exception:</p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: Unable to locate Attribute  with the the given name [age] on this ManagedType [com.example.demo.DataEntity]
          at org.hibernate.metamodel.internal.AbstractManagedType.checkNotNull(AbstractManagedType.java:128) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final]
          at org.hibernate.metamodel.internal.AbstractManagedType.getAttribute(AbstractManagedType.java:113) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final]
          at org.hibernate.metamodel.internal.AbstractManagedType.getAttribute(AbstractManagedType.java:111) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final]
          at org.hibernate.query.criteria.internal.path.SingularAttributePath.locateAttributeInternal(SingularAttributePath.java:71) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final]
          at org.hibernate.query.criteria.internal.path.AbstractPathImpl.locateAttribute(AbstractPathImpl.java:204) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final]
          at org.hibernate.query.criteria.internal.path.AbstractPathImpl.get(AbstractPathImpl.java:177) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final]
          at org.springframework.data.jpa.repository.query.QueryUtils.toExpressionRecursively(QueryUtils.java:673) ~[spring-data-jpa-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          at org.springframework.data.jpa.repository.query.QueryUtils.toExpressionRecursively(QueryUtils.java:606) ~[spring-data-jpa-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          at org.springframework.data.jpa.repository.query.QueryUtils.toExpressionRecursively(QueryUtils.java:578) ~[spring-data-jpa-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          at org.springframework.data.jpa.repository.query.JpaQueryCreator$PredicateBuilder.getTypedPath(JpaQueryCreator.java:381) ~[spring-data-jpa-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          at org.springframework.data.jpa.repository.query.JpaQueryCreator$PredicateBuilder.build(JpaQueryCreator.java:304) ~[spring-data-jpa-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          at org.springframework.data.jpa.repository.query.JpaQueryCreator.toPredicate(JpaQueryCreator.java:209) ~[spring-data-jpa-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          at org.springframework.data.jpa.repository.query.JpaQueryCreator.create(JpaQueryCreator.java:122) ~[spring-data-jpa-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          at org.springframework.data.jpa.repository.query.JpaQueryCreator.create(JpaQueryCreator.java:57) ~[spring-data-jpa-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          at org.springframework.data.repository.query.parser.AbstractQueryCreator.createCriteria(AbstractQueryCreator.java:119) ~[spring-data-commons-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:95) ~[spring-data-commons-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:81) ~[spring-data-commons-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$QueryPreparer.&lt;init&gt;(PartTreeJpaQuery.java:147) ~[spring-data-jpa-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$CountQueryPreparer.&lt;init&gt;(PartTreeJpaQuery.java:270) ~[spring-data-jpa-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.&lt;init&gt;(PartTreeJpaQuery.java:79) ~[spring-data-jpa-2.1.8.RELEASE.jar:2.1.8.RELEASE]
          ... 98 common frames omitted
  
  </code></pre>
  
  <p>There is small demo project: <a href="https://github.com/TomGrill/spring-hibernate-bug" rel="nofollow noreferrer">https://github.com/TomGrill/spring-hibernate-bug</a></p>
  
  <p>As requested:</p>
  
  <pre><code>//@MappedSuperclass
  @Entity
  @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  abstract class ContainerEntity&lt;TData : DataEntity&gt; {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      var id: Int = 0
  
      @OneToOne(fetch = FetchType.EAGER, cascade = [CascadeType.ALL], optional = false)
      lateinit var data: TData
  }
  
  
  //@MappedSuperclass
  @Entity
  @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  abstract class DataEntity {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      var id: Int = 0
  
      val created = Date()
  }
  </code></pre>