• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

using Hibernate with Session Bean

 
Greenhorn
Posts: 26
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am working over a project that uses struts, hibernate and EJB.
I am using JBoss and MySQL and Netbeans IDE.

I created a JavaEE Project in Netbeans and in EJB module I have created few entity classes from database.
Now I have to create SessionBean which activates after i log into the system and then perform few task such as create and delete users.
I am confused how to use hibernate in my session bean to read and write database....

Help Me Please....!!!
I am badly stucked with this thing.....!!!



Thanks In Advance
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you started by looking at the documentation? If not this is a good place to begin.
 
Ranch Hand
Posts: 448
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moreover, you should have mentioned the EJB version you are using.

Some sample code would have of the session bean in question is also not a bad thing to share...
 
Prateek Jauhari
Greenhorn
Posts: 26
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

This is my session bean class structure......
I am using EJB 3.0
These classes are in an EJB Module....
and i am developing a web project using struts....
now I have a form... where will submit information....
now i wanna do is that this session ejb starts when the user log in and when the user create a new user then this createUser function in session bean.... write it into the database using hibernate....

I am totally confused how to sort this thing out...


is it possible to access hibernate in an EJB module


any kind of code or tutorial will help me

Thank you in advance.....!!!
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


is it possible to access hibernate in an EJB module


Yes. There is nothing unusual about Hibernate - it is just another Java application.

The documentation I mentioned above is a good place to start.I'd recommend spending a little time writing a stand alone application, just so you can simplify the problem, then hook it into your EJB application.
 
Prateek Jauhari
Greenhorn
Posts: 26
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Paul.....
I have been through that document and it helped.
May be some more time spending on that will work out my problem...

Just a one simple question do I have to use JPA for this job to be done...???
 
Sunny Bhandari
Ranch Hand
Posts: 448
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JPA has support for using ORM frameworks like Hibernate (I mean the annotations and all)

But that is not a good reason to use JPA. There should be other reasons too like vendor neutral
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sunny Bhandari wrote:JPA has support for using ORM frameworks like Hibernate


No, that's the other way around. Hibernate offers a JPA implementation.
 
Prateek Jauhari
Greenhorn
Posts: 26
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I Have changed the overall logic for my application and now My problem is resolved

Thank you all for the concern
 
Power corrupts. Absolute power xxxxxxxxxxxxxxxx is kinda neat.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic