  | 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 Thanks Jin.
This really helped me out...
Thanks Anil
Jin Chun <ByungChun@(protected)> wrote: The easiest thing to do IMHO is to have your thread started in the web tier via a servlet, using something like quartz (an open source j2ee scheduler). Have your code running in the web tier use a facade to invoke the logic in a stateless session bean.
Jin
Jin Chun
Vice President: Sr. Systems Architect
State Street ? Global Link | www.statestreet.com | www.globallink.com
617.664.1695 | byungchun@(protected)
SCJA SCJP OCP-DBA
Confidentiality Notice: The information contained in the email is intended for the confidential use of the above-named recipient(s). If the reader of this message is not the intended recipient or person responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error, and that any review, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this in error, please notify the sender immediately and destroy this message.
|-- ------+-- ---- ---- ---- ---- ---- ---- ---> | | Nishidhdha Narendra Shah | | | | | COM> | | | Sent by: An interest list| | | for Sun Java Center J2EE | | | Pattern Catalog | | | | | VA.SUN.COM> | | | | | | | | | 01/12/2004 01:10 AM | | | Please respond to An | | | interest list for Sun | | | Java Center J2EE Pattern | | | Catalog | | | | |-- ------+-- ---- ---- ---- ---- ---- ---- ---> >-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----| | | | To: J2EEPATTERNS-INTEREST@(protected) | | cc: | | Subject: Re: Problem in Using Database. | >-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----|
But Anil, As per J2EE spec you can not start any thread form bean. U must have to use another session bean.
Regards,
Nishi
-- --Original Message-- -- From: Anil Kumar [mailto:anil007dc@(protected)] Sent: Monday, January 12, 2004 11:39 AM To: J2EEPATTERNS-INTEREST@(protected) Subject: Re: Problem in Using Database.
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 wrote: 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 ====================================================================
ompanion 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.
====================================================================
ompanion 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)
==================================================================== 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)
-- ---- ---- ---- ---- ---- ----- 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>Thanks Jin.</DIV> <DIV> </DIV> <DIV>This really helped me out...</DIV> <DIV> </DIV> <DIV>Thanks </DIV> <DIV>Anil<BR><BR><B><I>Jin Chun <ByungChun@(protected)></I></B> wrote :</DIV> <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER -LEFT: #1010ff 2px solid">The easiest thing to do IMHO is to have your thread started in the web tier<BR>via a servlet, using something like quartz (an open source j2ee scheduler).<BR>Have your code<BR>running in the web tier use a facade to invoke the logic in a stateless<BR>session bean.<BR><BR>Jin<BR><BR >Jin Chun<BR><BR><BR>Vice President: Sr. Systems Architect<BR><BR><BR>State Street ? Global Link | www.statestreet.com | www.globallink.com<BR><BR><BR>617 .664.1695 | byungchun@(protected)<BR><BR><BR>SCJA SCJP OCP-DBA<BR><BR><BR> <BR><BR><BR><BR><BR><BR>Confidentiality Notice: The information contained in the email is intended<BR>for the confidential use of the above-named recipient(s). If the reader of<BR>this message is not the intended recipient or person responsible for<BR>delivering it to the intended recipient, you are hereby notified that you<BR>have received this communication in error, and that any review,<BR>dissemination, distribution, or copying of this communication is strictly<BR>prohibited. If you have received this in error, please notify the sender<BR>immediately and destroy this message.<BR><BR><BR>|-- ------+-- -- -- ---- ---- ---- ---- ---- ---><BR>| | Nishidhdha Narendra Shah |<BR>| | <NISHIDHDHA_SHAH@(protected)|<BR>| | COM> |<BR>| | Sent by: An interest list|<BR >| | for Sun Java Center J2EE |<BR>| | Pattern Catalog |<BR>| | <J2EEPATTERNS -INTEREST@(protected)|<BR>| | VA.SUN.COM> |<BR>| | |<BR>| | |<BR>| | 01/12/2004 01:10 AM |<BR>| | Please respond to An |<BR>| | interest list for Sun |<BR>| | Java Center J2EE Pattern |<BR>| | Catalog |<BR>| | |<BR>|-- ------+-- ---- ---- ---- -- ---- ---- ------><BR>>-- ---- ---- ---- ---- ---- ---- ---- ---- ------ -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- -- ---- ----|<BR>| |<BR>| To: J2EEPATTERNS-INTEREST@(protected) |<BR>| cc: |<BR >| Subject: Re: Problem in Using Database. |<BR>>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----|<BR><BR ><BR><BR><BR>But Anil, As per J2EE spec you can not start any thread form bean. U must<BR>have to use another session bean.<BR><BR><BR><BR><BR><BR>Regards,<BR> <BR><BR>Nishi<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>-- --Original Message-- --<BR>From: Anil Kumar [mailto:anil007dc@(protected)]<BR>Sent: Monday, January 12, 2004 11:39 AM<BR>To: J2EEPATTERNS-INTEREST@(protected)<BR>Subject: Re: Problem in Using Database.<BR><BR><BR><BR><BR><BR>Here my problem is I am trying to invoke a Batch process from my<BR>stateless session bean when I get a request.. In the Batch Process<BR>all I need to do is batch update of tables and select from the tables<BR>updated and push the results as text files to a ftp server. This<BR>process should happen irrespective to my EJB Transaction. Frequency<BR>of this batch process is not more than once a day.<BR><BR><BR><BR><BR><BR>What I am thinking is creating a Java Class (A) and instantiate from<BR>my state less session EJB . And Class A kicks off thread for the<BR>Batch Process when ever there is a need for it. what do you think??<BR><BR><BR><BR>Nishidhdha Narendra Shah <NISHIDHDHA_SHAH@(protected) >wrote:<BR>Hi Anil<BR><BR><BR><BR><BR><BR>Instead of starting thread, why don't you make another bean, which<BR>will update and return rows and make sure its transaction attribute<BR>RequireNew so it can start own new transaction instead of global<BR>transaction. I guess this is the best practice. What do u say?<BR> <BR><BR><BR><BR><BR>Nishi<BR><BR><BR><BR><BR><BR>-- --Original Message-- --<BR >From: Pradeep Kumar [mailto:pradeepk@(protected)]<BR>Sent: Monday, January 12, 2004 9:49 AM<BR>To: J2EEPATTERNS-INTEREST@(protected)<BR>Subject: Re: Problem in Using Database.<BR><BR><BR><BR><BR><BR>You are not supposed to start a thread or do anything in your<BR>EJB. Especially if you are using XA, since this will interfere<BR>with the XA transaction manager.<BR ><BR><BR><BR><BR><BR>-- --Original Message-- --<BR>From: Anil Kumar [mailto :anil007dc@(protected)]<BR>Sent: Monday, January 12, 2004 7:15 AM<BR>To: J2EEPATTERNS-INTEREST@(protected)<BR>Subject: Problem in Using Database.<BR> <BR><BR><BR><BR><BR>Hi,<BR><BR><BR><BR><BR><BR>I am trying to do the following. <BR><BR><BR>I am using XA Datasource for DB2/390 from my<BR>application. In my application I am having a session<BR>beans and Domain objects and Data Access objects. we are<BR>using websphere Application Server 5.0<BR><BR><BR><BR><BR> <BR>We are using XA Datasource because we need to insert and<BR>update tables in multiple databases.<BR><BR><BR><BR><BR><BR>I had a problem when I try to update some records and<BR>try to access the same records in the same transaction.<BR >I am getting Invocation Exception.<BR><BR><BR><BR><BR><BR>Here are some questions<BR><BR><BR><BR><BR><BR>1) I want to create a class ex tending thread and start<BR>thread from EJB state less session Brean so that I can<BR >do the update and selection of rows from the database<BR>external to the Global Transaction<BR><BR><BR><BR><BR><BR>Any suggestions.<BR><BR><BR><BR><BR><BR >Thanks<BR><BR><BR>Anil<BR><BR><BR><BR><BR><BR>Do you Yahoo!?<BR>Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes<BR>====================================== ============================== <BR><BR>ompanion Site: http://www .corej2eepatterns.com J2EE<BR>BluePrints:<BR>http://java.sun.com/blueprints /corej2eepatterns List<BR>Archive:<BR>http://archives.java.sun.com/archives /j2eepatterns-interest.html<BR>Unsubscribing: email "signoff J2EEPATTERNS -INTEREST" to<BR>listserv@(protected)<BR><BR><BR>DISCLAIMER:<BR>This message (including attachment if any) is confidential and<BR>may be privileged. Before opening attachments please check<BR>them for viruses and defects. MindTree Consulting Private<BR>Limited (MindTree) will not be responsible for any virus es or<BR>defects or any forwarded attachments emanating either from<BR>within MindTree or outside. If you have received this message<BR>by mistake please notify the sender by return e-mail and<BR>delete this message from your system. Any unauthorized use or<BR>dissemination of this message in whole or in part is strictly<BR>prohibited. Please note that e-mails are susceptible to change<BR >and MindTree shall not be liable for any improper, untimely or<BR>incomplete transmission.<BR><BR><BR>====================================================== ============== <BR><BR>ompanion Site: http://www.corej2eepatterns.com J2EE BluePrints:<BR>http://java.sun.com/blueprints/corej2eepatterns List Archive:<BR >http://archives.java.sun.com/archives/j2eepatterns-interest.html<BR >Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to<BR>listserv@(protected) .com<BR><BR><BR><BR><BR><BR>Do you Yahoo!?<BR>Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes<BR>=============================================================== =====<BR>Companion Site: http://www.corej2eepatterns.com J2EE BluePrints:<BR >http://java.sun.com/blueprints/corej2eepatterns List Archive:<BR>http:/ /archives.java.sun.com/archives/j2eepatterns-interest.html<BR>Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to<BR>listserv@(protected)<BR><BR><BR>== ==================================================================<BR>Companion Site: http://www.corej2eepatterns.com J2EE BluePrints:<BR>http://java.sun.com /blueprints/corej2eepatterns List Archive:<BR>http://archives.java.sun.com /archives/j2eepatterns-interest.html<BR>Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to<BR>listserv@(protected)<BR><BR><BR><BR><BR><BR><BR> <BR>====================================================================<BR >Companion Site: http://www.corej2eepatterns.com<BR>J2EE BluePrints: http://java .sun.com/blueprints/corej2eepatterns<BR>List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html<BR >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)
|
|
 |