[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3828) Criteria: Restriction whith class does not work
Kai Prünte (JIRA)
noreply at atlassian.com
Tue Mar 24 07:48:38 EDT 2009
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
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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list