Hi Ralf!

It's good to know, that i was not blind or messed anything up.
Thanks for your fast answer!

Cheers,
Peter

Ralf Joachim schrieb:
Hi Peter,

I had a peek at ManyRelationResolver.load(), the place that is
responsible to create objects for many relations. It seams your
investigation is correct. When using lazy loading only Collections are
supported by Castor at the moment.

Regards
Ralf

Peter Schmidt schrieb:
Hi Werner!

What we are trying to do:

We are working on a JPA support for Castor, so we create
ClassDescriptors from JPA annotated Java classes.

We are generating the ClassDescriptors in a similar way like the
source generator does it and copied the behaviour.

Now for One to many relations, we encounter the described problem.

Debugging showed that the FieldMapping has the right collection type
("set"). But if lazy loading is used, castor tries to set the value to
a RelationCollection - which is not a Set but a Collection.

It is hard to provide more information... We will try to send you a
testcase and patch soon. Maybe that will help.

Kind regards
Peter

Werner Guttmann schrieb:
Peter,

Castor JDO does have support for lazy loading many realtions, and has
been doing so for many years. As there's quite some test cases in the
JDO CTF that test this feature, things should not be broken.

In other words, it looks like the problem might e on your side. How
about sharing details with us on what you are trying to do ?

Regards
Werner

Peter Schmidt wrote:
Hi!

Does castor support other types than Collections when using lazy
loading
on many relations?

Because as far as I can see the following happens:

A org.castor.persist.proxy.RelationCollection is created to handle the
lazy loading. That class implements Collection.

When the FieldMolder then invokes the set method (which e.g. requires a
Set or anything but a Collection), the invokation fails because of an
illegal argument (collection instead of set).

Did we get anything wrong or is this just not supported?

Thanks in advance!

Peter

Here is the stacktrace for more info:

org.exolab.castor.jdo.DataObjectAccessException: Type conversion error:
could not set value of FieldMolder for
org.castor.test.jug.Master.slaves
of type org.castor.test.jug.Slave with value of type
org.castor.persist.proxy.RelationCollection
    at
org.exolab.castor.persist.FieldMolder.setValue(FieldMolder.java:390)
    at
org.castor.persist.resolver.ManyRelationResolver.load(ManyRelationResolver.java:284)


    at org.exolab.castor.persist.ClassMolder.mold(ClassMolder.java:584)
    at org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:554)
    at org.exolab.castor.persist.LockEngine.load(LockEngine.java:343)
    at
org.castor.persist.AbstractTransactionContext.load(AbstractTransactionContext.java:569)


    at
org.castor.persist.AbstractTransactionContext.load(AbstractTransactionContext.java:432)


    at
org.exolab.castor.jdo.engine.AbstractDatabaseImpl.load(AbstractDatabaseImpl.java:267)


    at
org.exolab.castor.jdo.engine.AbstractDatabaseImpl.load(AbstractDatabaseImpl.java:225)


    at
org.castor.spring.orm.CastorTemplate$1.doInCastor(CastorTemplate.java:230)

    at
org.castor.spring.orm.CastorTemplate.execute(CastorTemplate.java:186)
    at
org.castor.spring.orm.CastorTemplate.execute(CastorTemplate.java:164)
    at
org.castor.spring.orm.CastorTemplate.load(CastorTemplate.java:228)
    at
org.castor.test.jug.dao.MasterCastorDao.getMaster(MasterCastorDao.java:13)

    at
org.castor.test.jug.dao.MasterSlaveCastorDaoTest.get(MasterSlaveCastorDaoTest.java:30)


    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)


    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)


    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:198)


    at
org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:252)


    at
org.springframework.test.context.junit4.SpringMethodRoadie$2.run(SpringMethodRoadie.java:194)


    at
org.springframework.test.context.junit4.SpringMethodRoadie.runBeforesThenTestThenAfters(SpringMethodRoadie.java:235)


    at
org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:218)


    at
org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:192)


    at
org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:140)


    at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:151)


    at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)


    at
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)


    at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)

    at
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)

    at
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)

    at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)


    at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)


    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)


    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)


    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)


    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to