java.sql.SQLException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • CALL IDENTITY
    via hsqldb by mecva
    ,
  • Adding DataSource
    via oreports by juniriola
    ,
  • Adding DataSource
    via oreports by juniriola
    ,
  • HSQLDB Problems
    via wsabi4axis by mikeoliveraz
    ,
  • Given the following mappings: <class name="eg.entitynames.A"> <id name="id"> <generator class="uuid"/> </id> <property name="commonProperty" type="string"/> </class> <joined-subclass name="eg.entitynames.B" extends="eg.entitynames.A" entity-name="BA"> <key column="A"/> <dynamic-component name="values"> <property name="field0" type="string"/> <property name="field1" type="string"/> </dynamic-component> </joined-subclass> <joined-subclass name="eg.entitynames.B" extends="BA" entity-name="BB"> <key column="BB"/> <dynamic-component name="values"> <property name="field2" type="string"/> <property name="field3" type="string"/> </dynamic-component> </joined-subclass> And the following class definitions: public class A { private Serializable id; private Integer version; private String commonProperty; public A() { super(); } public Serializable getId() { return this.id; } void setId(Serializable id) { this.id = id; } public Integer getVersion() { return this.version; } void setVersion(Integer version) { this.version = version; } public String getCommonProperty() { return this.commonProperty; } public void setCommonProperty(String commonProperty) { this.commonProperty = commonProperty; } @Override public boolean equals(Object obj) { if (!(obj instanceof A)) return false; A that = (A) obj; return new EqualsBuilder() .append(this.id, that.id) .append(this.commonProperty, that.commonProperty) .isEquals(); } @Override public int hashCode() { return new HashCodeBuilder() .append(this.id) .append(this.commonProperty) .toHashCode(); } } public class B extends A { private Map<String,Object> values; public Map<String, Object> getValues() { if (this.values == null) this.values = new HashMap<String,Object>(); return this.values; } void setValues(Map<String, Object> values) { this.values = values; } @Override public boolean equals(Object obj) { if (!(obj instanceof B)) return false; B that = (B) obj; return new EqualsBuilder() .appendSuper(super.equals(obj)) .append(this.values, that.values) .isEquals(); } @Override public int hashCode() { return new HashCodeBuilder() .appendSuper(super.hashCode()) .append(this.values) .toHashCode(); } } the following hql will work from BA as b where b.values.field1 = 'value1' from BB as b where b.values.field1 = 'value1' from BB where field3 = 'value5' but the follow hql produces the following stack trace from BB as b where b.values.field3 = 'value5' Stack Trace: org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:1560) at org.hibernate.loader.Loader.list(Loader.java:1540) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:791) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) at eg.entitynames.InheritedDynamicComponentBugTest.testInherentenceFromDynamicParent(InheritedDynamicComponentBugTest.java:64) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194) Caused by: java.sql.SQLException: Column not found: BB0_1_.FIELD3 in statement [select bb0_.BB as id, bb0_2_.commonProperty as commonPr2_0_, bb0_1_.field0 as field2_1_, bb0_1_.field1 as field3_1_, bb0_.field2 as field2_2_, bb0_.field3 as field3_2_ from BB bb0_ inner join BA bb0_1_ on bb0_.BB=bb0_1_.A inner join A bb0_2_ on bb0_.BB=bb0_2_.id where bb0_1_.field3='value5'] at org.hsqldb.jdbc.jdbcUtil.throwError(Unknown Source) at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source) at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:383) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:321) at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:86) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1125) at org.hibernate.loader.Loader.doQuery(Loader.java:369) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:210) at org.hibernate.loader.Loader.doList(Loader.java:1557) ... 21 more Log Output: INFO - Hibernate 3.0.2 INFO - hibernate.properties not found INFO - using CGLIB reflection optimizer INFO - using JDK 1.4 java.sql.Timestamp handling INFO - Mapping class: eg.entitynames.A -> A INFO - Mapping joined-subclass: BA -> BA INFO - Mapping joined-subclass: BB -> BB INFO - Using dialect: org.hibernate.dialect.HSQLDialect INFO - processing extends queue INFO - processing collection mappings INFO - processing association property references INFO - processing foreign key constraints INFO - processing extends queue INFO - processing collection mappings INFO - processing association property references INFO - processing foreign key constraints INFO - Running hbm2ddl schema export INFO - exporting generated schema to database INFO - Using Hibernate built-in connection pool (not for production use!) INFO - Hibernate connection pool size: 20 INFO - autocommit mode: false INFO - using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:. INFO - connection properties: {user=sa, password=****} alter table BA drop constraint FK83F7C8935ED alter table BB drop constraint FK840147F drop table A if exists drop table BA if exists drop table BB if exists create table A ( id varbinary(255) not null, commonProperty varchar(255), primary key (id) ) create table BA ( A varbinary(255) not null, field0 varchar(255), field1 varchar(255), primary key (A) ) create table BB ( BB varbinary(255) not null, field2 varchar(255), field3 varchar(255), primary key (BB) ) alter table BA add constraint FK83F7C8935ED foreign key (A) references A alter table BB add constraint FK840147F foreign key (BB) references BA INFO - schema export complete INFO - cleaning up connection pool: jdbc:hsqldb:. INFO - processing extends queue INFO - processing collection mappings INFO - processing association property references INFO - processing foreign key constraints INFO - Using Hibernate built-in connection pool (not for production use!) INFO - Hibernate connection pool size: 20 INFO - autocommit mode: false INFO - using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:. INFO - connection properties: {user=sa, password=****} INFO - RDBMS: HSQL Database Engine, version: 1.7.2 INFO - JDBC driver: HSQL Database Engine Driver, version: 1.7.2 INFO - Using dialect: org.hibernate.dialect.HSQLDialect INFO - JDBC batch size: 15 INFO - JDBC batch updates for versioned data: disabled INFO - Scrollable result sets: enabled INFO - JDBC3 getGeneratedKeys(): disabled INFO - Aggressive release : disabled INFO - Default batch fetch size: 1 INFO - Generate SQL with comments: disabled INFO - Order SQL updates by primary key: disabled INFO - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory INFO - Using ASTQueryTranslatorFactory INFO - Query language substitutions: {} INFO - Using default transaction strategy (direct JDBC transactions) INFO - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) INFO - Automatic flush during beforeCompletion(): disabled INFO - Automatic session close at end of transaction: disabled INFO - Second-level cache: enabled INFO - Query cache: disabled INFO - Cache provider: org.hibernate.cache.EhCacheProvider INFO - Optimize cache for minimal puts: disabled INFO - Structured second-level cache entries: enabled INFO - Statistics: disabled INFO - Deleted entity synthetic identifier rollback: disabled INFO - Default entity-mode: pojo INFO - building session factory WARN - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/home/wdemoss/projects/threewide/common/dev/lib/spring/ehcache-1.1.jar!/ehcache-failsafe.xml INFO - Not binding factory to JNDI, no JNDI name configured INFO - Checking 0 named queries INFO - cleaning up connection pool: jdbc:hsqldb:. WARN - SQL Error: -28, SQLState: S0022 ERROR - Column not found: BB0_1_.FIELD3 in statement [select bb0_.BB as id, bb0_2_.commonProperty as commonPr2_0_, bb0_1_.field0 as field2_1_, bb0_1_.field1 as field3_1_, bb0_.field2 as field2_2_, bb0_.field3 as field3_2_ from BB bb0_ inner join BA bb0_1_ on bb0_.BB=bb0_1_.A inner join A bb0_2_ on bb0_.BB=bb0_2_.id where bb0_1_.field3='value5'] WARN - SQL Error: -28, SQLState: S0022 ERROR - Column not found: BB0_1_.FIELD3 in statement [select bb0_.BB as id, bb0_2_.commonProperty as commonPr2_0_, bb0_1_.field0 as field2_1_, bb0_1_.field1 as field3_1_, bb0_.field2 as field2_2_, bb0_.field3 as field3_2_ from BB bb0_ inner join BA bb0_1_ on bb0_.BB=bb0_1_.A inner join A bb0_2_ on bb0_.BB=bb0_2_.id where bb0_1_.field3='value5']
    via by William F. DeMoss II,
  • Error on install.db.schema with hsql
    via xplanner by klinge
    ,
  • Please, have a look at the following expression: Criteria criteria = session.createCriteria(ClauseStatisticsImpl.class); criteria.setProjection( Projections.projectionList() .add(Projections.groupProperty("clause"), "clause") .add(Projections.max("useDate"), "useDate")) .add(Property.forName("useDate").eq("2007-12-12")); criteria.addOrder(Order.desc("useDate")).setMaxResults(20).list(); The problem is that the "eq" expression is applied to groupped property. This is not correct and causes SQL exception. Aliases defined for aggregate projections, should be only allied to "group", "having" and "order" clauses. The mapping is: <class name="ClauseStatisticsImpl" table="stc_clause_statistics"> <cache usage="read-write"/> <composite-id> <key-many-to-one name="clause" column="clauseId" class="ClauseImpl"/> <key-property name="useDate"/> </composite-id> </class> The error is: 12:32.22 [ERROR] org.hibernate.util.JDBCExceptionReporter - Column not found: Y1_ in statement [select top ? this_.clauseId as y0_, max(this_.useDate) as y1_ from stc_clause_statistics this_ where this_.userId=? and y1_=? group by this_.clauseId order by y1_ desc] Exception in thread "AWT-EventQueue-0" 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.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) ... 27 more Caused by: java.sql.SQLException: Column not found: Y1_ in statement [select top ? this_.clauseId as y0_, max(this_.useDate) as y1_ from stc_clause_statistics this_ where this_.userId=? and y1_=? and this_.clauseId in (select this0__.id as y0_ from stc_clause this0__ where this0__.userId in (?, ?) and this0__.languageName=? and this0__.procedureName=? and this0__.phaseName=?) group by this_.clauseId order by y1_ desc] at org.hsqldb.jdbc.jdbcUtil.throwError(Unknown Source) at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source) at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423) at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547) at org.hibernate.loader.Loader.doQuery(Loader.java:673) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.doList(Loader.java:2220) ... 34 more
    via by Dmitry Katsubo,
    • java.sql.SQLException: Unexpected token: CALL in statement \[INSERT INTO phone\_call (id,line,phone\_id,arrive\_time,begin\_time,end\_time,long\_distance\_company,category,direction,collect\_call)  VALUES (?,?,?,?,?,?,?,?,?,?) CALL IDENTITY()\] at org.hsqldb.jdbc.jdbcUtil.throwError(Unknown Source) at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source) at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source) at org.tools4j.dbfw.HSQLDBService.insert(HSQLDBService.java:104) at org.tools4j.dbfw.TableDataAccess.insert(TableDataAccess.java:150) at org.tools4j.dbfw.AbstractDAO.insert(AbstractDAO.java:77) at com.icc.soneto.business.SonetoBusiness.createPhoneCall(SonetoBusiness.java:398) at com.icc.soneto.business.SonetoBusiness.createPhoneCall(SonetoBusiness.java:364) at com.icc.soneto.business.SonetoBusiness.processBeginCall(SonetoBusiness.java:325) at com.icc.soneto.business.SonetoBusiness.processEvent(SonetoBusiness.java:99) at com.icc.soneto.business.SonetoBusiness.access$1(SonetoBusiness.java:93) at com.icc.soneto.business.SonetoBusiness$2.objectReceived(SonetoBusiness.java:73) at com.icc.soneto.socket.ConfirmedSocket.dispatchObject(ConfirmedSocket.java:180) at com.icc.soneto.socket.ConfirmedSocket.access$1(ConfirmedSocket.java:178) at com.icc.soneto.socket.ConfirmedSocket$2.run(ConfirmedSocket.java:137)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    4 more bugmates