>>> Just to make sure I understand the problem, the proxy classes have >>> extra get methods that return objects you don't want to >>marshal? And >>> since Castor validates the mapping file against the real >>classes, not >>> the proxy classes, marking the "field" as transient causes a >>> MappingException?
Yes, the exception is thrown indicating that the field I'm trying to mark transient doesn't exist in the Class I'm mapping. >>The problem that Paul has, and others had before, is that Castor calls >>getClass().getName() on every object it have to marshal. As >>this call does not return the name of the original calls but >>the one of the proxy (e.g. A$$ProxiedByCGLIB) Castor is not >>able to find the right mapping and uses intorspection >>instead. Introspection also finds the hidden interface >>methods and tries to marshal their result. Correct. Actually it does contain all my original methods names, and presumably Castor would marshall them. The real problem as you point out is that it "also" finds the hidden interface methods and tries to marshal them. That is what is killing me. >> >>The only 2 solution I can see are: >> >>1. test for the hidden interfaces with instanceof. as this >>would require us to rever to a class of hibernate I'll refuse that. I agree, not sure how this would work. not sure how you can really tell, but I don't think that is the way to go. >>2. test if getClass().getName() includes 'CGLIB'. if that's true call >>getClass().getSuperClass().getName() instead and use this one >>to search for a mapping. This may work. For the record the name of the class at runtime is "[EMAIL PROTECTED]" so it does indeed contain CGLIB. I added some code to dump the super class's methods and the real class was the superclass and only the needed methods, showed up. So this would work, in this case. I don't know how you feel about it. I can't see that anybody would be wanting to marshal internal CGLIB attributes. I also don't know whether CGLIB might show up in more than one level. So, the above suggestion may want to insure you keep looking ... ------------------------------------------------- If you wish to unsubscribe from this list, please send an empty message to the following address: [EMAIL PROTECTED] -------------------------------------------------

