[Hibernate-JIRA] Created: (HHH-3476) Generation of invalid SQL by HQL Delete
by Daniel Nunes (JIRA)
Generation of invalid SQL by HQL Delete
---------------------------------------
Key: HHH-3476
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3476
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.6, 3.1.3
Environment: MS SQL Server 2000, Hibernate 3.1.3 and Hibernate 3.2.6 GA
Reporter: Daniel Nunes
Attachments: grupo.rar, hibernate.cfg.xml
Hibernate generates invalid DML command for HQL Delete statement.
When doing:
Integer vals[] = {1,3};
Query q = ugDAO.createQuery("delete UsuarioGrupo usuariorGrp"+
" where usuariorGrp.usuario.idusuario = :idUsr"+
" and usuariorGrp.grupo.idgrupo in (:idsGrupo)"+
" and usuariorGrp.grupo.cxpostal.idcxpostal = :idCx");
q.setParameterList("idsGrupo", vals);
q.setInteger("idUsr", 77);
q.setInteger("idCx", 2);
It generates an SQL like this:
Hibernate: delete from vanpix.dbo.usuario_grupo, vanpix.dbo.grupo grupo1_ where idusuario=? and (idgrupo in (? , ?)) and idcxpostal=?
17:26:22,406 DEBUG IntegerType:133 - binding '77' to parameter: 1
17:26:22,406 DEBUG IntegerType:133 - binding '1' to parameter: 2
17:26:22,406 DEBUG IntegerType:133 - binding '3' to parameter: 3
17:26:22,406 DEBUG IntegerType:133 - binding '2' to parameter: 4
17:26:22,453 WARN JDBCExceptionReporter:77 - SQL Error: 170, SQLState: 37000
17:26:22,453 ERROR JDBCExceptionReporter:78 - Line 1: Incorrect syntax near ','.
Throwing the exception:
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute update query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:84)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:396)
at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:259)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1141)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
at com.pix.tests.HibernateTests.main(HibernateTests.java:37)
Caused by: java.sql.SQLException: Line 1: Incorrect syntax near ','.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2816)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2254)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:631)
at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeUpdate(JtdsPreparedStatement.java:505)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75)
... 5 more
The HBMs are in the attachment.
--
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
14 years, 8 months
[Hibernate-JIRA] Created: (HSEARCH-320) Hibernate Search conflicts with Spring's class path scanning
by Paul Middelkoop (JIRA)
Hibernate Search conflicts with Spring's class path scanning
------------------------------------------------------------
Key: HSEARCH-320
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-320
Project: Hibernate Search
Issue Type: Bug
Affects Versions: 3.1.0.GA, 3.1.0.CR1
Reporter: Paul Middelkoop
Hibernate Search conflicts with Spring's class path scanning. When Hibernate Search is on the classpath Spring throws an exception while reading annotation metadata.
3.1.0 Beta1 and 3.0.x versions had no problems.
Stacktrace:
Caused by: java.lang.ArrayIndexOutOfBoundsException: 50432
at org.springframework.asm.ClassReader.readUTF8(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
at org.springframework.core.type.classreading.SimpleMetadataReader.getAnnotationMetadata(SimpleMetadataReader.java:55)
at org.springframework.core.type.filter.AnnotationTypeFilter.matchSelf(AnnotationTypeFilter.java:68)
at org.springframework.core.type.filter.AbstractTypeHierarchyTraversingFilter.match(AbstractTypeHierarchyTraversingFilter.java:55)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.isCandidateComponent(ClassPathScanningCandidateComponentProvider.java:224)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:182)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:201)
at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:85)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1255)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1245)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
--
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
14 years, 8 months
[Hibernate-JIRA] Created: (HHH-2295) entity-name attribute's syntax not clearly documented
by Jeremy Michael Crosbie (JIRA)
entity-name attribute's syntax not clearly documented
-----------------------------------------------------
Key: HHH-2295
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2295
Project: Hibernate3
Type: Bug
Components: documentation
Versions: 3.2.1
Environment: Windows XP/JDK 1.5/HypersonicSQL
Reporter: Jeremy Michael Crosbie
Priority: Minor
Attachments: Group.hbm.xml
Setting entity-name to a value containing a hyphen, in my case 'lender-group' causes odd behaviors seemingly only when calling get() or load(). Also in my case I am mapping a class to two different tables (attached). The first mapping has an entity name with a hyphen, the other does not. When I call load *after committing a transaction where a new entity is persisted* I get an exception (see below). The exception complains of a column called "LENDER" not existing. But once I change the entity-name to something like 'lendergroup' the problem goes away. Interestingly, the missing column complained about is the text before the hyphen, so if I name the entity 'lndr-group' it complains of a column name 'LNDR' not existing.
It almost appears if this format is assuming some sort of discriminator, but the online docs are terse when it comes to describing the entity-name field.
Exception:
org.hibernate.exception.SQLGrammarException: could not load an entity: [lender-group#G9]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1799)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:47)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:41)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:799)
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 org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
at $Proxy0.get(Unknown Source)
at com.fares.mtrac.group.GroupDaoImpl.findById(GroupDaoImpl.java:148)
at com.fares.mtrac.group.GroupDaoImplTest.testFindByIdStringCompanyType(GroupDaoImplTest.java:256)
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:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
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:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.sql.SQLException: Column not found: LENDER in statement [select lender-gro0_.group_cd as group1_48_0_, lender-gro0_.group_nm as group2_48_0_, lender-gro0_.user_nm as user3_48_0_ from lender_group_name lender-gro0_ where lender-gro0_.group_cd=?]
at org.hsqldb.jdbc.Util.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:442)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:368)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:105)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1785)
... 36 more
--
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
14 years, 8 months
[Hibernate-JIRA] Created: (HSEARCH-211) SharedReaderProvider: should own lock when testing for index state
by Sanne Grinovero (JIRA)
SharedReaderProvider: should own lock when testing for index state
------------------------------------------------------------------
Key: HSEARCH-211
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-211
Project: Hibernate Search
Issue Type: Bug
Components: directory provider
Reporter: Sanne Grinovero
Developing a new IndexReader I made a stress-test to compare performance to base readers, but got this when measuring SharedReaderProvider:
Exception in thread "pool-2-thread-13" org.apache.lucene.store.AlreadyClosedException: this IndexReader is closed
at org.apache.lucene.index.IndexReader.ensureOpen(IndexReader.java:163)
at org.apache.lucene.index.DirectoryIndexReader.isCurrent(DirectoryIndexReader.java:149)
at org.hibernate.search.reader.SharedReaderProvider.openReader(SharedReaderProvider.java:83)
at org.hibernate.search.query.FullTextQueryImpl.buildSearcher(FullTextQueryImpl.java:486)
at org.hibernate.search.query.FullTextQueryImpl.getResultSize(FullTextQueryImpl.java:528)
at org.hibernate.search.test.reader.performance.SearchActivity.doAction(SearchActivity.java:24)
at org.hibernate.search.test.reader.performance.AbstractActivity.run(AbstractActivity.java:54)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
--
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
14 years, 8 months