If the app server supports connection affinity/sharing (specified as part of 2EE 1.3 deployment descriptors), then XA-support should not be necessary assuming that entity beans and the session bean use the same data source and run in the same VM.
/Johan -----Original Message----- From: A mailing list for Enterprise JavaBeans development [mailto:[EMAIL PROTECTED]]On Behalf Of Chandra kumar Sent: den 4 januari 2002 16:00 To: [EMAIL PROTECTED] Subject: Re: Basic transaction misunderstanding I'd try that. As this is specific to server you are using, referring the docs would be a good idea. IMHO generally there would be different connection pools for non-xa jdbc driver and xa driver. AFAIK even though you use "jdbc/xa/DefaultXADS", your jdbc driver should be xa complaint to achieve the behavior you mentioned in your first post. On Fri, 4 Jan 2002 14:21:08 -0000, Robert Hargreaves <[EMAIL PROTECTED]> wrote: >I get the DataSource handle using > >ds = (DataSource) initialContext.lookup("jdbc/DefaultPooledDS"); > >which is defined in data-sources.xml as: > ><data-source > name="SQL Server" > class="com.evermind.sql.ConnectionDataSource" > location="jdbc/DefaultDS" > pooled-location="jdbc/DefaultPooledDS" > ejb-location="jdbc/DefaultEJBDS" > xa-location="jdbc/xa/DefaultXADS" > url="jdbc:inetdae7:RH:1433?database=damanEnt" > connection-driver="com.inet.tds.TdsDriver" > username="sa" > max-connections="20" > schema = "\database-schemas\sqlserver.xml" > password="password" > /> > >Should a be using "jdbc/xa/DefaultXADS" ? > >> -----Original Message----- >> From: Chandra kumar [mailto:[EMAIL PROTECTED]] >> Sent: 04 January 2002 14:02 >> To: [EMAIL PROTECTED] >> Subject: Re: Basic transaction misunderstanding >> >> >> >con = ds.getConnection(); >> >> As you haven't mentioned about the data source, I'd check to >> make sure the data source obtained is defined in admin server >> as transactional. That means the server should provide ds >> object from the connection pool that uses xa driver. >> >> >> Robert Hargreaves wrote: >> >> I have a remote method X defined in a stateless session bean >> as being TX_REQUIRES_NEW. In the implementation class for >> method X I call three non-remote private methods A, B & C. >> Methods A and C create CMP Entity beans using their >> respective create() methods, but method B creates database >> records using hard-coded SQL like this: >> >> public void B(int compNum, long oid) throws RemoteException { >> Connection con = null; >> try { >> con = ds.getConnection(); >> >> Statement stmt = con.createStatement(); >> stmt.executeUpdate(("INSERT INTO companyMap >> (compNum, oid) " >> + >> "VALUES (" + compNum + "," + oid + ")")); >> stmt.close(); >> } catch (Exception e) { >> throw new RemoteException(e.toString()); >> } finally { >> if (con != null) { >> try { >> con.close(); >> } catch (Exception e) { >> } >> } >> } >> } >> >> >> Trouble is, if there is a problem in with any of the three >> methods, I catch the appropriate exception in method X and >> throw an EJBException which causes a rollback - but it only >> rolls back data created in methods A & C (CMP entity bean >> records) and not data written to the database in method B. I >> want the INSERT statement above to be included in the >> transaction started when method X is called. >> >> Any suggestions? >> >> Rob. >> >> ============================================================== >> ============= >> 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". > =========================================================================== 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".
