Jun 20, 2008

GORM Without Grails

Using the Groovy ORM without Grails isn't very pretty, unless there's some way of getting around needing to load all your groovy code via the DefaultGrailsApplication class loader. Address that one problem and using the GORM outside of Grails becomes instantly more practical.

I can't think of a good reason** why the meta programming part of the GORM couldn't be done independently* of loading the domain objects. I'm guessing it was an arbitrary implementation detail that made it this way, or a prior Groovy limitation.

Of course, I'm taking Jeremie Weldin's code at face value, and haven't dug into the current Grails code to see for myself. The key seems to be whatever the DefaultGrailsDomainClassInjector is doing.

Do you know the answer?

* I still see the need for an initialisation step, just not one that has to dictate a particular groovy class loader.
** Well, ok, it does leave less room for error on a developers part.

No comments: