I have a workaround solution which works fine, but I don't understand why
the first approach didn't work. If you can, please explain how to make the
first approach work (or why it shouldn't work). Would changing the
transaction attributes in the Session Bean in the first approach make it
work?

THE SITUATION:
I've got a number of CMP Entity Beans, all of whose CRUD maintenance
operations are being implemented by a single stateless Session Bean named
"Maintenance" (not necessarily a single instance).

This Maintenance Session Bean has operations which work on single entities,
for example
   updateFrom( EntityBeanState arg )

All of this works so far. The Entities have their update methods set to
TX_REQUIRES_NEW, TRANSACTION_SERIALIZABLE, as does the Session Bean.

THE FIRST APPROACH (why doesn't this work):
Now, I wanted to add methods to the Maintenance Session Bean which work with
arrays of entities, such as
   updateFrom( EntityBeanState[] arg )
whose implementation mostly just loops through the array and calls the
method (on the same Bean) which accepts a single instance rather than an
array. This would allow me to prepare a number of updates on the client side
and execute them with one network call via a Servlet to the Maintenance
Session Bean (through the company firewall).

The problem with this is that I get transactions rolled back at the
database.

THE SECOND APPROACH (it works, but why did I have to do this instead of the
first approach):
I worked around this problem by making a second Session Bean with each of
the methods which accept arrays, each of which calls the Maintenance Session
Bean's method which accepts a single instance parameter. Although this still
involves RMI network calls from Session Bean to Session Bean inside the
server, it does not involve round trip HTTP communication for every atomic
update. The update method has its transaction attrributes set to
TX_REQUIRES_NEW, TRANSACTION_SERIALIZABLE, just as the other Session Bean.

This work-around, having created a second Session Bean with methods
accepting arrays, looping thru the arrays and calling corresponding
single-instance-parameter methods on another Session Bean, works.

===========================================================================
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