  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Struts - A MVC web framework | | Tomcat - JSP/Servlet container | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | | JSP - A mailing list about Java Server Pages specification and reference | |
Struts & Hibernate
|
|
|
  | | | Problem in Using Database. | Problem in Using Database. 2004-01-12 - By Nishidhdha Narendra Shah
Back Hi Anil Instead of starting thread, why don't you make another bean, which will update and return rows and make sure its transaction attribute RequireNew so it can start own new transaction instead of global transaction. I guess this is the best practice. What do u say? Nishi -- --Original Message-- -- From: Pradeep Kumar [mailto:pradeepk@(protected)] Sent: Monday, January 12, 2004 9:49 AM To: J2EEPATTERNS-INTEREST@(protected) Subject: Re: Problem in Using Database. You are not supposed to start a thread or do anything in your EJB. Especially if you are using XA, since this will interfere with the XA transaction manager. -- --Original Message-- -- From: Anil Kumar [mailto:anil007dc@(protected)] Sent: Monday, January 12, 2004 7:15 AM To: J2EEPATTERNS-INTEREST@(protected) Subject: Problem in Using Database. Hi, I am trying to do the following. I am using XA Datasource for DB2/390 from my application. In my application I am having a session beans and Domain objects and Data Access objects. we are using websphere Application Server 5.0 We are using XA Datasource because we need to insert and update tables in multiple databases. I had a problem when I try to update some records and try to access the same records in the same transaction. I am getting Invocation Exception.
Here are some questions 1) I want to create a class extending thread and start thread from EJB state less session Brean so that I can do the update and selection of rows from the database external to the Global Transaction Any suggestions. Thanks Anil __ __
Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes <http://pa.yahoo.com/*http:/us.rd.yahoo.com/hotjobs/mail_footer_email/ev t=21482/*http:/hotjobs.sweepstakes.yahoo.com/signingbonus> ==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected) DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Private Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. ==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft -com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http: //www.w3.org/TR/REC-html40">
<head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=ProgId content=Word.Document> <meta name=Generator content="Microsoft Word 10"> <meta name=Originator content="Microsoft Word 10"> <link rel=File-List href="cid:filelist.xml@(protected)"> <link rel=Edit-Time-Data href="cid:editdata.mso@(protected)"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><!--[if gte mso 9]><xml> <o:OfficeDocumentSettings> <o:DoNotRelyOnCSS/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:SpellingState>Clean</w:SpellingState> <w:GrammarState>Clean</w:GrammarState> <w:DocumentKind>DocumentEmail</w:DocumentKind> <w:EnvelopeVis/> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--> <style> <!-- /* Font Definitions */ @(protected) {font-family:Tahoma; panose-1 (See http://ose-1.ora-code.com):2 11 6 4 3 5 4 4 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:553679495 -2147483648 8 0 66047 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:blue; text-decoration:underline; text-underline:single;} p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig {margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} p {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} span.EmailStyle19 {mso-style-type:personal; mso-style-noshow:yes; mso-ansi-font-size:10.0pt; font-family:Arial; mso-ascii-font-family:Arial; mso-hansi-font-family:Arial; mso-bidi-font-family:Arial; color:navy;} span.EmailStyle20 {mso-style-type:personal-reply; mso-style-noshow:yes; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt; font-family:Arial; mso-ascii-font-family:Arial; mso-hansi-font-family:Arial; mso-bidi-font-family:Arial; color:navy;} span.SpellE {mso-style-name:""; mso-spl-e:yes;} span.GramE {mso-style-name:""; mso-gram-e:yes;} @(protected) Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> </head>
<body lang=EN-US link=blue vlink=blue style='tab-interval:.5in'>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'>Hi Anil<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'>Instead of starting thread, why don’t you make another bean, which will update and return rows and make sure its transaction attribute <span class=SpellE>RequireNew</span> so it can start own new transaction instead of global transaction. I guess this is the best practice. What <span class=GramE>do</span> u say?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'>Nishi<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>-- --Original Message-- --<br> <b><span style='font-weight:bold'>From:</span></b> Pradeep Kumar [mailto :pradeepk@(protected)] <br> <b><span style='font-weight:bold'>Sent:</span></b> Monday, January 12, 2004 9:49 AM<br> <b><span style='font-weight:bold'>To:</span></b> J2EEPATTERNS-INTEREST@(protected)<br> <b><span style='font-weight:bold'>Subject:</span></b> Re: Problem in Using Database.</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman" ><span style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:.5in'><span class=EmailStyle19><font size=2 color=navy face=Arial><span style='font-size:10.0pt;mso-bidi-font-size: 12.0pt'>You are not supposed to start a thread or do anything in your EJB. Especially if you are using XA, since this will interfere with the XA transaction manager.<o:p></o:p></span></font></span></p>
<p class=MsoNormal style='margin-left:.5in'><span class=EmailStyle19><font size=2 color=navy face=Arial><span style='font-size:10.0pt;mso-bidi-font-size: 12.0pt'><o:p> </o:p></span></font></span></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=black face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;color:black'>---- -Original Message-- --<br> <b><span style='font-weight:bold'>From:</span></b> Anil Kumar [mailto:anil007dc@(protected)]<br> <b><span style='font-weight:bold'>Sent:</span></b> Monday, January 12, 2004 7:15 AM<br> <b><span style='font-weight:bold'>To:</span></b> J2EEPATTERNS-INTEREST@(protected)<br> <b><span style='font-weight:bold'>Subject:</span></b> Problem in Using Database.</span></font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman "><span style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'>Hi,</span>< /font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'> </span> </font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'> I am trying to do the following. </span></font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'>I am using XA Datasource for DB2/390 from my application. In my application I am having a session beans and Domain objects and Data Access objects. we are using websphere Application Server 5.0</span></font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'> </span> </font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'>We are using XA Datasource because we need to insert and update tables in multiple databases.</span></font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'> </span> </font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'>I had a problem when I try to update some records and try to access the same records in the same transaction. I am getting Invocation Exception. </span>< /font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'> </span> </font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'>Here are some questions </span></font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'> </span> </font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'>1) I want to create a class extending thread and start thread from EJB state less session Brean so that I can do the update and selection of rows from the database external to the Global Transaction </span></font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'> </span> </font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'>Any suggestions.</span></font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'> </span> </font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'>Thanks</span> </font><o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'>Anil</span>< /font><o:p></o:p></p>
<div style='margin-left:.5in'>
<div class=MsoNormal align=center style='margin-left:.5in;text-align:center'> <font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt; color:black'>
<hr size=1 width="100%" align=center>
</span></font></div>
</div>
<p class=MsoNormal style='margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'>Do you Yahoo!?<br> Yahoo! Hotjobs: <a href="http://pa.yahoo.com/*http:/us.rd.yahoo.com/hotjobs/mail_footer_email/evt =21482/*http:/hotjobs.sweepstakes.yahoo.com/signingbonus">Enter the "Signing Bonus" Sweepstakes</a> ==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)</span> </font><o:p></o:p></p>
<p style='margin-left:.5in'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>DISCLAIMER:<br> This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Private Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.<o:p></o:p></span></font></p>
</div>
</body>
</html> ==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected) ==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
|
|
 |