To add a little more information to this scenario. The connection pool is
using the oracle jdbc 1.1.1 driver using the
org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl wrapper for the DataSource.
(We have issues with the jdbc 1.2 driver not related to this) 

We tested this scenario with just two business objects of the same class.
The first object created a side effect that the second business object
depended on. We put calls to a logging facility (not log4j) to provide a
detailed view of what was going on. The calls where ordered correctly.
However, the db connection instance was not the same when the second
persistance request was made.

Karl Koster
[EMAIL PROTECTED]
Sempra Energy Trading
203-355-5182

--------------------

If you are depending on the changes being sent to the db in a certain
order.. this may not be happening, I'm not sure.  I think right before the
end of the transaction all ejbStore methods get called, but perhaps not in
any particular order.

If you are using non xa connections ("local transactions" in the spec) then
jboss is in fact putting all the work on one transaction through one
connection - or it wouldn't be one transaction.  With an xa capable driver,
it is not supposed to matter... which doesn't mean the driver is
implemented correctly.

david jencks

On 2001.11.02 14:06:29 -0500 Karl Koster wrote:
> I am hoping to find a simple resolution to this problem. I am running
> JBoss
> 2.4.3
> 
> I have a SLSB that is used for persisting business objects implemented as
> simple java beans. These beans have "alter egos" as Entity Beans in the
> app
> server. (in fact, corresponding entity beans are simply facades for a
> copy
> of the java bean) 
> The SLSB simply determines which class of Entity Bean to use, find it the
> instance nessecary, and set the underlying business object to that passed
> into the SLSB.
> 
> The problem comes when passing a queue of business objects where later
> objects depend on side effects of the earlier objects within the
> database.
> 
> According to the EJB 2.0 spec "The Bean Provider can control shareability
> of
> the connections acquired from the resource manager connection factory. By
> default, connections to a resource manager are shareable across other
> enterprise beans in the application that use the same resource in the
> same
> transaction context."
> "The sharing of connections to a resource manager allows the container to
> optimize the use of connections and enables the container's use of local
> transaction optimizations." (Section 20.4.1.1)
> 
> From this I make the assumption (bad word I know) that, under a single
> (J2EE) transaction context, for the same resource, regardless of which
> instance of entity bean is being operated on, a connection will be
> re-used
> when requested more than once. I am not clear if this applies to multiple
> entity bean classes, since there references are in a difference
> namespace,
> but they do reference the same resource manager underneath everything.
> 
> The following are snippets from my ejb-jar.xml and jboss.xml files:
> 
> ejb-jar.xml
> 
>       <resource-ref>
>         <res-ref-name>jdbc/jts.Connection</res-ref-name>
>         <res-type>javax.sql.DataSource</res-type>
>         <res-auth>Container</res-auth>
>         <res-sharing-scope>Sharable</res-sharing-scope>
>       </resource-ref>
> 
> jboss.xml
> 
>       <resource-ref>
>         <res-ref-name>jdbc/jts.Connection</res-ref-name>
>         <resource-name>jts.sempraDev</resource-name>
>       </resource-ref>
> 
>     <resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
>       <res-name>jts.sempraDev</res-name>
>       <res-jndi-name>java:/jts.sempraDev</res-jndi-name>
>     </resource-manager>
> 
> All of my beans have a trans-attribute of Required for all methods that
> affect the state of objects and a default of Supports for everything
> else. 
> 
> What appears to be happening is that there is no guaruntee that the same
> db
> connection will be used throughout the context of a single transaction,
> even
> within the same entity bean class. This is causing changes to be
> performed
> under one db transaction and subsequent changes that depend on the db
> side
> effects of the earlier changes to be performed under a seperate db
> transaction. The subsequent db transactions cannot see the earlier
> changes
> to the db and fail, rolling back the entire set of db transactions.
> 
> When the business objects are submitted one at a time from the client
> everything works fine. It is only when a queue of business objects are
> submitted that the problem exists.
> 
> From what I have understood about JBoss, this part of the EJB 2.0
> specification has been in place for some timel.  Correct me if I am
> wrong.
> 
> Any help/clarification would be appreciated.
> 
> Karl Koster
> [EMAIL PROTECTED]
> Sempra Energy Trading
> 203-355-5182
> 
> 
> 
> **********************************************************************
> This e-mail contains privileged attorney-client communications and/or
> confidential information, and is only for the use by the intended
> recipient. Receipt by an unintended recipient does not constitute a
> waiver of any applicable privilege."
> 
> Reading, disclosure, discussion, dissemination, distribution or copying
> of this information by anyone other than the intended recipient or his or
> her employees or agents is strictly prohibited.  If you have received
> this communication in error, please immediately notify us and delete the
> original material from your computer."
> 
> Sempra Energy Trading Corp. (SET) is not the same company as SDG&E or
> SoCalGas, the utilities owned by SET's parent company.  SET is not
> regulated by the California Public Utilities Commission and you do not
> have to buy SET's products and services to continue to receive quality
> regulated service from the utilities."
> **********************************************************************
> 
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


**********************************************************************
This e-mail contains privileged attorney-client communications and/or confidential 
information, and is only for the use by the intended recipient. Receipt by an 
unintended recipient does not constitute a waiver of any applicable privilege."

Reading, disclosure, discussion, dissemination, distribution or copying of this 
information by anyone other than the intended recipient or his or her employees or 
agents is strictly prohibited.  If you have received this communication in error, 
please immediately notify us and delete the original material from your computer."

Sempra Energy Trading Corp. (SET) is not the same company as SDG&E or SoCalGas, the 
utilities owned by SET's parent company.  SET is not regulated by the California 
Public Utilities Commission and you do not have to buy SET's products and services to 
continue to receive quality regulated service from the utilities."
**********************************************************************


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to