This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 192687 - running query in Hibernate query editor does not work if project is not compiled
Summary: running query in Hibernate query editor does not work if project is not compiled
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Hibernate (show other bugs)
Version: 7.0
Hardware: PC All
: P3 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-30 15:35 UTC by Kenneth Ganfield
Modified: 2016-07-07 08:55 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Ganfield 2010-11-30 15:35:22 UTC
When using the HQL query editor, typing a simple query (eg.from XXX) results in the following error if the project is not compiled. If you build the project and then run the query in the editor, the editor displays the correct result.

org.hibernate.exception.SQLGrammarException: could not execute query
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
	at org.hibernate.loader.Loader.doList(Loader.java:2223)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
	at org.hibernate.loader.Loader.list(Loader.java:2099)
	at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)
	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from limit 100' at line 1
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
	at com.mysql.jdbc.Util.getInstance(Util.java:384)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)
	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2275)
	at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
	at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
	at org.hibernate.loader.Loader.doQuery(Loader.java:674)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
	at org.hibernate.loader.Loader.doList(Loader.java:2220)
	... 8 more
Comment 1 Sergey Petrov 2011-11-16 12:14:51 UTC
it's likely because mappings are not used in compile&save and are not updated online.
Comment 2 Sergey Petrov 2012-11-15 04:46:02 UTC
It's nice to apply at least the same verification as in JPQL editor and provide a hint on hql editor opening and in case if it's possible to detect uncompiled project. Separate enhancement to support c&s instead of building may be considered for both editors.
Comment 3 Jonathan_Deng 2014-07-10 09:22:30 UTC
I got the same result in the following error,and when I complied the project and run HQL query,it still did not work.
> it's likely because mappings are not used in compile&save and are not
> updated online.
Comment 4 Sergey Petrov 2014-07-10 12:13:16 UTC
this issue is about requirement to compile, if you have a problem with compiled project, it's another issue
Comment 5 Jonathan_Deng 2014-07-11 08:17:29 UTC
Thanks for your feadback.I got it and I found that it was caused by HQL format in my project.In HQL it should be keyed in Java class name,for example,"from packagename.classname",and the name was case sensitive.

> this issue is about requirement to compile, if you have a problem with
> compiled project, it's another issue
Comment 6 Martin Balin 2016-07-07 08:55:00 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss