[Hibernate-JIRA] Created: (HHH-6747) ClassCastException when rendering SimpleCaseExpression
by Anne Buit (JIRA)
ClassCastException when rendering SimpleCaseExpression
------------------------------------------------------
Key: HHH-6747
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6747
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.6.7
Environment: SQL Server 2005
Reporter: Anne Buit
Priority: Minor
Attachments: SimpleCase.zip
When creating a SimpleCase using CriteriaBuilder.selectCase(Expression<?> arg0), a classcast exception will be thrown when the query is rendered to a TypedQuery.
CriteriaQuery<Customer> query = builder.createQuery(Customer.class);
Root<Customer> root = query.from(Customer.class);
query.select(root);
SimpleCase<String, Integer> orderCase = builder.selectCase(root.get(Customer_.EMail));
orderCase = orderCase.when("test(a)test.com", 1);
orderCase = orderCase.when("test2(a)test.com", 2);
query.orderBy(builder.asc(orderCase.otherwise(0)));
em.createQuery(query);
Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to org.hibernate.ejb.criteria.Renderable
at org.hibernate.ejb.criteria.expression.SimpleCaseExpression.render(SimpleCaseExpression.java:146)
at org.hibernate.ejb.criteria.CriteriaQueryImpl.render(CriteriaQueryImpl.java:346)
at org.hibernate.ejb.criteria.CriteriaQueryCompiler.compile(CriteriaQueryCompiler.java:223)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:441)
See attachement for a reproduction project.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years
[Hibernate-JIRA] Created: (HHH-3129) Null Role in PersitentCollection during a onCollectionRecreate() in an Interceptor
by Jose CHILLAN (JIRA)
Null Role in PersitentCollection during a onCollectionRecreate() in an Interceptor
----------------------------------------------------------------------------------
Key: HHH-3129
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3129
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.6
Environment: Any
Reporter: Jose CHILLAN
When the "onCollectionRecreate" is invoked on an Interceptor, the getRole() method returns null. After investigation,
the problem is located in the class CollectionEntry in one of its constructors and is easily solved using the patch :
public CollectionEntry(CollectionPersister persister, PersistentCollection collection)
{
// new collections that get found + wrapped
// during flush shouldn't be ignored
ignore = false;
collection.clearDirty(); //a newly wrapped collection is NOT dirty (or we get unnecessary version updates)
snapshot = persister.isMutable() ? collection.getSnapshot(persister) : null;
// -- ADDED LINE HERE --
role = persister.getRole();
collection.setSnapshot(loadedKey, role, snapshot);
}
Thanks
--
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
12 years