I have a need to use a custom DAO approach for a particular entity type that cannot be handled directly with the standard Spring cartridge, but needs a bit of customisation. I'd welcome some advice on the best approach.
Basically I have particular entity type (a chemical molecule) whose CRUD operations require use of Java API that uses the db connection to store its information in a particular type of database table, but not in a way that can be done directly using Hibernate. So I need to intercept the DAO methods to first perform this operation and then do the standard Hibernate persistance. I've done a simple test of overiding the public Object create(final int transform, final com.abc.MyObject myobj) method in my MyObjectDaoImpl class and in this method to use a HibernateCallback to grab the Connection, do my business, set the new params on the MyObject object and then continue with a call the the superclass' methods to allow Hibernate to carry on with the standard operation. This all works, so in principle I should be able to achieve what I need. My question is how I should go about generalizing this. It seems that I should gerate a new stereotype for my Molecule Entities and modify the Spring cartridge so that this extra code can be generated by the cartidge and does not need to be hand written by overriding the method in MyObjectDaoBase. Baisically I think I need to be able to specify a preCreate() and a postCreate() method (plus similar ones for update, delete, load etc) for these custom entities, and have this code all generated by the cartridge based on the custom entity stereotype. What is the best aproach to do this? Please ask if anything is not clear. Tim _________________________________________________________ Reply to the post : http://galaxy.andromda.org/forum/viewtopic.php?p=2096#2096 Posting to http://forum.andromda.org/ is preferred over posting to the mailing list! ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Andromda-user mailing list Andromda-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/andromda-user