Hey Werner,
> The class ...Person$$EnhancerByCGLIB$$7166e6b7 is not
> persistence capable:
> no mapping was defined for the class
Looks like another CGLib proxy class problem. The mapping api maps
classes based on class name. The proxy is creating a modified version of
the class which in turn changes the name and Castor cannot find a mapping.
One solution to the problem is to create a dynamic mapping for the proxy
class which simply specifies that it extends the proper class such as:
<snip>
import org.exolab.castor.mapping.xml.MappingRoot;
import org.exolab.castor.mapping.xml.ClassMapping;
...
Mapping mapping = new Mapping();
mapping.loadMapping("mapping.xml");
//... get handle on proxy objects and dynamically add them to the
//... mapping file
MappingRoot root = new MappingRoot();
ClassMapping clsMap = new ClassMapping();
clsMap.setName(myProxyObj.getClass().getName());
clsMap.setExtends(myReadObj.getClass().getName());
root.addClassMapping(clsMap);
mapping.loadMapping(root);
</snip>
Of course a better solution would be to have Castor detect the proxy by
checking for "$$" in the name, but for now the above should help.
HTH,
--Keith
Werner Guttmann wrote:
Jon,
Thanks for your patience with our (non)'dealing' of
http://jira.codehaus.org/browse/CASTOR-1365. Having said that, I have never
seen below problem, and I am almost 100% sure that I shall be looking into the
original problem first.
Werner
-----Original Message-----
From: Jon Wilmoth [mailto:[EMAIL PROTECTED]
Sent: Freitag, 31. März 2006 09:06
To: user@castor.codehaus.org
Subject: [castor-user] [JDO]
ClassNotPersistenceCapableException loading independent objects
I'm trying to work around
http://jira.codehaus.org/browse/CASTOR-1365 by loading the
independent objects in the same txn prior to calling
db.create, but now I'm getting another error:
org.exolab.castor.jdo.ClassNotPersistenceCapableException:
The class ...Person$$EnhancerByCGLIB$$7166e6b7 is not
persistence capable:
no mapping was defined for the class
at
org.exolab.castor.persist.PersistenceInfoGroup.getPersistenceI
nfo(PersistenceInfoGroup.java:67)
at
org.exolab.castor.jdo.engine.DatabaseImpl.load(DatabaseImpl.java:358)
at
org.exolab.castor.jdo.engine.DatabaseImpl.load(DatabaseImpl.java:328)
at
...GolfRoundDetail.loadIndependentChildren(GolfRoundDetail.java:67)
The mapping file does indeed contain a definition for Person
and it is being loaded successfully elsewhere in the
application. Werner had mentioned there were duplicate
generated proxy classes...is this the underlying cause for
this most recent error?
Thanks,
Jon
p.s. Suggestions about how to work-around bug #1365 are
greatly appreciate!
-------------------------------------------------
If you wish to unsubscribe from this list, please send an
empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------