I have an app, with its own datasource, that needs to get "Item" objects from a different datasource, a readonly one, and use this Items and add them some attributes and collections of "Part" and "Process" objects, so I'm considering three options:
I think the easiest one is the trigger in the readonly database cause I don't see how to implement an observer with a factory to create my own objects, to implement options one or three, and I'm not sure if there's a better way, so, what would be the best way of implementing this? how could options 1 or 3 could be implemented? is there something like a "findAllFromHereThatIsntThere" Gorm method that I could call?
Thanks
Since you are using database trigger on the external database, the logic in your application is very straightforward. On your application you can have domains mapping the readonly database and domains for your local db. This will help to separating the concern for each domain. The logic for manipulating the data and storing them in your application database can be inside a transactional service.
Grails provides great features for multiple databases that can be utilized here.
Hope it helps