Extending a GORM domain class with a non persistent one

View: New views
1 Messages — Rating Filter:   Alert me  

Extending a GORM domain class with a non persistent one

by Bugzilla from elvanor@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, this use case may not be very frequent, but I would like to have a non persistent class (eg, not a Domain one, not mapped to the DB) that extends a GORM domain class.

I thought this would work, but I have a very strange behavior, whenever I try to create an object of the child class, the actual object I get is of the parent class (a println myObject.dump() shows this)! This is quite incredible... it seems like I did not write a new class.

eg:

            ThemeDesign a = newThemeDesign()
            println a.dump()

shows that a is a Design (the base GORM class ThemeDesign extends...)


Any Grails or Groovy gurus that can shed some light on this, or is it a bug?

Jean-Noel

PS: The child class is in src/groovy, the base class in domain/.