Announcement Announcement Module
No announcement yet.
Grails mapping DSL Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Grails mapping DSL

    Hi there,

    I have two classes that have a unidirectional one to one relationship. So for example:

    class Car{
       Engine engine
    class Engine{ }
    I have a requirement such that any time this object graph changes, I want to increment the version of the Car class, and then insert the new version of the Engine class (and maintain previous versions too).

    So for example, when I create a new Car/Engine, I insert the Car class then insert the Engine class. Anytime I make an update, I update the Car class and INSERT the new version of the Engine class.

    Before I resort to something crazy, like overriding save() and using GSQL, is there some way either in the GORM Mapping DSL or in Hibernate that I can make this happen?

    Thanks in advance for this HUGE help.


  • #2
    How do you keep track of all the old engines? Do they need to maintain a reference back to the Car?