I have been using Hi开发者_Python百科bernate 3.2 intailly for my J2EE application with Spring 2.5.Recently I wanted a feature of hibernate 3.5(BigInt Identity support).So I have upgraded my hibernate and now I facing a different issue with my queries.
HQL Query:-
select table from tableVO table where tableVO.subTableVO.id=:tableVO.id
SQL Query:-
select table_1_ID from table cross join subTable where subTable.id =table.id
I see that cross join is being done by hibernate which is not accepted by Sybase ASE. How can I fix this?
Check the dialect you have set in hibernate configuration. I'm going to assume you're running on Sybase ASE 15.x. As you found out, Sybase does not (yet) support CROSS JOIN, which is what the SybaseDialect attempts to use. Instead, use SybaseASE157Dialect or SybaseASE15Dialect. It will generate syntax that should look like:
select table_1_ID from table, subTable where subTable.id =table.id
You can change hibernate dialect,
in hibernate.cfg
<property name="hibernate.dialect">com.YourProject.YourDialect</property>
in your dialect class you should enter the syntax you want executed.
example dialect change for DB2
public class DB2390Dialect extends DB2Dialect
{
public String getIdentitySelectString() {
return "select identity_val_local() from sysibm.sysdummy1";
}...
}
Hope this helps
This is a bug with implicit joins in Hibernate. You can fix it by aliasing your joins:
select table from tableVO table
join tableVO.subtableVO subtable
where subtable.id=:tableVO.id
精彩评论