Incorrect sql request on count method with Play/Sybase/Hibernate when multiple PK
My model has multiple PK (3), I'm using the Play Framework with Hibernate, and the table mapped by my Model is stored in a Sybase db.
I made a Junit where the save()/find()/delete() works very well. But the count() method d开发者_如何学编程on't, it throws a SqlGrammarException. By setting jpa.debugSQL=true
I trapped the sql request generated by Hibernate and it's incorrect :
select count((systempara0_.interface, systempara0_.name, systempara0_.origine)) as col_0_0_ from system_parameters systempara0_
Sybase doesn't allow commas in the count statement, if I drop them and set only one column in the statement, the request runs well.
Am I wrong somewhere ? Is there a bug in Hibernate ? Is there a workaround ?
Thanks in advance
Sybase Version : Adaptive Server Enterprise/15.0.3
Play Framework 1.1.1
Update :
From the hibernate Javadoc, I noticed a method called supportsTupleCounts()
in the SybaseASE15Dialect
class, which returns false.
http://docs.jboss.org/hibernate/core/3.6/javadocs/org/hibernate/dialect/Dialect.html#supportsTupleCounts()
BUT the Play framework 1.1.1 embeds Hibernate 3.5.6 where this method does not exists... That's the reason!
As far as I know you can downgrade the dialect-files. You can't change the hibernate version in play, because they made some patches.
精彩评论