You can implement the interface
com.avaje.ebean.event.BeanPersistController - there is a preInsert
method so you can do something like
public boolean preInsert(BeanPersistRequest<?> request) {
final MyObject myObject = (MyObject) request.getBean();
myObject.setUUID(generateUUID());
}
I'm not sure if we support the JPA type lifecycle annotations e.g.
@PreInsert - I remember there was a debate about it e.g.
http://www.avaje.org/topic-4.html but Rob may have implemented since
then. Personally I think the BeanController is much cleaner e.g. if
you're using IoC then you can set up all the stuff in your bean
controller and not clutter up your domain objects.
BTW to use your BeanController you add it to list
EbeanConfig.persistController
Eddie