cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Malcolm Edgar" <>
Subject Cayenne and Adobe Flex Data Services
Date Thu, 10 Aug 2006 05:34:52 GMT
Hi All,

I am trying to intregrate Cayenne with Adobe Flex Data Services. I am
finding a nasty compatability problem between the 2 framework designs.

Adobe uses a POJO assembler pattern when it is sent a serialize
ActionScript object graph which it then turns into a Java object
graph. When working with Cayenne objects there are problems when it is
assembling objects.

I presume it creates the data objects using reflection
class.newInstance() and then it sets properties on these object, which
may be other Cayenne objects.  Unfortunately as it has not followed
the usage Cayenne pattern of :


These objects have not DataContext and are unable to resolve their
relationships and throw NPE.

I have tried hacking a work around:

public class BaseEntity extends CayenneDataObject {
    private static final long serialVersionUID = 1L;

    public BaseEntity() {

        DataContext dataContext = null;
        try {
            dataContext = DataContext.getThreadDataContext();

        } catch (IllegalStateException ise) {
            dataContext = DataContext.createDataContext();


This works with the Adobe Data Services code, but it stuffs up the
Cayenne object validation when committing object for some reason.

org.objectstyle.cayenne.validation.ValidationException: [v.1.2 July 16
2006] Validation has failed.
Validation failure for com.avoka.eeo.entity.Submission.user: "user"
is required.
Validation failure for com.avoka.eeo.entity.Submission.type: "type"
is required.
Validation failure for com.avoka.eeo.entity.Submission.status:
"status"  is required.
	at org.objectstyle.cayenne.access.ObjectStoreGraphDiff.validateAndCheckNoop(
	at org.objectstyle.cayenne.access.DataContext.flushToParent(
	at org.objectstyle.cayenne.access.DataContext.commitChanges(
	at com.avoka.eeo.assembler.SubmissionAssemblerTestCase.testFillUsername(
	at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown
	at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown
	at junit.framework.TestCase.runTest(
	at junit.framework.TestCase.runBare(
	at junit.framework.TestResult$1.protect(
	at junit.framework.TestResult.runProtected(
	at junit.framework.TestSuite.runTest(
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(

Any suggestions would be greatly appreciated.

regards Malcolm Edgar

View raw message