[jboss-user] [Installation, Configuration & DEPLOYMENT] - Re: how to configure jaas with jboss 5.0.1

BjPenn do-not-reply at jboss.com
Wed Mar 18 04:43:00 EDT 2009


mmmm i am not using in any moment any class of Hibernate, all i am doing is to incorporate to the project a couple jars of TopLink.
the controler.UsuarioC is a class in my project here is the constructor:

package controller;
  | 
  | import java.util.List;
  | import javax.persistence.EntityManager;
  | import javax.persistence.EntityManagerFactory;
  | import javax.persistence.PersistenceUnit;
  | import persistencia.EntidadesT;
  | import persistencia.UsuariosT;
  | 
  | /**
  |  *
  |  * @author Administrador
  |  */
  | public class usuariosC {
  | 
  |     private int usuariosK;
  |     private int entidadK;
  |     //@PersistenceUnit(unitName = "jtoolkitfwPU")
  |     private EntityManagerFactory emf = null;
  | 
  |     private EntityManager em = null;
  | 
  |     public usuariosC() {
  |         //Creamos el Factory en base a la Persistence Unit = JavaApplication1PU
  |         emf = javax.persistence.Persistence.createEntityManagerFactory("jtoolkitfwPU");
  | 
  |         //Creamos en Entity
  |         //em = new act.persistence.ControllerTK().getEntityManager();
  |         em = emf.createEntityManager();
  |     }
  |     
  |     /**
  |      * @return the usuariosK
  |      * Buscar objeto usuario por nomusuario
  |      */
  |     public UsuariosT getUsuarios(String usuario) {
  |         List<UsuariosT> usuarios = em.createNamedQuery("UsuariosT.findByNomusuario").setParameter("nomusuario", usuario).getResultList();
  |         UsuariosT user = usuarios.get(0);
  |         return user;
  |     }
  | 
  |     
  |     /**
  |      * @return the usuariosK
  |      * Buscar usuarioK por nomusuario
  |      */
  |     public int getUsuariosK(String usuario) {
  |         List<UsuariosT> usuarios = em.createNamedQuery("UsuariosT.findByNomusuario").setParameter("nomusuario", usuario).getResultList();
  |         //UsuariosT user = usuarios.get(0);
  |         int userk = usuarios.get(0).getUsuarioK();
  |         return userk;
  |     }
  | 
  |     /**
  |      * @param usuariosK the usuariosK to set
  |      */
  |     public void setUsuariosK(int usuariosK) {
  |         this.usuariosK = usuariosK;
  |     }
  |     
  |     /**
  |      * @return the entidadK
  |      * Buscar el objeto Entidad por nomusuario
  |      */
  | 
  |     public EntidadesT getEntidad(String usuario) {
  | 
  | 
  |         List<UsuariosT> usuarios = em.createNamedQuery("UsuariosT.findByNomusuario").setParameter("nomusuario", usuario).getResultList();
  |         UsuariosT user = usuarios.get(0);
  |         EntidadesT ent = user.getEntidadK();
  |         return ent;
  |     }
  |     public String getNomEntidad(String usuario) {
  | 
  | 
  |         List<UsuariosT> usuarios = em.createNamedQuery("UsuariosT.findByNomusuario").setParameter("nomusuario", usuario).getResultList();
  |         UsuariosT user = usuarios.get(0);
  |         EntidadesT ent = user.getEntidadK();
  |         return ent.getNomentidad();
  |     }
  |     
  |     /**
  |      * @return the entidadK
  |      * Buscar EntidadK por nomusuario
  |      */
  | 
  |     public int getEntidadK(String usuario) {
  | 
  | 
  |         List<UsuariosT> usuarios = em.createNamedQuery("UsuariosT.findByNomusuario").setParameter("nomusuario", usuario).getResultList();
  |         UsuariosT user = usuarios.get(0);
  |         EntidadesT ent = user.getEntidadK();
  |         return ent.getEntidadK();
  |     }
  | 
  |     /**
  |      * @param entidadK the entidadK to set
  |      */
  |     public void setEntidadK(int entidadK) {
  |         this.entidadK = entidadK;
  |     }
  |     /**
  |      *  Cerrar el factory y el entity
  |      */
  |     public void cerrar(){
  |         em.close();
  |         emf.close();
  |     }
  | }

my error was to not add the two TopLink jars to the project, but i still get the same error even after adding it.
so is there any XML file that i have to specify that the type of the persistence i am using is TopLink ? cause i think Jboss takes Hibernate by default.
thanks for your replies


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4218924#4218924

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4218924



More information about the jboss-user mailing list