Criteria: Restriction whith class does not work
-----------------------------------------------
Key: HHH-3828
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3828
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.3.1
Environment: Oracle, HSQLDB
Reporter: Kai PrĂ¼nte
Attachments: HHH3828.ZIP
The following line does not work:
Restrictions.eq("class", Bike.class)
because
SingleTableEntityPersister.getDiscriminatorSQLValue()
returns the discriminator value quoted with single quotes. However JDBC needs the string
without quotes.
Workaround:
Restrictions.eq("class", Bike.class.getName())
This works fine for the default discriminator values
Patch in CriteriaQueryTranslator.getTypedValue(Criteria subcriteria, String propertyName,
Object value):
if(stringValue != null && stringValue.length() > 2 &&
stringValue.startsWith("'") &&
stringValue.endsWith("'") ) {
// remove the single quotes
stringValue = stringValue.substring(1, stringValue.length() - 1);
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: