[Hibernate-JIRA] Commented: (HHH-1661) merge of a deleted object results in a insert?
by Mike Youngstrom (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1661?page=c... ]
Mike Youngstrom commented on HHH-1661:
--------------------------------------
I agree I think this is incorrect merge behaviour. The javadocs for EntityManager.merge says:
"IllegalArgumentException - if instance is not an entity or is a removed entity"
This entity is clearly "not an entity or a removed entity" I agree. I think this should not be re inserted.
Mike
> merge of a deleted object results in a insert?
> ----------------------------------------------
>
> Key: HHH-1661
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1661
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.1.3
> Environment: Hibernate 3.1.3, SQL Server
> Reporter: Tu-Thach
>
>
> A persistent object is loaded from a session and deleted, then close the session. Using that same object in another session and call merge results in the object being inserted into the database. Here's the sample code:
> Session session = factory.getCurrentSession();
> session.beginTransaction();
> MyClass obj = (MyClass)session.load(MyClass.class, new Integer(10));
> session.delete(obj);
> session.getTransaction().commit();
> session = factory.getCurrentSession();
> session.beginTransaction();
> session.merge(obj);
> session.getTransaction().commit();
> Since the object is already deleted, merge could not find it and thus proceeds with a INSERT. Shouldn't it throw an exception instead?
--
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
18 years, 2 months
[Hibernate-JIRA] Commented: (HHH-1830) Error during parse query on MS SQL
by Nicolás Lichtmaier (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830?page=c... ]
Nicolás Lichtmaier commented on HHH-1830:
-----------------------------------------
I'm debugging it to help a little. In CollectionSubqueryFactory.createCollectionSubquery() is expected that join.toWhereFragmentString() returns a string with an initial " and " (which is to be removed). But it's returning "" and the then the substring fails. In the join object, the afterWhere variable is "".
> Error during parse query on MS SQL
> ----------------------------------
>
> Key: HHH-1830
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830
> Project: Hibernate3
> Type: Bug
> Versions: 3.1.2, 3.2.0.cr2
> Environment: Microsoft SQL Server 2000, Windows XP, JDK 1.5 Update 4
> Reporter: Den Raskovalov
> Priority: Critical
>
>
> HQL: select deal, items.dateBegin, client.Title from " + CoreDeal.class.getName() + " deal left join deal.stagesWorkflowInstance.history.items items, " + CoreClient.class.getName() + " client where stageResponsible=:stageResponsible and items.index=maxindex(items) and deal.parent=client and deal.stagesWorkflowInstance.Stage.showOnPersonalPage=1
> It works normally on Oracle, but on MS SQL produces:
> Error: String index out of range: -5
> [java.lang.StringIndexOutOfBoundsException]
> java.lang.String.substring(String.java:1768)
> java.lang.String.substring(String.java:1735)
> org.hibernate.hql.CollectionSubqueryFactory.createCollectionSubquery(CollectionSubqueryFactory.java:32)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:301)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:291)
> org.hibernate.hql.ast.tree.FromElement.toColumns(FromElement.java:377)
> org.hibernate.hql.ast.tree.MethodNode.resolveCollectionProperty(MethodNode.java:115)
> org.hibernate.hql.ast.tree.MethodNode.collectionProperty(MethodNode.java:95)
> org.hibernate.hql.ast.tree.MethodNode.resolve(MethodNode.java:44)
> org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:844)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:2324)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1285)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4032)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3521)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1758)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1686)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
> org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:227)
> org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:159)
> org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
> org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
> org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
> org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1612)
> ru.naumen.crm2.bobjects.deal.CoreDealHibernateHandler.listAllDealsWithSortDataByResponsible(CoreDealHibernateHandler.java:109)
> ru.naumen.crm2.ui.tlc.CoreEmployeeTableListController.listMyDealsSorted(CoreEmployeeTableListController.java:70)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
--
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
18 years, 2 months
[Hibernate-JIRA] Commented: (HHH-1830) Error during parse query on MS SQL
by Nicolás Lichtmaier (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830?page=c... ]
Nicolás Lichtmaier commented on HHH-1830:
-----------------------------------------
I forgot to say that my HQL query was:
select s.name, sum(r.size) from Site s join s.resources r group by s.name
> Error during parse query on MS SQL
> ----------------------------------
>
> Key: HHH-1830
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830
> Project: Hibernate3
> Type: Bug
> Versions: 3.1.2, 3.2.0.cr2
> Environment: Microsoft SQL Server 2000, Windows XP, JDK 1.5 Update 4
> Reporter: Den Raskovalov
> Priority: Critical
>
>
> HQL: select deal, items.dateBegin, client.Title from " + CoreDeal.class.getName() + " deal left join deal.stagesWorkflowInstance.history.items items, " + CoreClient.class.getName() + " client where stageResponsible=:stageResponsible and items.index=maxindex(items) and deal.parent=client and deal.stagesWorkflowInstance.Stage.showOnPersonalPage=1
> It works normally on Oracle, but on MS SQL produces:
> Error: String index out of range: -5
> [java.lang.StringIndexOutOfBoundsException]
> java.lang.String.substring(String.java:1768)
> java.lang.String.substring(String.java:1735)
> org.hibernate.hql.CollectionSubqueryFactory.createCollectionSubquery(CollectionSubqueryFactory.java:32)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:301)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:291)
> org.hibernate.hql.ast.tree.FromElement.toColumns(FromElement.java:377)
> org.hibernate.hql.ast.tree.MethodNode.resolveCollectionProperty(MethodNode.java:115)
> org.hibernate.hql.ast.tree.MethodNode.collectionProperty(MethodNode.java:95)
> org.hibernate.hql.ast.tree.MethodNode.resolve(MethodNode.java:44)
> org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:844)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:2324)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1285)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4032)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3521)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1758)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1686)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
> org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:227)
> org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:159)
> org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
> org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
> org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
> org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1612)
> ru.naumen.crm2.bobjects.deal.CoreDealHibernateHandler.listAllDealsWithSortDataByResponsible(CoreDealHibernateHandler.java:109)
> ru.naumen.crm2.ui.tlc.CoreEmployeeTableListController.listMyDealsSorted(CoreEmployeeTableListController.java:70)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
--
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
18 years, 2 months
[Hibernate-JIRA] Commented: (HHH-1830) Error during parse query on MS SQL
by Nicolás Lichtmaier (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830?page=c... ]
Nicolás Lichtmaier commented on HHH-1830:
-----------------------------------------
I'm seeing this in PostgreSQL:
java.lang.StringIndexOutOfBoundsException: String index out of range: -5
at java.lang.String.substring(String.java:1938)
at java.lang.String.substring(String.java:1905)
at org.hibernate.hql.CollectionSubqueryFactory.createCollectionSubquery(CollectionSubqueryFactory.java:32)
at org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:301)
at org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:291)
at org.hibernate.hql.ast.tree.FromElement.toColumns(FromElement.java:377)
at org.hibernate.hql.ast.tree.DotNode.getColumns(DotNode.java:97)
at org.hibernate.hql.ast.tree.DotNode.initText(DotNode.java:210)
at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:204)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:94)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:90)
at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:735)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1216)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.aggregateExpr(HqlSqlBaseWalker.java:2898)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:2346)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:1963)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:1825)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1394)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:553)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:589)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
at $Proxy26.createQuery(Unknown Source)
at org.apache.jsp.admin.index_jsp._jspService(index_jsp.java:86)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:619)
So the problem doesn't to be MS SQL Server specific. I'm using Hibernate 3.2 cr 4.
> Error during parse query on MS SQL
> ----------------------------------
>
> Key: HHH-1830
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830
> Project: Hibernate3
> Type: Bug
> Versions: 3.1.2, 3.2.0.cr2
> Environment: Microsoft SQL Server 2000, Windows XP, JDK 1.5 Update 4
> Reporter: Den Raskovalov
> Priority: Critical
>
>
> HQL: select deal, items.dateBegin, client.Title from " + CoreDeal.class.getName() + " deal left join deal.stagesWorkflowInstance.history.items items, " + CoreClient.class.getName() + " client where stageResponsible=:stageResponsible and items.index=maxindex(items) and deal.parent=client and deal.stagesWorkflowInstance.Stage.showOnPersonalPage=1
> It works normally on Oracle, but on MS SQL produces:
> Error: String index out of range: -5
> [java.lang.StringIndexOutOfBoundsException]
> java.lang.String.substring(String.java:1768)
> java.lang.String.substring(String.java:1735)
> org.hibernate.hql.CollectionSubqueryFactory.createCollectionSubquery(CollectionSubqueryFactory.java:32)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:301)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:291)
> org.hibernate.hql.ast.tree.FromElement.toColumns(FromElement.java:377)
> org.hibernate.hql.ast.tree.MethodNode.resolveCollectionProperty(MethodNode.java:115)
> org.hibernate.hql.ast.tree.MethodNode.collectionProperty(MethodNode.java:95)
> org.hibernate.hql.ast.tree.MethodNode.resolve(MethodNode.java:44)
> org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:844)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:2324)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1285)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4032)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3521)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1758)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1686)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
> org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:227)
> org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:159)
> org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
> org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
> org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
> org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1612)
> ru.naumen.crm2.bobjects.deal.CoreDealHibernateHandler.listAllDealsWithSortDataByResponsible(CoreDealHibernateHandler.java:109)
> ru.naumen.crm2.ui.tlc.CoreEmployeeTableListController.listMyDealsSorted(CoreEmployeeTableListController.java:70)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
--
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
18 years, 2 months
[Hibernate-JIRA] Updated: (HHH-1774) Wrong SQL generated from a composite-id HQL.
by Anthony Patricio (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774?page=all ]
Anthony Patricio updated HHH-1774:
----------------------------------
Version: 3.2.0.cr4
3.2.0.cr3
Priority: Major (was: Blocker)
> Wrong SQL generated from a composite-id HQL.
> --------------------------------------------
>
> Key: HHH-1774
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Versions: 3.2.0.cr3, 3.2.0.cr4, 3.1.3, 3.2.0 cr1, 3.2.0.cr2
> Environment: Hibernate 3.1.3 / 3.2.0 cr1 / 3.2.9 cr2
> Database: PostgreSQL 8.0 and Oracle 7.3.4
> Reporter: Regis Pires Magalhaes
> Attachments: CompositeIdTest.java
>
>
> Hibernate is generating a wrong SQL related to a composite-id HQL.
> The details of the problem are described below...
> MAPPING:
> <hibernate-mapping>
> <class name="Cobrador" table="cobrador">
> <composite-id name="id" class="CobradorId">
> <key-property name="empresa"/>
> <key-property name="matricula"/>
> </composite-id>
> <property name="nome" type="string"/>
> </class>
> </hibernate-mapping>
> HQL:
> from Cobrador cobrador
> where cobrador = :cobrador
> GENERATED SQL:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=?
> PARAMETERS BINDING:
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1' to parameter: 1
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1234' to parameter: 2
> Note that 2 parameters are binded, but there is just a single parameter in the generated SQL.
> DATABASE EXCEPTION:
> org.postgresql.util.PSQLException: The column index is out of range: 2, number of columns: 1
> The generated SQL should be:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=(?, ?)
--
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
18 years, 2 months
[Hibernate-JIRA] Updated: (HHH-1774) Wrong SQL generated from a composite-id HQL.
by Anthony Patricio (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774?page=all ]
Anthony Patricio updated HHH-1774:
----------------------------------
Attachment: CompositeIdTest.java
> Wrong SQL generated from a composite-id HQL.
> --------------------------------------------
>
> Key: HHH-1774
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2
> Environment: Hibernate 3.1.3 / 3.2.0 cr1 / 3.2.9 cr2
> Database: PostgreSQL 8.0 and Oracle 7.3.4
> Reporter: Regis Pires Magalhaes
> Priority: Blocker
> Attachments: CompositeIdTest.java
>
>
> Hibernate is generating a wrong SQL related to a composite-id HQL.
> The details of the problem are described below...
> MAPPING:
> <hibernate-mapping>
> <class name="Cobrador" table="cobrador">
> <composite-id name="id" class="CobradorId">
> <key-property name="empresa"/>
> <key-property name="matricula"/>
> </composite-id>
> <property name="nome" type="string"/>
> </class>
> </hibernate-mapping>
> HQL:
> from Cobrador cobrador
> where cobrador = :cobrador
> GENERATED SQL:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=?
> PARAMETERS BINDING:
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1' to parameter: 1
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1234' to parameter: 2
> Note that 2 parameters are binded, but there is just a single parameter in the generated SQL.
> DATABASE EXCEPTION:
> org.postgresql.util.PSQLException: The column index is out of range: 2, number of columns: 1
> The generated SQL should be:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=(?, ?)
--
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
18 years, 2 months
[Hibernate-JIRA] Commented: (HHH-1774) Wrong SQL generated from a composite-id HQL.
by Anthony Patricio (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774?page=c... ]
Anthony Patricio commented on HHH-1774:
---------------------------------------
for an HQL query like
from Entity e where e.id = :id
3.2 CR4 works fine.
BUT if you add a restriction like
from Entity e where e.id = :id and e.somethingElse = :anotherParam
it fails, bind parameters indexes are wrong.
i've completed the Hibernate test with this code which fails.
s = openSession();
t = s.beginTransaction();
Query q = s.createQuery("from Order o where o.id = :id and o.customer.name =:name ");
q.setParameter("name",o.getCustomer().getName());
q.setParameter("id",o.getId());
assertEquals(q.list().size(),1);
t.commit();
s.close();
i've attached the class, just update cvs with it package org.hibernate.test.cid.
> Wrong SQL generated from a composite-id HQL.
> --------------------------------------------
>
> Key: HHH-1774
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2
> Environment: Hibernate 3.1.3 / 3.2.0 cr1 / 3.2.9 cr2
> Database: PostgreSQL 8.0 and Oracle 7.3.4
> Reporter: Regis Pires Magalhaes
> Priority: Blocker
>
>
> Hibernate is generating a wrong SQL related to a composite-id HQL.
> The details of the problem are described below...
> MAPPING:
> <hibernate-mapping>
> <class name="Cobrador" table="cobrador">
> <composite-id name="id" class="CobradorId">
> <key-property name="empresa"/>
> <key-property name="matricula"/>
> </composite-id>
> <property name="nome" type="string"/>
> </class>
> </hibernate-mapping>
> HQL:
> from Cobrador cobrador
> where cobrador = :cobrador
> GENERATED SQL:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=?
> PARAMETERS BINDING:
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1' to parameter: 1
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1234' to parameter: 2
> Note that 2 parameters are binded, but there is just a single parameter in the generated SQL.
> DATABASE EXCEPTION:
> org.postgresql.util.PSQLException: The column index is out of range: 2, number of columns: 1
> The generated SQL should be:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=(?, ?)
--
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
18 years, 2 months