1.  This is defined by the deployer in the ejb deployment description.  You can use a 
UserTransaction from the client side if you want.  Set the transaction level to 
REQUIRED on the bean.  If there is a UserTransaction, the container should use it, if 
not, it will create a new transaction.

2.  The get/set methods on the CMP do just that, they get/set the data and nothing 
else.

3.  I would suggest using a session fa�ade as a means to access the entities.

I usually build a helper class to handle validation of data.  The helper should be 
shared between the client and server.  The client can do validation before submitting 
the data to the server.  The server should always do validation - via session facade.  
Use value objects to transfer data between the tiers.  The validation helper can use 
the value object as its data source.  Make the session fa�ade accessible both remotely 
and locally.  Only local access for the entity.

James Hicks

-----Original Message-----
From: Bob the Builder [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 21, 2003 8:03 AM
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?

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).

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".

Reply via email to