[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5964) IllegalArgumentException (Parameter value ... was not matching type ...) for JPA-Query: Worked with 3.3.1.GA

Sebastian Hasait (JIRA) noreply at atlassian.com
Fri Feb 25 10:31:08 EST 2011


IllegalArgumentException (Parameter value ... was not matching type ...) for JPA-Query: Worked with 3.3.1.GA
------------------------------------------------------------------------------------------------------------

                 Key: HHH-5964
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5964
             Project: Hibernate Core
          Issue Type: Bug
          Components: entity-manager
    Affects Versions: 3.6.1
            Reporter: Sebastian Hasait


We have switched from core-3.3.1.GA and entity-manager-3.4.0.GA to 3.6.1.Final.

Now some queries stopped working.
This is caused by an additional type check in org.hibernate.ejb.AbstractQueryImpl#registerParameterBinding at 359 which does not care about hibernate-proxies. This method is called from QueryImpl#setParameter(...). This call doesn't exist in 3.4.0.GA.

I think the proxies should be as transparent as possible. So if I get a proxy from some relation getter and put this into a query as parameter, there should be no exception.

Because the proxy cannot know the concrete type without initializing the proxy-target (reading discriminator from database) there remain four solutions:
1.) Hibernate is not checking the type for proxies OR only ensures expected type and proxy-type are related.
2.) Hibernate initializes the parameter and the type checking works without exception.
3.) Our DAO initializes the parameter before passing.
4.) We rewrite our queries to pass only the PK

I would prefer 1 or 2. :-)

Will attach test case asap.

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