File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes should I use transaction for this scenario ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "should I use transaction for this scenario ?" Watch "should I use transaction for this scenario ?" New topic
Author

should I use transaction for this scenario ?

Artemesia Lakener
Ranch Hand

Joined: Jun 21, 2005
Posts: 162
If I want to build a secure java web application --- it lets user login from web page, then they can simply update the database tables by entering new data. These tables are accessible by other applications, in other words, another different application may be retrieving data from the table at the same time.

For this scenario, should I

1. use stateful or stateless session bean to implement the user updating database process ?
2. should I use transaction for the database updating part ?
3. can I just implement the database updating part in my session bean (I can use JDBC to connect to database and run query) without introducing any EJB ?
Daniel Rhoades
Ranch Hand

Joined: Jun 30, 2004
Posts: 186
1. Depends on your requirements, does the update need to happen after multiple calls to the Session Bean? - if not use stateless

2. Depends on your requirements, but generally you don't want people accessing records you are updating - and you may want to roll the operation back on an error

3. You mean can you use JDBC calls in a Session Bean instead of creating a Entity Bean to do the work - yes you can... but Entity Beans exist in the spec for a reason - they do the ORM (object relational mapping) fairly easily. There are also other persistance mechanisms you can use instead of Entity Beans.

Think separation of concerns...


Drinking more tea is the key...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: should I use transaction for this scenario ?