EJB Design Patterns
-------------------------------------------------------------------------------------------------------------
类别:JAVA编程
文件格式:PDF
语言:英文
详细信息:http://www.amazon.com/gp/product ... glance&n=283155
- the importance of DTOs have come down following EJB2.0 release
- reduce network chattiness, consider following options
-- Session facade: remember not to create a God class, group relevant functions together in each Facade
-- Consider message facade for asynchronous processing of requests where an immediate response is not required
-- consider Command pattern only for prototyping
-- use HashMaps or Value objects for transferring Entity EJB data over indiv get/set methods
-- use LocalHomes for Session Bean to Entity Bean comm
- create a business interface, a superinterface which both the remote and the Bean itself can implement
- strongly recommend RowSet (JDBC 2.0 optional/JDBC 3.0 core) for tabular data transfer
- depending on requirement, strike a balance between Domain Data Objects (Entity EJB data copies) and custom data objects (what the customer wants to see in one shot), remember to make Custom DOs read only
- consider Fast Lane Reader pattern, pretty neat... Consider JDBC for Reading pattern for read-only data
- Dual Persistent Entity Beans, toggle between BMP/CMP EJB by modifying the deployment descriptors
- skip Chapter 4, use 'Service Locator' pattern with caching option for locating and caching EJB homes
- need to generate primary keys, mostly use UUID generation technique discussed in case database's sequences are not enough
- Part 2 of the book is mostly fluff, it discusses everything but 'Best Practices for EJB design and Implementation', which coincidentally is the heading for part 2
- using ANT and jUnit, you call them best practice? No, they are standard practices
- model domain/persistence/services/clients in that order
- in discussing alternatives to Entity EJBs author laudes JDOs too much, I suggest you check out the 'Hibernate' project, looks more intuitive than JDO (to me)
- Chapter 9 (EJB design Strategies, Idioms and Tips) is actually pretty good, probably because this is the only chapter that's not fluffy, thank you Floyd
-- don't use Composite Entity Bean Pattern, good suggestion Floyd
-- field validation on Entity beans? Use (define and implement) get/set-XXXfield methods since you can't implement the get/set-XXX methods
-- prefer scheduled updates to real-time computations
-- Message Beans - use serialized classes to enable type checking
-- call setRollbackOnly and NOT Rollback, when App exceptions occur
-- limit parameters for EJB create, don't pass DTOs
-- don't use XML as a DTO mechanism, good eye-opener for XML fans
-------------------------------------------------------------------------------------------------------------
〖下载〗
→
下载地址1