Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using Hibernate with Session Bean

 
Prateek Jauhari
Greenhorn
Posts: 26
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • 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
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you started by looking at the documentation? If not this is a good place to begin.
 
Sunny Bhandari
Ranch Hand
Posts: 448
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • 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 Java Spring
  • Mark post as helpful
  • send pies
  • 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
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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 Java Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • 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 Java Spring
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic