[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-3828) Criteria: Restriction whith class does not work

Rico (JIRA) noreply at atlassian.com
Wed Jan 27 09:02:29 EST 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3828?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rico updated HHH-3828:
----------------------

    Attachment: HHH3828.ZIP

> 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: 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