Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB and other Java EE Technologies and the fly likes insert data usinstateless sessionbean Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "insert data usinstateless sessionbean" Watch "insert data usinstateless sessionbean" New topic
Author

insert data usinstateless sessionbean

ranga shreya
Greenhorn

Joined: Mar 05, 2005
Posts: 20
Hi There,
I am trying to insert data in a tabel using a stateless session bean .
What are the steps involved here please let me know.
Thanks.


Thanks,<br />Ranga.<br />Life is precious so enjoy the life each moment and utilise it at the same time.
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
What have you tried so far?


James Carman, President<br />Carman Consulting, Inc.
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Ranga,

In a nutshell is like this:
inside your business method:
  • Get a reference to the DataSource using JNDI (this might be cached).
  • Get a connection from the pool (don�t even thing to cache it).
  • If you choose BMT, start your transaction; otherwise let the container handle it.
  • Update the database.
  • If BMT then commit the transaction; otherwise let the container handle it.
  • Close the connection, ideally inside of the finally block (this will return the connection back to the pool).


  • As you can see, every step in turn needs more explanations. Please let me know if I can be of any more help.
    Regards.


    I think, therefore I exist -- Rene Descartes
     
    I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
     
    subject: insert data usinstateless sessionbean
     
    Similar Threads
    After insert statement, how do I get column value populated by DB trigger
    Game on SQL
    Insert arabic data in database through jsp file
    Can we insert data in view
    How to convert FormFile into BLOB object?