1

I want to fill a new entity with auto generated data. For instance, I want to fill an entity field with a unique token. I'm thinking that this could be done in the constructor on the domain object.

To my suprise I can't find a constructor for the domain/entity classes generated by Roo. Do I break any guidelines by introducing a constructor myself? Or should I instead push in the persistency stuff from MyClass_Roo_Entity.aj and do it there? Thanks in advance!

bhagyas
  • 3,050
  • 1
  • 23
  • 21
conciliator
  • 6,078
  • 6
  • 41
  • 66

1 Answers1

2

I don't know if it's kosher or not, but here's how I ended up doing it.

  • Created a no-arg constructor, as suggested here.
  • Added the necessary initialization in the constructor.

Seems to work perfectly well.

conciliator
  • 6,078
  • 6
  • 41
  • 66