@Entity
public class A {
@Id
publicInteger aId;
publicString aName;
@Embedded
public B b;
public A() {
}
public A(Integer id, String name) {
this.aId = id;
this.aName = "A" + name;
this.b = new B(id + 100, "B" + name);
}
}
@Embeddable
public class B {
publicInteger bId;
publicString bName;
public B() {
}
public B(Integer id, String name) {
this.bId = id;
this.bName = name;
}
}
Running {{ SELECT COUNT(a.c) FROM A a }} produces a syntactically incorrect query
select
count(a0_.b_bid,
a0_.b_bname) as col_0_0_
from
A a0_
The DB error message is
Syntax error in SQL statement "SELECT COUNT(A0_.B_BID,[*] A0_.B_BNAME) AS COL_0_0_ FROM A A0_ "; expected "., [, ::, *, /, %, +, -, ||, ~, !~, NOT, LIKE, REGEXP, IS, IN, BETWEEN, AND, OR, )"; SQL statement:
Reason is that COUNT does not accept multiple column names, only a single column or *.