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.