Results 1 to 2 of 2

Thread: Grails mapping DSL

  1. #1
    Join Date
    Nov 2009
    Location
    Boston,MA
    Posts
    8

    Default Grails mapping DSL

    Hi there,

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

    Code:
    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.

    Regards,
    Matt

  2. #2
    Join Date
    Jun 2010
    Location
    London
    Posts
    304

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •