|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BeanPersistController
Used to enhance or override the default bean persistence mechanism.
Note that if want to totally change the finding, you need to use a BeanFinder rather than using postLoad().
Note that getTransaction() on the PersistRequest returns the transaction used for the insert, update, delete or fetch. To explicitly use this same transaction you should use this transaction via methods on EbeanServer.
Object extaBeanToSave = ...; Transaction t = request.getTransaction(); EbeanServer server = request.getEbeanServer(); server.save(extraBeanToSave, t);
It is worth noting that BeanPersistListener is different in three main ways from BeanPersistController postXXX methods.
A BeanPersistController is either found automatically via class path search or can be added programmatically via ServerConfiguration.addEntity().
Method Summary | |
---|---|
int |
getExecutionOrder()
When there are multiple BeanPersistController's for a given entity type this controls the order in which they are executed. |
boolean |
isRegisterFor(Class<?> cls)
Return true if this BeanPersistController should be registered for events on this entity type. |
void |
postDelete(BeanPersistRequest<?> request)
Called after the delete was performed. |
void |
postInsert(BeanPersistRequest<?> request)
Called after the insert was performed. |
void |
postLoad(Object bean,
Set<String> includedProperties)
Called after every each bean is fetched and loaded from the database. |
void |
postUpdate(BeanPersistRequest<?> request)
Called after the update was performed. |
boolean |
preDelete(BeanPersistRequest<?> request)
Prior to the delete perform some action. |
boolean |
preInsert(BeanPersistRequest<?> request)
Prior to the insert perform some action. |
boolean |
preUpdate(BeanPersistRequest<?> request)
Prior to the update perform some action. |
Method Detail |
---|
int getExecutionOrder()
Lowest values are executed first.
boolean isRegisterFor(Class<?> cls)
boolean preInsert(BeanPersistRequest<?> request)
Return false if you have completely replaced the insert functionality and do not want the default insert to be performed.
boolean preUpdate(BeanPersistRequest<?> request)
Return false if you have completely replaced the update functionality and do not want the default update to be performed.
boolean preDelete(BeanPersistRequest<?> request)
Return false if you have completely replaced the delete functionality and do not want the default delete to be performed.
void postInsert(BeanPersistRequest<?> request)
void postUpdate(BeanPersistRequest<?> request)
void postDelete(BeanPersistRequest<?> request)
void postLoad(Object bean, Set<String> includedProperties)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |