I have Property and PropertyDetail Domain Classes.
For now, I am storing images in the database.
Long-term, I am going to look at using Amazon S3 for storing images, but for a personal project where I am still learning, it seems like a decent compromise.
class PropertyDetail { static constraints = { description type: 'text' } static belongsTo = [property : Property] String description byte[] imageMain byte[] image1 byte[] image2 byte[] image3 byte[] image4 byte[] image5 }
I am going to have a list page for Property domain class.
I definitely do not want to take the hit of pulling the PropertyDetail class, not with the images stored in the database.
I hit a wall late evening, when I discovered the following Jira Issue: GRAILS-5077 hasOne mapping is by default eager and cannot be changed to lazy.
However, this is an older JIRA issue, and I did see on the recent Grails 2.1.1 documentation information on doing lazy one-to-one. http://grails.org/doc/latest/guide/GORM.html#manyToOneAndOneToOne
My new plan is to:
- Try the approach documented for Grails 2.1.1.
- Turn on SQL logging
datasource { ... logSql = true }
- If that does not work, drop back and remap this relationship as a many-to-one.
Hi, Philip.
ReplyDeleteDid you resolve the problem?
I faced exactly the same situation and thinking what to do.