[Hibernate-JIRA] Commented: (HHH-1830) Error during parse query on MS SQL
by Wadi Ernesto Jalil Maluf (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830?page=c... ]
Wadi Ernesto Jalil Maluf commented on HHH-1830:
-----------------------------------------------
Hi All, I'm having the same problem, I would like to know if it's related with the anotations or not, so I could have a workaround. May I do something to speed up things? May be someone can point me where to look on the code?I need to fix ASAP so if there is anything I can do, please feel free to contact me,
Thanks in advance,
Regards,
Wadi
> Error during parse query on MS SQL
> ----------------------------------
>
> Key: HHH-1830
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830
> Project: Hibernate3
> Issue Type: Bug
> Affects 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
> Attachments: hibernateBug.tar.gz
>
>
> 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, 1 month
[Hibernate-JIRA] Created: (EJB-335) Polymorphic delete fails while creating a temp table
by Heiko W. Rupp (JIRA)
Polymorphic delete fails while creating a temp table
----------------------------------------------------
Key: EJB-335
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-335
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.2.1
Environment: Postgres 8.3, hibernate hibernate 3.2 from rev 14201
Reporter: Heiko W. Rupp
We have an Entity
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
MeasurementData {
@EmbeddedId
MeasurementDataPK id;
@JoinColumn(name = "SCHEDULE_ID", insertable = false, updatable = false)
@ManyToOne(fetch = FetchType.LAZY)
Schedule schedule;
..
}
and Subclasses:
MeasurementDataNum(_1h,_6h,..) extends MeasurementData {
Double value;
}
MeasurementDataTrait extends MeasurementData {
String value;
}
A bulk delete "DELETE FROM MeasurementData md WHERE md.schedule IN (:schedules ) "
fails with
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not insert/select ids for bulk delete
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:57)
Postgres 8.3 complains about the following SQL:
ERROR: UNION types double precision and character varying cannot be matched
insert into HT_MeasurementData
select measuremen0_.TIME_STAMP as TIME_STAMP, measuremen0_.SCHEDULE_ID as SCHEDULE_ID
from (
select value, maxvalue, SCHEDULE_ID, TIME_STAMP, minvalue, 1 as clazz_
from MEASUREMENT_DATA_NUM_1D
union all
select value, maxvalue, SCHEDULE_ID, TIME_STAMP, minvalue,
2 as clazz_
from MEASUREMENT_DATA_NUM_1H
union all
select value, maxvalue, SCHEDULE_ID, TIME_STAMP,
minvalue, 3 as clazz_
from MEASUREMENT_DATA_NUM_6H
union all
select value, null::float8 as maxvalue, SCHEDULE_ID, TIME_STAMP, null::float8 as minvalue, 4 as clazz_
from RHQ_MEASUREMENT_DATA_TRAIT
) measuremen0_
where SCHEDULE_ID in ($1 , $2 , $3)
So basically it creates a column for "value" and tries to insert strings and doubles into it.
The "obvious" :-) solution would be only to insert the timestamp and schedule id into the table and not the value and other stuff that is not needed to identify the items to delete.
--
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, 1 month