]
Strong Liu reopened HHH-3029:
-----------------------------
yeah, you're right, I'm think add the check version logic to the derby dialect, if
the version is too low to support this syntax, then it set that property to false default
and give a warn log
use_sql_commants fails on Derby
-------------------------------
Key: HHH-3029
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3029
Project: Hibernate Core
Issue Type: Bug
Environment: WinXP, SP2 Java 1.5..0_12, Spring 2.0.7, Hibernate 3.2.5ga, Derby
10.3.2.1
Reporter: Oleksandr Alesinskyy
Assignee: Strong Liu
Activation is use_sql_comments cause SQL exception
/* insert de.ntec.lms.impl.P1Bean
*/ insert
into
P1
(VERSION, CELL_POS, CODE, CELL_ID, PLACE_ID)
values
(?, ?, ?, ?, ?)
2007-12-25 11:46:29,406 WARN org.hibernate.util.JDBCExceptionReporter
SQL Error: -1, SQLState: 42X01
2007-12-25 11:46:29,406 ERROR org.hibernate.util.JDBCExceptionReporter
Syntaxfehler: Encountered "/" at line 1, column 1.
2007-12-25 11:46:29,487 ERROR org.hibernate.event.def.AbstractFlushingEventListener
Could not synchronize database state with session
org.hibernate.exception.SQLGrammarException: could not insert: [de.ntec.lms.impl.P1Bean]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2078)
at
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2427)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
at
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at de.ntec.lms.impl.PerformanceTest.doMain(PerformanceTest.java:84)
at de.ntec.lms.impl.PerformanceTest.main(PerformanceTest.java:46)
Caused by: java.sql.SQLException: Syntaxfehler: Encountered "/" at line 1,
column 1.
at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.Connection.prepareStatement(Unknown Source)
at
org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:185)
at
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:278)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:442)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:93)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:86)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:171)
at
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2048)
... 12 more
Caused by: org.apache.derby.client.am.SqlException: Syntaxfehler: Encountered
"/" at line 1, column 1.
at org.apache.derby.client.am.Statement.completeSqlca(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown
Source)
at org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source)
at org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.readPrepareDescribeInputOutput(Unknown
Source)
at org.apache.derby.client.am.PreparedStatement.flowPrepareDescribeInputOutput(Unknown
Source)
at org.apache.derby.client.am.PreparedStatement.prepare(Unknown Source)
at org.apache.derby.client.am.Connection.prepareStatementX(Unknown Source)
... 20 more
Hibernate settings (via Spring)
<property name="manglableMappingResources">
<list>
<value>de/ntec/lms/impl/P1Bean.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop
key="hibernate.dialect">org.hibernate.dialect.DerbyDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.use_sql_comments">true</prop>
<prop
key="hibernate.cglib.use_reflection_optimizer">false</prop>
</props>
</property>
When use_sql_comments is false all works smoothly.
Failing code
P1Bean p1= new P1Bean();
p1.setCell(1);
p1.setCellPosition(2);
p1.setCode("A");
s.save(p1);
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: