1. You can define a preInsert Event something like
Code:
<event type="pre-insert">
<listener class="xxx.yyy.zzz"/>
</event>
The xx.yyy.zzz class will then implement the PreInsertEventListener. Look up Events and Intereceptors in the manual.
2. Im not sure if you can do this. But when you define the property, you can use the formulat attribute of this to do something like
Code:
<property name="employeeno" .... formula="departmentno || id" />
Im not sure if it would work but you can check out the semantics of formula to see if this is doable.