History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: EJB-38
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Vance Karimi
Reporter: Sverker Abrahamsson
Votes: (View)
Watchers: (View)
Operations

If you were logged in you would be able to see more operations.
EJB Cartridge

Query with enum type fails

Created: 03/Jul/06 01:40 PM   Updated: 04/Jul/06 09:50 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. Text File DaoBase.vsl.patch (2 kb)



 Description   
A query including a enum type attribute fails with the following stacktrace:

Caused by: java.lang.ClassCastException: java.lang.String
        at org.hibernate.type.EnumType.nullSafeSet(EnumType.java:125)
        at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:155)
        at org.hibernate.loader.hql.QueryLoader.bindNamedParameters(QueryLoader.
java:515)
        at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1577)
        at org.hibernate.loader.Loader.doQuery(Loader.java:661)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
ader.java:224)
        at org.hibernate.loader.Loader.doList(Loader.java:2145)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
        at org.hibernate.loader.Loader.list(Loader.java:2024)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:392)
        at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.ja
va:333)
        at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java
:172)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
        at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:53)
        at se.broaden.portal.t2.ChannelDaoBase.findByRegion(ChannelDaoBase.java:
468)
        at se.broaden.portal.t2.ChannelDaoBase.findByRegion(ChannelDaoBase.java:
445)
....


 All   Comments   Change History      Sort Order:
Comment by Sverker Abrahamsson [03/Jul/06 01:44 PM]
This patch solves the problem. The query parameter has to be set with the enum class, not it's value.

Comment by Vance Karimi [04/Jul/06 09:50 AM]
Fix in CVS. Thanks Sverker.