Re: Testing Spring + Cayenne Integration / Architectural Doubts

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Jan 18 2005 - 12:49:28 EST

  • Next message: Andrus Adamchik: "Re: Debugging Faults"

    Hello!

    > The only hard problem I had was to implement a Servlet
    > Filter to bind DataContexts to the ThreadLocal.

    You can use an example from Cayenne Pet Store bundled with the preview
    integration. It does just that.

    Now Spring architecture...

    I am not a big expert in Spring either and haven't looked at Equinox or
    AppFuse. But I like Spring a lot. Though not necessarily for all the
    advertised reasons. For all of its cool stuff I noticed that it tends to
    encourage people to build features into their business applications that
    they don't need... just becase they can. (I am not referring to your case
    as I don't know enough about it, besides it seems like the bigger the
    system the bigger the value that Spring can provide)

    Anyway... why is extending a framework class so bad? Because some guy on
    TSS said so? This is his opinion/preference. Even if you think that at
    some point in the future you want to migrate from Cayenne to something
    else, you can still do it "with an ant script". Actually you can even use
    cgen Ant task to regenerate your _* classes to extend something else. Or
    use a common superclass from the beginning, e.g. MyPersistentObject
    extends CayenneDataObject. Then if you switch the framework you just
    change this one class's superclass.

    > make all Businness Model as interfaces,
    > and each ORM provide the classes with its own features and
    > implement the Model interfaces

    This is a possible solution, but I think it is an overkill. I guarantee
    you you will spend more time implementing that compared to any future
    migration from Cayenne.

    > Is there a easy and elegant strategy in Cayenne to convert
    > DataObjects to simple POJO's? (something like attach/deattach
    > objects/entities).

    I am actually thinking of providing POJO DataObjects at some point as this
    seems to be a big marketing point these days. But please note that the
    main benefit of Cayenne (unlike some other ORM) is that you don't have to
    attach/detach anything! An associtaion of a DataObject with DataConext is
    what gives you this smooth ride with relationships, faults and other
    performance and usability features.

    Hope this didn't sound too much like propaganda :-) I am convinced that
    your goal of keeping all layers above DAO independent from the ORM
    implementation is actually achievable.

    Cheers
    Andrus



    This archive was generated by hypermail 2.0.0 : Tue Jan 18 2005 - 12:49:30 EST