on 09-12-2006 6:32 AM
Hi
I am not able to configure hibernate with a session bean in NWDS.
I have taken a EJB project,in that i have created a seesion bean.In session bean i have written the following
code
public class SampleSessionBean implements SessionBean {
private SessionContext myContext;
private Session session;
public void ejbRemove() {
}
public void ejbActivate() {
}
public void ejbPassivate() {
}
public void setSessionContext(SessionContext context) {
myContext=context;
this.session=HibernateSessionSingleton.currentSession();
}
/**
Business Method.
*/
public String inserData(Date theDate, String strTitle)
{
Configuration cfg=new Configuration().addFile("hibernate.cfg.xml");
Transaction tx=session.beginTransaction();
Sample sa=new Sample();
sa.setDate(theDate);
sa.setTitle(strTitle);
session.save(sa);
tx.commit();
return null;
}
/**
Create Method.
*/
public void ejbCreate() throws CreateException {
// TODO : Implement
}
}
I have created hibenate.cfg.xml in EJB root.
It is giving error lik hibernate.cfg.xml in not found.
I am getting the Same code with javaprogram.I am not able to do with Session beans.
thanks and Regards
Satyam
Satya,
Check this document: https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/bf0d57db-0c01-0010-6fa3-835....
Probably it helps you.
Valery Silaev
EPAM Systems
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.