[Hibernate-JIRA] Created: (HHH-3029) use_sql_commants fails on Derby
by Oleksandr Alesinskyy (JIRA)
use_sql_commants fails on Derby
-------------------------------
Key: HHH-3029
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3029
Project: Hibernate3
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
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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 5 months
[Hibernate-JIRA] Created: (HHH-4630) Criteria join on composite identifier generates wrong alias, SQL error
by Chris Wilson (JIRA)
Criteria join on composite identifier generates wrong alias, SQL error
----------------------------------------------------------------------
Key: HHH-4630
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4630
Project: Hibernate Core
Issue Type: Patch
Components: core
Affects Versions: 3.5
Environment: Hibernate trunk from 2009-11-30, Ubuntu 8.04, Sun Java 1.6.0-17, MySQL 5.0.51a-3ubuntu5.4
Reporter: Chris Wilson
Attachments: hibernate-invalid-alias-generation.patch
Hibernate generates the wrong alias on a Criteria query involving a join
on a composite identifier. For example, in the test below without the fix
to JoinWalker, it generates this SQL:
select
this_.role_code as role1_0_1_,
this_.is_deleted as is2_0_1_,
this_.record_version as record3_0_1_,
complexjoi3_.code as code1_0_,
complexjoi3_.is_deleted as is2_1_0_,
complexjoi3_.record_version as record3_1_0_
from
list_action_roles this_
left outer join
roles complexjoi3_
on this_.role_code=complexjoi3_.code
where
this_.is_deleted=?
and complexjoi1_.is_deleted=?
Which results in this error from the SQL server:
Unknown column 'complexjoi1_.is_deleted' in 'where clause'
Analysis of the problem:
The entity persister class with the composite identifier has a fake
property for it, called "_identifierMapper" (see HbmBinder.bindCompositeId()
and similarly in Annotations). This property name ends up in the path
used by JoinWalker.walkEntityTree() when it calls walkComponentTree().
However that path is used by CriteriaJoinWalker.generateTableAlias()
to look up the correct criteria (and hence the alias) from the
translator, a CriteriaQueryTranslator.
The alias was created in CriteriaQueryTranslator.createCriteriaSQLAliasMap
for a Criteria without this extra _identifierMapper path component.
So when CriteriaJoinWalker tries to use the path with _identifierMapper
to look up the criteria to find the correct alias to use, in
generateTableAlias(), it doesn't find one, so it generates a new alias.
That new alias no longer matches the one that will be rendered out in
the WHERE clause, so the WHERE clause will refer to table names using
aliases that are not used anywhere else in the query, and the SQL server
will fail to parse the statement.
The solution appears to be to exclude "_identifierMapper" components in
the alias path when building it. I don't know what other implications
that might have, but it seems like an implementation nastiness that
shouldn't be exposed.
Patch attached.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 6 months
[Hibernate-JIRA] Created: (HSEARCH-210) Support hbm xml mapping!
by Mark Stewart (JIRA)
Support hbm xml mapping!
------------------------
Key: HSEARCH-210
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-210
Project: Hibernate Search
Issue Type: Bug
Components: mapping
Affects Versions: 3.0.1.GA
Environment: All.
Reporter: Mark Stewart
I like annotations as much as the next guy but it's a complete non-starter for our business (and, I suspect, plenty of others) to add full text search to our existing apps via Hibernate Search if it means we must convert all our existing hbm.xml configurations into annotations. The regression testing alone would kill us.
The Hibernate project has always been supremely pragmatic which is why I've filed this as a bug rather than a feature request. I don't think Hibernate would have been half as popular if it didn't support things like direct SQL and reverse engineering tools. I think Search would see a big boost if it could be easily added to existing applications.
Please consider adding the needed syntax for xml mapping. At the very least an entry in the FAQ that explains the lacking is needed.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 6 months