Re: Using CMP
Suresh Babu Koya <[email protected]>
| Newsgroups | gmane.comp.java.sun.ejb.general |
|---|---|
| Message-ID | <7D5800A5B6E26644B2EB7A862856B0D40921E6A1@SARASWATI> |
-----Original Message----- From: Bob the Builder [mailto:[email protected]] Sent: Monday, July 21, 2003 6:33 PM To: [email protected] Subject: Using CMP Hi all, I have written my own CMP entity bean, and I am calling it from a JSP Page. Now I am wondering about a couple of things ... 1) When calling it directly, is there any implicit transaction demarcation that you can generally expect, or should I create my own user transaction on the caller side? In Sun's "Designing Enterprise Applications with J2EE" it is clearly stated that - "With container-managed transaction demarcation, the EJB container handles transaction management. The container performs the transaction demarcation based on the application assembler's deployment instructions; it handles starting and ending the transaction and maintaining the transaction context throughout the life of the transaction object........... Entity beans can only use container-managed transaction demarcation." 2) The abstract get and sets of the entity bean do not throw exceptions; if I assume that the database will deal with data errors for me when and what exception could one expect, or is this undefined? More generally, can CMP entity beans generally be relied upon to deal with data validation? I remember reading the phrase "aggressive caching" somewhere which seems like an accident waiting to happen (6). The set and get methods operate on data members mapping to columns of database. You get errors only when you a new record is being inserted into the database in which case you a SQLException wrapped inside a EJBException. 3) The above makes me believe that a session facade is the only realistic way to deal with get/set of the data and to control transactions. I am looking at this from a technical perspective, and mentally ignoring the design issues. That means that you cannot generally use CMP without accessor objects (like the bad old days of BMP, what?). Any views on that? I would rather do this than have some shmoe "enhance" my poor value object, but it does seem like quite a complex thing to do in my simple application. Any response to the above qestions would be greatly appreciated. Thanks =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [email protected] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [email protected] and include in the body of the message "help".