• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

transaction in session bean

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

i want to know do i need to maintain transaction in Session Bean or Hibernate

if my project is having this architechture in order.


jsp , action servlet , request processor , action , business delegate, session bean, dao , hibernate components, then database .


1..which one is better ?
2..or it is mandratory to maintain in session bean ?

thanks,

vinay rajnish
 
author & internet detective
Posts: 42145
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vinay,
I would think the session bean is better because it is at a higher level. This allows all the database calls to be in the same transaction. If that is your desired behavior, the session bean transactions gives this to you easily.

The session bean is not required to have a transaction though. You can use "never" as the value.
 
vianyrajnish rajnish
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ,


But hibernate too has the transaction maintainence capability ....


then which one to use....


first of all I want to know why the session beans are used ....we can directly access hibernate components from th Action , BD , DAO.

please help me ....confused

Regards,
vinay rajnish
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hibernate supports JDBC, JTA and container-managed transactions. You need to decide which is best for your application. Coming from the EJB world, I have to admit to being biased in favour of CMT session beans.
 
Jeanne Boyarsky
author & internet detective
Posts: 42145
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vinay,
Session beans do more than just transactions. They also handle security (among other things.) Also, using the session bean for the transaction layer makes it easier to change the back end data access technology in the future because you transaction is at the facade level. Again, this assumes you WANT a transaction at the facade level.

As Roger pointed out, it depends on your specific application. On apps I have worked on, the session bean level was almost always the right level for the transaction.
 
reply
    Bookmark Topic Watch Topic
  • New Topic