Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3433

Callsite caching breaks the use of Hibernate proxies when combined with inheritance

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Won't Fix
    • 1.6
    • 1.6.2, 1.7-beta-1
    • None
    • None

    Description

      I've attached an example script that demonstrates an issue with Groovy callsite caching when combined with Hibernate proxy usage. Accessing an association of an entity that is lazily loaded with a Hibernate proxy results in an IllegalArgumentException:

       
      java.lang.IllegalArgumentException: object is not an instance of declaring class
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:585)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
      

      This has is causing this issue in Grails: http://jira.codehaus.org/browse/GRAILS-4230

      Attachments

        1. ivysettings.xml
          1 kB
          Graeme Rocher
        2. TestScript.groovy
          3 kB
          Graeme Rocher

        Activity

          People

            blackdrag Jochen Theodorou
            graemerocher Graeme Rocher
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: