  | 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 Anil Kumar
Back Here my problem is I am trying to invoke a Batch process from my stateless session bean when I get a request.. In the Batch Process all I need to do is batch update of tables and select from the tables updated and push the results as text files to a ftp server. This process should happen irrespective to my EJB Transaction. Frequency of this batch process is not more than once a day.
What I am thinking is creating a Java Class (A) and instantiate from my state less session EJB . And Class A kicks off thread for the Batch Process when ever there is a need for it. what do you think??
Nishidhdha Narendra Shah <nishidhdha_shah@(protected)> wrote:
v\:* {behavior:url(#default#VML);}o\:* {behavior:url(#default#VML);}w\:* {behavior:url(#default#VML);}.shape {behavior:url(#default#VML);} 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 ========================= =========================================== 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)
-- ---- ---- ---- ---- ---- ----- Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
==================================================================== 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) <DIV>Here my problem is I am trying to invoke a Batch process from my stateless session bean when I get a request.. In the Batch Process all I need to do is batch update of tables and select from the tables updated and push the results as text files to a ftp server. This process should happen irrespective to my EJB Transaction. Frequency of this batch process is not more than once a day.</DIV> <DIV> </DIV> <DIV>What I am thinking is creating a Java Class (A) and instantiate from my state less session EJB . And Class A kicks off thread for the Batch Process when ever there is a need for it. what do you think??</DIV> <DIV><BR><B><I>Nishidhdha Narendra Shah <nishidhdha_shah@(protected)></I> </B> wrote:</DIV> <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER -LEFT: #1010ff 2px solid"> <META content=Word.Document name=ProgId> <META content="Microsoft Word 10" name=Generator> <META content="Microsoft Word 10" name=Originator><LINK href="cid:filelist.xml @(protected)" rel=File-List><LINK href="cid:editdata.mso@(protected) " rel=Edit-Time-Data> <STYLE> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </STYLE>
<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>
<DIV class=Section1> <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Hi Anil<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">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 face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Nishi<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; 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: 0.5in"><FONT face="Times New Roman" size =3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal style="MARGIN-LEFT: 0.5in"><SPAN class=EmailStyle19><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; 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: 0.5in"><SPAN class=EmailStyle19><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; mso-bidi-font-size: 12.0pt"><o:p> </o:p></SPAN></FONT></SPAN></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Tahoma color=black size =2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Tahoma">---- -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: 1in"><FONT face="Times New Roman" size=3 ><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black">Hi,</SPAN></FONT><o:p> </o:p></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black"> </SPAN></FONT><o :p></o:p></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black"> I am trying to do the following. </SPAN></FONT><o:p></o:p></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; 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: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black"> </SPAN></FONT><o :p></o:p></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; 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: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black"> </SPAN></FONT><o :p></o:p></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; 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: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black"> </SPAN></FONT><o :p></o:p></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black">Here are some questions </SPAN></FONT><o:p></o:p></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black"> </SPAN></FONT><o :p></o:p></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; 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: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black"> </SPAN></FONT><o :p></o:p></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black">Any suggestions.</SPAN ></FONT><o:p></o:p></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black"> </SPAN></FONT><o :p></o:p></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black">Thanks</SPAN></FONT><o :p></o:p></P> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black">Anil</SPAN></FONT><o:p ></o:p></P> <DIV style="MARGIN-LEFT: 0.5in"> <DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center" align =center><FONT face="Times New Roman" color=black size=3><SPAN style="FONT-SIZE: 12pt; COLOR: black"> <HR align=center width="100%" SIZE=1> </SPAN></FONT></DIV></DIV> <P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman" color =black size=3><SPAN style="FONT-SIZE: 12pt; 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: 0.5in"><FONT face="Times New Roman" size=3><SPAN style= "FONT-SIZE: 12pt">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>======== ============================================================ 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)</BLOCKQUOTE><p><hr SIZE=1> 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)
|
|
 |