Any reason not to use metaClass on domain objects? as in
domainObjectInstance.metaClass.dynamicTransientGreeting = “Hello”
Will this mess with hibernate at all?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It won’t mess with Hibernate at all since it won’t be seen by Hibernate. GORM only maps “real” properties to Hibernate properties.
That’s why the
idandversioncolumns and the collections that are generated fromhasManydeclarations (e.g. theuserscollection generated bystatic hasMany = [users: User]are added to the actual bytecode using an AST. If they were added just to the MetaClass they wouldn’t be seen and wouldn’t be persistent.