not just a jboss transaction. I need to ensure that I wouldn't get dirty reads or phantom reads, or
collisions when the transaction gets committed at the end (or other non-ejb apps try to use the same data).
It wasn't apparent (at least from any docs that I read - but I've been know to gloss over the docs ;-)
that when I got the connection from the env-entry that it would be the SAME connection that would be
used for the jboss Transactional context, which is what I need. I have had no evidence to support that
the connection I'm using is the same connection future reads (in this jboss transaction) will get. (I also have no evidence to the contrary).
I know that in some cases, I do have further reads (in the same jboss transaction) after this which DO read
from data modified in the stored proc, which does modify database information. Since there's been no
commits, I need to ensure that I have the same database connection to ensure that the data is coherent.
(I sure hope I communicated that properly... )
Being the generally lazy guy that I am :-), I was hoping someone could enlighten me without me having to
write a test harness to determine the behaviour.
I have an app which is about to get at least a tenfold increase in transactional volume shortly, and I wanted to make
sure my understanding was correct...I'd love to get rid of the stored procs, but that unfortunately is out of my control, and other
environments use them (perl, python and C),
RC
Peter Spiess wrote:
I have used stored procedures within entity beans before as part of a CMT with no issue. I can't think of anything off the top of my head (just looked at my code and I don't see any major difference). What makes you think that your connection is not part of a transaction? You got the exception when you tried to commit....
Peter
-----Original Message----- From: Russ Chan [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 11:08 AM To: [EMAIL PROTECTED] Subject: Re: [JBoss-user] Stored procedures and session beans
Thanks for the reply Nicholas.
I'm not sure that the connection is part of the transacted pool -
The connection is retrieved from an env-entry for the bean, which
is the datasource from jboss. I think that you're right and I'm doing it the right way, but
I just want someone else to confirm :-).
I do notice that if I add a conn.commit() to the following code, I get a nice exception
telling me that I can't call a commit on a managed connection...So it
seems that I'm on the right path.
Here's a code snippet:
try{
InitialContext jndiContext = new InitialContext();
String DSN = (String) jndiContext.lookup("java:/comp/env/dsn");
DataSource dataSource = (DataSource) jndiContext.lookup(DSN);
conn = dataSource.getConnection();
stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select OFFNET.GENERATE_TXID FROM DUAL");
if (rs.next())
{
long id = rs.getLong(1);
txid = new Long(id);
}
rs.close();rs=null;
stmt.close();stmt=null;
conn.close();conn=null;
The corresponding env-entry in the ejb-jar.xml is : <env-entry> <env-entry-name>dsn</env-entry-name> <env-entry-type>java.lang.String</env-entry-type> <env-entry-value>java:/SandboxDS</env-entry-value> </env-entry>
Where java:/SandboxDS is the oracle datasource.
BTW, this is all under jboss 3.2.1.
Russ
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user