This section provides you with some pointers that might prove helpful when using AndroMDA with the EJB3 cartridge. Some of these tips are shared with the Spring cartridge.
It's not needed to model exceptions for all the services you model, the EJB3 cartridge will generate them automatically for you. That way you don't need to keep writing try/catch blocks in the handleXXX methods in the service implementation classes, just throw any error, it will be handled for you.
So basically this snippet is a good example of an implementation of a service operation, there is no need to catch any exception and re-throw it:
protected PersonDetails handleGet(Long id) throws Exception { return (PersonDetails)getPersonDao().load(PersonDao.TRANSFORM_PERSONDETAILS, id); }
You can connect to "foreign" EJB3 services, which are not implemented in your application but in another one (e.g. a other ear), as with "normal" services: just draw a dependency to the "foreign" service class. The foreign service class has to be defined as any other service but without any method or property.
To prevent the EJB3 cartridge from generating java code you have to exclude the packages with a process="false" statement in the andromda configuration just in your appropriate <model> tag:
<modelPackages> <modelPackage process="false">de::my::foreign.package::name</modelPackage> </modelPackages>