I use a combination of hibernate and castor. I have both hibernate and castor xdoclet tags and generate both hibernate and castor mapping files, etc. There are no issues that I know of in doing this. The fact that castor proxies the objects is essentially invisible to hibernate.
-----Original Message----- From: Ralf Joachim [mailto:[EMAIL PROTECTED] Sent: Thursday, May 05, 2005 7:03 PM To: [email protected] Subject: Re: [castor-user] Marshalling Hibernate Objects with Castor Hi Matias, what you get is not a subclass of Category. Instead it looks like hibernate returns a proxy to a Category that is constructed by using cglib. Ralf [EMAIL PROTECTED] schrieb: >I have a class like this: > >class Category { > >public Long getId(); >public void setId(); >public String getName(); >public void setName(); > >} > >I want to marshal it, so I use Castor (Marshal.marshal(myCategory, >out)) and get > ><category> ><id>x</id> ><name>y</name> ></category> > >However I'm also using Hibernate in the persistence layer, so when I >fetch a Category from the database and then try the same.. I get a lot >of exceptions from Hibernate. > >I printed the class name of the "Category" object fetched from the >database, and is something like Category$$CGLIB$ef0ob$. So Hibernate is >actually returning an object of a subclass of Category, with some >getters added, that cause the problem. > >I thought a solution was using a mapping file, but my problem is that I >don't know the name of the class I want to marshall, I only know it's a >subclass of Category. > >So > ><mapping> > <class name="Category"> > </class> ></mapping> > > >doesn't work. > >Is there any way to do this? > >Thanks, > >Matias. > > >

