[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6546) Properties annotated with ColumnTransformer will force table scans when included in where clauses

James K (JIRA) noreply at atlassian.com
Thu Aug 4 15:45:03 EDT 2011


Properties annotated with ColumnTransformer will force table scans when included in where clauses
-------------------------------------------------------------------------------------------------

                 Key: HHH-6546
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6546
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.6.5
         Environment: Hibernate 3.6.5
MySQL 5.1.52
            Reporter: James K


I have a column annotated with a ColumnTransformer as such:

{code}
    @ColumnTransformer(read = "AES_DECRYPT(UNHEX(secret), 'password')", write = "HEX(AES_ENCRYPT(?, 'password'))")
    private String secret;
{code}


If I use this column in a query then the following where predicate is generated:

{code}
where AES_DECRYPT(UNHEX(webuser0_.secret), 'password')=?
{code}

This where is guaranteed to run a full table scan and execute the decrypt & hex functions on every column.

It would be better if the generated SQL were as follows:
{code}
where webuser0_.secret=HEX(AES_ENCRYPT(?, 'password'))
{code}



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list