[Hibernate-JIRA] Created: (HHH-5370) Building IN condition with CriteriaBuilder providing collection of values not working.
by bogdan (JIRA)
Building IN condition with CriteriaBuilder providing collection of values not working.
--------------------------------------------------------------------------------------
Key: HHH-5370
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5370
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.5.3
Reporter: bogdan
Building IN condition with CriteriaBuilder providing collection of values not working.
Given:
Join<CommissionPo, AreaPo> ca;
List<Long> unitAreaIds;
calling
ca.get(AreaPo_.id).in(unitAreaIds);
ends with:
java.lang.IllegalArgumentException: Unaware how to convert value [[1006, 1008, 1009, 1013, 1011, 1010, 1012] : java.util.ArrayList] to requested type [java.lang.Long]
at org.hibernate.ejb.criteria.ValueHandlerFactory.unknownConversion(ValueHandlerFactory.java:259)
at org.hibernate.ejb.criteria.ValueHandlerFactory.access$000(ValueHandlerFactory.java:35)
at org.hibernate.ejb.criteria.ValueHandlerFactory$LongValueHandler.convert(ValueHandlerFactory.java:153)
at org.hibernate.ejb.criteria.ValueHandlerFactory$LongValueHandler.convert(ValueHandlerFactory.java:140)
at org.hibernate.ejb.criteria.predicate.InPredicate.<init>(InPredicate.java:126)
at org.hibernate.ejb.criteria.predicate.InPredicate.<init>(InPredicate.java:105)
at org.hibernate.ejb.criteria.CriteriaBuilderImpl.in(CriteriaBuilderImpl.java:577)
at org.hibernate.ejb.criteria.expression.ExpressionImpl.in(ExpressionImpl.java:91)
as a workaround we can call:
ca.get(AreaPo_.id).in(unitAreaIds.toArray());
Cause (varargs missuse):
org.hibernate.ejb.criteria.expression.ExpressionImpl.in(Collection<?>)
calls
org.hibernate.ejb.criteria.CriteriaBuilderImpl.in(Expression<? extends Object>, Object...)
as result whole collection from ExpressionImpl goas as single parameter to CriteriaBuilderImpl.in
--
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, 5 months
[Hibernate-JIRA] Commented: (HHH-1673) hql parsed with exception (with clause)
by Marcin Kobylarz (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1673?page=c... ]
Marcin Kobylarz commented on HHH-1673:
--------------------------------------
Hello,
It is version 3.5.3 now and it still does not work. I think lot of programmers would be grateful if this issue was solved. I hit problem with "with" clause at least once a month. Having HQL, rewriting each troublesome query to sql is not a long term option.
I really appreciate your work, I have spent more than three years now getting know hibernate works in details, but this issue keeps coming back, so we can say that it is really important.
This is query which does not work for me:
"select cu, cup from PupilImpl p join p.participants par join par.course c join c.courseUnits cu left join cu.courseUnitPresence cup with par.id=cup.participant.id where p=:pupil"
Thank you.
> hql parsed with exception (with clause)
> ---------------------------------------
>
> Key: HHH-1673
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1673
> Project: Hibernate Core
> Issue Type: Deprecation
> Components: query-hql
> Affects Versions: 3.1.3
> Reporter: Tomasz Bech
> Attachments: HHH-1673.patch, HHH-1673.patch
>
>
> The 'improvement' bug fix: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1520
> has broken working functionality:
> I found that after switching to 3.1.3 following construction is not working any longer:
> (FootnoteTypeBO has collection 'descriptions' and reference to languageBO)
> from FootnoteTypeBO as o
> left outer join o.descriptions as t1
> with (t1.language in (select loid from LanguageBO where name = 'aa'))
> --> exception: 'with-clause referenced two different from-clause elements'.
> There is no implicit join as dewscribed in main anomaly, so it shouldn't cause the problem. So now there is no way to write correct hql/sql, and I don't see any workaround.
--
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, 5 months