You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If using Entities with composite Id's, e.g. like
@Entity
@Table(name = "Products", catalog = "Utility")
public class Products implements java.io.Serializable {
private ProductsId id;
private String productGroupName;
..... }
and the corresponding Id class:
@Embeddable
public class ProductsId implements java.io.Serializable {
private String facility;
private String productGroup;
private String product;
.... }
and a DAO like this
@Repository
public class ProductsHome extends GenericDAOImpl<Products, ProductsId> {
}
Now using search function "count()" will fail because the root alias "_it" will
be expanded leading to invalid sql.
It will create invalid SQL like:
select count( (produ0_.Facility, produ0_.ProductGroup, produ0_.Product) as
col_0_0_ from Utility.Products produ0_
this fails on mysql with error 1241.
/* SQL Error (1241): Operand should contain 1 column(s) */
What is the expected output? What do you see instead?
Expected is sql like:
select count((produ0_.Facility))
or
select count (*) ....
What version of the product are you using? On what operating system?
1.0.0
Hibernate 3.6.5.Final
Original issue reported on code.google.com by flei...@gmail.com on 4 Jul 2011 at 11:44
The text was updated successfully, but these errors were encountered:
I hope to look into this. There might be a different problem if we just use
count(*); I seem to recall some issue.
In the mean time, the workaround might be to call searchUnique with a Search
object that specifies a specific count column.
Original comment by dwolvert on 6 Jul 2011 at 11:44
hi all, i use 1.1.0 and also got this issue when call searchAndCount(),
Hibernate:
select
count((signatoryc0_.ACC_ID,
signatoryc0_.CARD_VER)) as col_0_0_
from
CHQ_ACC_SIG_CARD_TBL signatoryc0_
where
signatoryc0_.ACC_ID=?
2014-06-28 09:42:37,063 [JDBCExceptionReporter]: SQL Error: 1241, SQLState:
21000
any suggestion.. btw, for some reason, i need to use hiberante3, so i use
1.1.0, but not 1.2.0, thanks..
Original comment by weiguang...@gmail.com on 28 Jun 2014 at 2:02
Original issue reported on code.google.com by
flei...@gmail.com
on 4 Jul 2011 at 11:44The text was updated successfully, but these errors were encountered: