我遇到了一个我无法找到问题的问题。希望你的大脑可以给我一个提示,但是:)
下面的代码显示了它到目前为止的工作方式。但现在我想通过从supperClass中返回superColumn2来扩展SELECT。
这是我的两个子类的超类:
@MappedSuperclass
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class SuperClass extends MyEntity{
@Column(name = "superColumn2", nullable = false, length = 20)
private String superColumn2;
...
}
subclass1:
@Entity
@Table(uniqueConstraints = @UniqueConstraint(name = "UC_subClass1",
columnNames = {"superColumn1", "superColumn2"}))
public class SubClass1 extends SuperClass {
}
anyTable:
@Entity
public class TableX extends MyEntity {
@Column(name = "columnX", nullable = false, length = 20)
private String columnX;
@Column(name = "subClass1_id", nullable = false, length = 20)
private SubClass1 subClass1_id;
}
和命名查询:
SELECT tx.columnX, sc1.superColumn2
FROM TableX tx
JOIN tx.subClass1_id sc1;
错误是: antlr.NoViableAltException:意外令牌:sc1
希望你能给我一点提示。
非常感谢