App Server: Weblogic 6.1 (CMP2.0) DB: Oracle 9i Hi everybody, I need some clearification on cmp fields. I really appreciate if you can help me on this. Cmp getXXX and setXXX method can be declared as abstract method. That's what I thgouht. But is this an requirement? For example, suppose a row contains a column called "password", and there is a specific rule, such as at least 8 letter long, or have to include both character and number. abstract method doesn't contain anything that validates the data. I am design an entity bean, and I need to set valification based on business rule on almost all setXXX getXXX methods. If I want to implement data validation logic on cmp fields, then I have to implement the setXXX getXXX methods by myself and connect to DB directly in ejbStore and ejbLoad methods? If so,it sounds like BMP. Is it pretty much a requirement for cmp2.0 not to include validation logic? And if I want to, I have to code everything with bmp? Or there is a way I can set data validation and still get away with coding ejbStore, ejbLoad, or any other methods? Or you usually do data validation at somewhere else? (client that uses the bean, dd, etc.)
I think it's highly possible that some system just doesn't let anything go into DB due to some business rules. In those situations, what do you do?
It's generally considered cleaner to place the business logic in a Session EJB and not in the Entitiy beans (BMP or CMP). However, there's nothing actually forbidding it and I do regularly include "business" methods that do bulk data transfers in order to avoid the overhead of individual field set/get operations, which can be especially expensive over RMI.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Dec 04, 2001
Hi Tim, thank you for your posting. I just moved business logic to Session Beans that use the EJB. That makes a lot of sense, and code is much cleaner. I will look into more about Value Object approach you mentioned. Thank you