Defining the default id type for all domain classes

130 Views Asked by At

In a mongo-only setup we need to use a String id (or ObjectId):

class SomeDomain {
  String id
  ///
}

in all domain classes of the app.

Is there a config shortcut to set the default String id overriding GORM's default Long id for all domain classes?

1

There are 1 best solutions below

0
Dónal On

There's no way that I know of other than by defining this in a base class or trait, e.g.

trait Persistent {
  String id
}

class SomeDomain implements Persistent {
  // other persistent properties
}