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 > > > > > Nicholas wrote: > > >Provided that the stored proc does not have any > >commits or rollbacks in it, I think you are in the > >clear. CMT will make the call part of the transaction. > >Make sure you get your connection from a transacted > >pool. > > > >//Nicholas > > > > > >--- Russell Chan <[EMAIL PROTECTED]> wrote: > > > > > >>Hi, > >> > >>I've looked through the documentation, but haven't > >>really found an > >>answer to my question yet, so I'll try here. > >> > >>I have a case where some legacy functionality is > >>wrapped up in an > >>oracle stored procedure. I have a session bean > >>which needs to do some > >>lookups/updated, call this stored procedure, and do > >>further lookups/updates. > >> > >>The session bean is currently implemented using CMT. > >> Is it possible to > >>get the stored procedure to run in the same database > >>connection as the > >>transaction? (Otherwise, my data lookups could be > >>skewed because of the > >>stored proc). If so, how do I get the connection? > >> > >>I've managed to get a database connection inline but > >>it is probably not > >>part of the current transaction, so I'm worried > >>about dirty reads. > >> > >>Thanks, > >>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.aspne > t_072303_01/01 > > > > > >>_______________________________________________ > >>JBoss-user mailing list > >>[EMAIL PROTECTED] > >> > >> > >> > >https://lists.sourceforge.net/lists/listinfo/jboss-user > > > > > >===== > >Nicholas Whitehead > >Home: (973) 377 9335 > >Cell: (201) 615 2716 > >[EMAIL PROTECTED] > >Get Your News From The Crowbar: > http://crowbar.dnsalias.com:443/crowbar/ > > > > > >------------------------------------------------------- > >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.aspne t_072303_01/01 >_______________________________________________ >JBoss-user mailing list >[EMAIL PROTECTED] >https://lists.sourceforge.net/lists/listinfo/jboss-user > > > ------------------------------------------------------- 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 ------------------------------------------------------- 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