Cayenne stack is completely dynamic. Nothing is precompiled, enhanced or proxied, unlike Hibernate. There is a metadata cache that will need to get updated, but that can be done without a restart. So you can create mapping dynamically even in Java:
http://cayenne.apache.org/doc30/generic-persistent-class.html
Can't provide the Groovy details, but I would imagine that for each updated class, you'll need to create ObjEntity / DbEntity pair (simple metadata objects) and insert them in a DataMap (a collection of entities). That should be it (as long as the DB already has a table matching that class).
Another relevant thing is to look at the structure of the Java classes generated by Cayenne (via Modeler, Ant or Maven ... e.g. check Cayenne Quick Start tutorial). Special structure of the get/set methods and a common superclass is what allows us to avoid compilation/enhancement/proxying mentioned above. And of course you can use generic setters/getters from any class per link above.
Andrus
On Oct 20, 2010, at 9:43 PM, caden whitaker wrote:
> So I've been sending out the same question all over the internets, hopefully
> those of you that have seen my question are not entirely sick of me by now.
> Here's my conundrum:
>
> I'd like to have my groovy files be compiled on the fly and then sent to the
> ORM, the ORM would then compile and do all the necessary database work. This
> sounds like a no-go in Hibernate. Here is a thread related specificly to
> hibernate, with a good example of what it would look like:
>
> http://www.coderanch.com/t/513878/ORM/java/Hibernate-Dynamic-Groovy-Class-even
>
> Using Cayenne, could I have my groovy files compile, then feed their
> structrual data (somehow) to Cayenne, then have Cayenne initialize, then if
> I change a groovy file I could tell the whole process to start over? Is
> dynamic loading/reloading supported in Cayenne? is there a good example in
> java code on how this might work?
>
> Any help would be really appreciated. My head hurts from the constant
> banging.
This archive was generated by hypermail 2.0.0 : Wed Oct 20 2010 - 19:04:52 UTC