commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 34212] New: - No way to resolve proxied objects
Date Mon, 28 Mar 2005 21:15:29 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34212>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34212

           Summary: No way to resolve proxied objects
           Product: Commons
           Version: unspecified
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Betwixt
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: mattinger@yahoo.com


I have a small problem while using betwixt.  We are using hibernate to 
retrieve/store objects to the database.  However, hibernate uses cglib to put 
dynamic proxies around lazily loaded objects.  Even when these objects are 
fetched, the proxy still remains.  There seems no way to dynamically resolve
proxied objects into the real implementation classes using BeanWriter.  I've 
seen the ClassNormalizer on the Configuration object, and I'd like the same 
capability on the BeanWriter:

public interface BeanNormalizer {
    Object normalizeBean(Object bean);
}

Then, i could create a class:

public class HibernateNormalizer {
    public Object normalizerBean(Object bean) {
         if (bean instanceof HibernateProxy) {
           return ((HibernateProxy)bean).getHibernateLazyInitializer().
                       getImplementation();
         }
         else {
           return bean;
         }
    }
}

I should be able to set this on any BeanWriter:

BeanWriter beanWriter = new BeanWriter(...);
beanWriter.setObjectNormalizer(new HibernateNormalizer());

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message