I would just like to revisit this topic again if you don't mind.
I've been having problems with solving this particular scenario: You
run the app, create your dynamic domains. However, the application is
turned off/shut down. Once the app restarts, since there are no
physical files representing the domains and the dynamic classes are
stored "in memory", the dynamic domain classes are lost (evident when
I get the list of domain classes registered to grailsApplication). So,
I need a way to reload them upon the app's startup sequence.
Now, as a workaround I found 2 possible approaches:
1. I decided to store the actual string containing the domain classes
and recompile/reload them. However, if, let's say, we have 1,000
domain classes and you decide to recompile/reload them, that's pretty
expensive; what more if you have 1 million. Also, if there are
dependencies (e.g. 1 domain class is a "child" of another domain
class, the child must be compiled first, etc.), then I would need to
resolve those first :(
2. Save the domain's class file and reload when the app starts.
However, although I think that this is more ideal, I'm running into a
lot of trouble when I try using the domain's properties (e.g. dynamic
functions)... even something as simple as .save() would lead to errors
concerning "entity not found" etc. (hinting about probable hibernate
issues?).
Now, I'm kinda lost on how to proceed... can you suggest where I can
go from here?
Thanks and regards,
callie
Is belongsTo supported? I noticed that when I tried the demo.gsp with
1 class having the hasMany mapping and the other has belongsTo, an
error was thrown. We seem to need the belongsTo functionality at this
point so we were wondering if there's a way to get the parent class
without the belongsTo association.
Thanks!
On Nov 23, 2:44 pm, Chee Kin Lim <limchee...@vobject.com> wrote:
> Hi Callie,
>
> As you said, if your application have millions dynamic domain classes, you
> may run into scalability issue.
>
> My solution is load all dynamic domain classes which stored in database
> upon application start-up. If there is any update or new domain classes
> created subsequently, it will load by a scheduler that run in background
> periodically.
>
> You can see the application of idea above in the Grails Form Builder plugin
> athttp://code.google.com/p/grails-form-builder-plugin/
On Dec 13, 4:00 pm, Chee Kin Lim <limchee...@vobject.com> wrote:
> You're welcome!
>
> Thanks for reporting this issue, please create an issue athttp://code.google.com/p/grails-dynamic-domain-class-plugin/issues/list