Reputation: 879
I'm trying to adapt a legacy database to a grails application and I'm not sure how can I do it on grails. I have a huge table (with columns colA, colB, ..., colZ) that I only want to map some of them as fields (say colA, colC, colE) like a database view, this domain class is intended to be read-only so it would not be a problem to not have the save, update and delete operations.
How should I create my domain class?
EDIT
I need to adapt a query to a domain object, this query has a lot of group by expressions (max, min, count, etc.) and I would like to adapt this query so that everytime I call DomainObj.list() Grails would run this query and load all the data from the database within the GORM proxy.
Upvotes: 4
Views: 2413
Reputation: 820
If it is read only, just create a domain object containing the fields you are interested in. That should be no problem.
Remember however that GORM will create a "version" column as default, but this can be disabled:
static mapping = {
table 'people'
version false
}
Upvotes: 4