[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3828) Criteria: Restriction whith class does not work
Strong Liu (JIRA)
noreply at atlassian.com
Wed Jan 27 18:08:30 EST 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3828?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=35387#action_35387 ]
Strong Liu commented on HHH-3828:
---------------------------------
sorry, should be "patch applied" :)
> 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
> Assignee: Strong Liu
> Fix For: 3.5.0-Beta-4
>
> 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: 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