Re: Linking two unregistered CayenneDataObjects

From: Gili (cowwo..bs.darktech.org)
Date: Fri Sep 09 2005 - 00:28:12 EDT

  • Next message: Gili: "Re: Util.unwindException()"

            Looking at http://objectstyle.org/confluence/display/CAY/ObjectContext
    it looks like you're going half-way between Cayenne's current design and
    Hibernate's by injecting ValueHolder into user classes. In Hibernate,
    your POJOs are free of any Hibernate code; they only inject their code
    at runtime. I've dealt class rewriters in the past. For the most part I
    would suggest avoiding them if possible. They are a pain to use and make
    your code harder to maintain, though they definately have their uses.

            One thing I think the current Cayenne design does not provide (nor the
    new one you are proposing) is the ability to control the relationship
    queries. In your "List Property" example in the Wiki page, how would I
    specify the query settings getEmployees() should use? For example, say I
    wanted to set the page size to 10 records or fetchLimit to 50? I bring
    this up because my application requires this level of tweaking in a few
    places and I had to fall back on constructing queries manually. I could
    do the same in Cayenne but it defeats the whole point of the POJO
    design. Hibernate's POJO design works very well for simple stuff. As
    soon as you want to do some more serious performance tweaking it gets ugly.

    Gili

    Andrus Adamchik wrote:
    > Good that you mentioned that. I know very little about Hibernate, so it
    > is enlightening.
    >
    > My current design work mainly directed to move CayenneDataObject
    > functionality inside the framework to make a complex superclass
    > unneeded. As Java (rightfully IMO) doesn't support multiple
    > inheritance, having a framework superclass scares many ppl.
    >
    > Otherwise the new design doesn't sacrifice a single CayenneDataObject
    > feature. Things are just done differently under the hood. Relationships
    > still have to be done via a level of indirection (ValueHolder for
    > to-one and good old List for to-many), so Cayenne is still able to
    > "inject" relationship behavior:
    >
    > http://objectstyle.org/confluence/display/CAY/ObjectContext
    >
    > Andrus
    >
    >
    >
    > On Sep 8, 2005, at 11:53 PM, Gili wrote:
    >
    >> This is one of those few moments where my Hibernate background
    >> can finally come in useful. As you well know, Hibernate revolves
    >> around POJO objects. Everyone seems to think this is a good thing,
    >> except me :) POJO objects, in theory, sound great. The problem is
    >> that with transparency you lose flexibility. Database rows are not
    >> really Java objects and when you pretend they are you end up with a
    >> lot of abstraction leaks.
    >>
    >> For example, when I invoke getFooArray() to get at a
    >> relationship, I might want to tweak the performance by declaring the
    >> page size, fetch limit, etc. So my point is this... feel free to move
    >> toward POJO but please ensure that it is still possible to tweak
    >> these performance settings on such "transparent queries". Hibernate's
    >> weakness is that it is not possible to use transparent
    >> attributes/relationships while tweaking their query settings.
    >>
    >> Also ... if you use it long enough you find out that you *still*
    >> need to wrap their so-called POJOs with a second level of objects.
    >> Hibernate forces you to expose many DB-specific operations (setters
    >> mostly) that end-users should not have access to. So either way you
    >> end up wrapping your first DB-access objects with a 2nd layer of
    >> user-accessible classes. That's why I prefer Cayenne. There is no
    >> disillusion about what DataObject is. It's meant to be a DB object
    >> with full accessibility to all its settings and wrapping it up in a
    >> 2nd level object is fairly easy to do. No frustration there.
    >
    >
    >

    -- 
    http://www.desktopbeautifier.com/
    



    This archive was generated by hypermail 2.0.0 : Fri Sep 09 2005 - 00:28:13 EDT