hi, i have hibernate working as service in jboss, just like it is explainded in
http://www.hibernate.org/66.html . It is working fine, but now i want to create a session bean and use the service, but i get errors and i dont know how to fix it, thats the example of the bean (i've made it whit lomboz plugin for eclipse) . I've read all docs i found, but i can't make it work if somebody could fix that class or publish a similar working exmple i'll be very glad
TIA
/*
* Created on Nov 10, 2003
*
* To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package com.droplabs;
import javax.ejb.SessionBean;
import javax.naming.*;
import java.util.*;
import net.sf.hibernate.*;
/**
* @ejb.bean name="Hib"
* jndi-name="HibBean"
* type="Stateless"
**/
public abstract class HibBean implements SessionBean {
/**
* @ejb.interface-method
* tview-type="remote"
**/
public String setProducto(String product_id){
Properties p = new Properties();
//The JNDI properties you set depend
//on which server you are using.
//These properties are for the Remote Server.
p.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
p.put("java.naming.provider.url", "127.0.0.1");
p.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
Context ctx = new InitialContext(p);
SessionFactory factory = (SessionFactory) ctx.lookup("java:/hibernate/HibernateFactory");
Session sess = factory.openSession();
Transaction transaction = sess.beginTransaction();
/* HERE IS WHER I HAVE THE ERROR, OBVIOUS I DON'T HAVE REFERENCES TO PRODUCT CLASS */
Product princess = new Product();
princess.Product("Princess");
sess.save(princess);
transaction.commit();
sess.close();
return "ok";
}
}