I am currently migrating ejb2.0 beans to ejb3.0. After some problems and a little help from google and this site I managed to migrate a fair amount of our beans, all our simple beans are done.
Now I hang on another problem. The remaining beans use a historisation mechanism to allow a traceable lookup of all actions that occured on a particular bean. To make it easier I will use one of our beans as example.
We have a bean for maintaining changes on orders. For this purpose we have 2 tables, a view and a trigger on our Oracle10g database:
ORDER - Containing latest data of an order.
ORDER_HISTORY - Containing all data of an order that had bean stored prior to the latest data in the ORDER table.
ORDER_COMPLETE - A view displaying all data from ORDER and ORDER_HISTORY
ORDER_BEFORE_INSERT - A trigger that writes old data to ORDER_HISTORY before it is updated with new data in the table ORDER.
When creating or changing an order, we use the default methods of the ejb2.0 bean (ejbCreate and ejbStore). which refer to the ORDER table. When we want to lookup history data, we implemented an additional method which returns all data on an order by refering to ORDER_COMPLETE. The datasets are encapsuled in value objects, where each value object represents a dataset. Since both tables and the view have the same structure, I can use one value object class to transfer data from all threee sources.
In ejb3.0 I created a new object (a pojo) representing a dataset in the table ORDER. Creating and updating works fine. But since the bean is bound to the ORDER table, I can not use it to transfer data from ORDER_HISTORY or ORDER_COMPLETE.
Anybody knows how I can work around this. I don't want to create three pojos for three sources, when the structure is identical. it also brings up more problems, since our GUI is woking on just one object for all three source, It would also mean a heavy change in out GUI sources.
Or has anybody already implemented a historisation mechanism in ejb3.0 and can tell me how to implement it?
Thanks and Regards,