-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: JDBCExceptionReporter incorrect syntax near 'left'
PostPosted: Tue Oct 18, 2005 11:32 am 
Newbie

Joined: Tue Oct 18, 2005 11:21 am
Posts: 4
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.1rc2

Hi, I'm trying to build the Hibernate demo program for the first time. Its able to create the tables in my Sybase 11.9 database but it can't run the HQL.

Looks as though the generated SQL results in a 'left join' which is invalid for transact-SQL.

Any help appreciated!

Ant

Full stack trace of any exception that occurs:
Code:
     [java] Setting up some test data
     [java] Viewing all auction item objects
     [java] 16:12:43,949  WARN JDBCExceptionReporter:71 - SQL Error: 102, SQLState: 42000
     [java] 16:12:43,950 ERROR JDBCExceptionReporter:72 - Incorrect syntax near 'left'.

     [java] Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query
     [java]     at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
     [java]     at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
     [java]     at org.hibernate.loader.Loader.doList(Loader.java:2150)
     [java]     at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2026)
     [java]     at org.hibernate.loader.Loader.list(Loader.java:2021)
     [java]     at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:369)
     [java]     at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:298)
     [java]     at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1020)
     [java]     at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
     [java]     at org.hibernate.auction.Main.viewAllAuctionsSlow(Main.java:93)
     [java]     at org.hibernate.auction.Main.main(Main.java:371)
     [java] Caused by: com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near 'left'.

     [java]     at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2110)
     [java]     at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1578)
     [java]     at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
     [java]     at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:159)
     [java]     at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:140)
     [java]     at com.sybase.jdbc2.jdbc.SybStatement.queryLoop(SybStatement.java:1350)
     [java]     at com.sybase.jdbc2.jdbc.SybStatement.executeQuery(SybStatement.java:1335)
     [java]     at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeQuery(SybPreparedStatement.java:69)
     [java]     at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:137)
     [java]     at org.hibernate.loader.Loader.getResultSet(Loader.java:1676)
     [java]     at org.hibernate.loader.Loader.doQuery(Loader.java:662)
     [java]     at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)
     [java]     at org.hibernate.loader.Loader.doList(Loader.java:2147)
     [java]     ... 8 more

Name and version of the database you are using:Sybase 11.9

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 11:58 am 
Newbie

Joined: Tue Oct 18, 2005 11:21 am
Posts: 4
Looking further into it, I believe Sybase 11.9 didn't have support for ANSI joins. Does this mean 11.9 is incompatible with Hibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 12:35 pm 
Newbie

Joined: Tue Oct 18, 2005 11:21 am
Posts: 4
I've found the patch for this problem now, here's a link:

Quote:
Description:
Sybase 11.9.2 does not support ANSI-style joins. Instead, it supports "=", "*=", and "*=" type joins. The existing Hibernate SybaseDialect produces ANSI-style joins.


http://opensource2.atlassian.com/projects/hibernate/browse/HB-588?page=all


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 12:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Considering there is a specific dialect for Sybase 11, I'd think you might want to try that; just a thought...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 12:54 pm 
Newbie

Joined: Tue Oct 18, 2005 11:21 am
Posts: 4
Perhaps this is only for my benefit then but..

If you're using Sybase 11.9.x

Set the following property in hibernate.properties:
Code:
hibernate.dialect org.hibernate.dialect.Sybase11Dialect


Thanks again!

Ant


Top
 Profile  
 
 Post subject: thks
PostPosted: Tue Jan 17, 2006 4:53 am 
Newbie

Joined: Mon Jan 16, 2006 11:45 pm
Posts: 1
thks

this problem puzzled me a hole day!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.