Changes between Version 3 and Version 4 of MappingDecorator


Ignore:
Timestamp:
2011-02-14T10:18:04+01:00 (14 years ago)
Author:
jvelde
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MappingDecorator

    v3 v4  
    22You can customize the way entities are added, updated or removed by the database logic by adding decorator classes. Start by adding a decorator your your entity:
    33
    4 `<entity name="Example" decorator="decorators.ExampleDecorator">`[[BR]][[BR]]This will put a template decorator '!ExampleDecorator.java' in a package 'decorators' in your Java source folder. If you open this file, you will notice three functions:[[BR]][[BR]]`public int add(List<E> entities)`
    5 
    6 `public int update(List<E> entities)`
    7 
    8 `public int remove(List<E> entities)`[[BR]][[BR]]Each of these functions can be customized with new pre-, post- and database action behaviour, in a sequential layout:[[BR]][[BR]]`// add your pre-processing here// here we call the standard 'add'int count = super.add(entities);// add your post-processing here// if you throw an exception the previous add will be rolled back`
     4`<entity name="Example" decorator="decorators.ExampleDecorator">`[[BR]][[BR]]This will put a template decorator '!ExampleDecorator.java' in a package 'decorators' in your Java source folder. If you open this file, you will notice three functions:[[BR]][[BR]]`public int add(List<E> entities)public int update(List<E> entities)public int remove(List<E> entities)`[[BR]][[BR]]Each of these functions can be customized with new pre-, post- and database action behaviour, in a sequential layout:[[BR]][[BR]]`// add your pre-processing here// here we call the standard 'add'int count = super.add(entities);// add your post-processing here// if you throw an exception the previous add will be rolled back`
    95
    106== Example ==