Hi,
I have a JPA model with class hierarchy:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class A {
@Id
@GeneratedValue
private Long id;
private String parentVal;
// getters setters here
}
@Entity
public class SubA extends A {
private String val;
// getters setters here
}
It is a simplification of my real model. I have a JPQL query
select val from SubA
which generates this sql
select suba0_.val as col_0_0_ from SubA suba0_ inner join A suba0_1_ on suba0_.id=suba0_1_.id
There is a inner join to the superclass table, which is useless. I need nothing from there. But it looks like it is impossible to get rid of it. I asked that on stackoverflow already and also debug Hibernate code.
I start thinking about creating of hibernate patch which allows that. First option would be to detect if I need to join parent table, another option would be explicitly say “do not join it”. What do you think, how is it difficult? Could you direct me? Thank you.