-
Bug
-
Resolution: Done
-
Major
-
7.1.5.GA
*no* further _formatting_ is done here
Given the following classes:
@Entity(name = "Genius") public static class Genius extends Human { private Long id; public Genius() { } public Genius(Long id) { this.id = id; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } } @Entity(name = "Human") @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public static class Human { private Long realId; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "realId") public Long getRealId() { return realId; } public void setRealId(Long realId) { this.realId = realId; } }
Executing the query: select count( h ) from Human h results in the following SQL:
select count(idproperty0_.id) as col_0_0_ from Human idproperty0_
Note that:
- idproperty0_.id is not the primary key column;
- Human does not have a property named id;
- count should be operating on the primary key, idproperty0_.realId.
The same select expression is generated using @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS).
When @Inheritance(strategy = InheritanceType.JOINED) is used, the generated SQL is:
select count(idproperty0_1_.id) as col_0_0_ from Human idproperty0_
In addition to using the wrong column, there is no table with alias idproperty0_1_.
- clones
-
JBEAP-15898 [GSS](7.1.z) HHH-13114 Query "select count(h) from Human h" fails if a subclass has a non-Id property named "id"
- Closed
- is incorporated by
-
JBEAP-15898 [GSS](7.1.z) HHH-13114 Query "select count(h) from Human h" fails if a subclass has a non-Id property named "id"
- Closed
-
JBEAP-15805 (7.2.z) Upgrade Hibernate ORM from 5.3.7 to 5.3.8
- Closed
-
WFLY-11749 Upgrade Hibernate ORM from 5.3.7 to 5.3.8
- Closed
- incorporates
-
HHH-13114 Loading...
- links to