cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erlend Birkenes ...@dataloy.com>
Subject Re: Some more concrete questions about Cayenne
Date Thu, 19 Jan 2012 13:24:16 GMT
2012/1/18 Durchholz, Joachim <Joachim.Durchholz@hennig-fahrzeugteile.de>

> 1) Does anybody have concrete advice about using Cayenne without Modeler?
>
> Background:
> I see Modeler is one of the major sources of "huh?" moments on the list.
> It's an additional layer of abstraction between what Cayenne does and what
> the developer sees, meaning it can introduce problems (and occasionally
> does); I'd want to get my feet wet with Cayenne without that complication.
> I also see it's the one part that you actually can avoid using - the XML
> can be edited by hand.
>
>
I'm pretty new at this, but here are our experiences with this so far:

The modeler is pretty nice to work with if you don't have that many and/or
large entities, or don't need much customization, but point and click gets
old pretty fast.

We have written a simple generator to generate the .map.xml file that the
Modeler  produces. It's just a simple Java class (<400 lines) that writes
strings to the file. Writing a generator for this is very simple since
everything is in one file and you can just add all the relationships at the
bottom, no need to go back and forth between entities and stuff like that.

The reason we did this is because we maintain our own database metadata
stored in the database and we wanted to use that. (We also have almost 300
Entities, so modifying them manually in the Modeler was out of the
question.) So it was very simple for us to get all we needed from there. I
guess it's relatively simple to get this from JDBC DatabaseMetadata and use
that instead, or define it some other way.

After doing that I'm glad we did, as it gives us MUCH more control over the
whole thing. It's very simple to manipulate things, and lets us do things
like add flattened attributes on all ObjEntities so they all implement a
common interface, something that is very cumbersome in the Modeler. It's
much easier to get stuff exactly how we want them when we can program them
(after all we are programmers, not mouse clickers, right..?)

As I said, I really like the map.xml file format, which just lists the
db-entities, obj-entities, db-relationships and obj-relationships. Very
easy to generate and manipulate.
It is very poorly documented, but easy enough to figure out based on the
Schema and by experimenting in the Modeler and see what it produces.

When we have the map.xml we just use the cgen ant task to generate the
classes.

So you don't have to use the modeler, but I wouldn't recommend hand-editing.


-Erlend

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message