4 Replies Latest reply on May 7, 2007 6:32 AM by oskar.carlstedt

    what´s the error

    sashaxiv

      Jboss tells me:

      javax.persistence.PersistenceException: org.hibernate.MappingException: Could not determine type for: com.satdatatelecom.satdataweb.model.usuario.ejb.UsuarioEJB, for columns: [org.hibernate.mapping.Column(idUsuario)]

      this is my code:

      @Entity
      @Table(name="usuario")
      public class UsuarioEJB {

      private Double idUsuario;
      private String login;
      private String password;
      private Integer mensajes;
      private Boolean borrado;
      private UsuarioDetallesEJB usuariodetalles;
      private EmpresaEJB empresa;
      private SessionEJB session;
      private ConfUsuarioEJB confUsuarioEJB;
      private List concesiones;

      .......................

      @Id
      @Column(name="idUsuario")
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      public Double getUsuario(){
      return this.idUsuario;
      }


      public void setUsuario(Double idUsuario){
      this.idUsuario = idUsuario;
      }
      ...................

      in other aplications i use Long instead Double for id attributes. Can be this
      the error? I can´t understand it.

      Please help!! Thanks everybody

        • 1. Re: what´s the error
          oskar.carlstedt

          Are you sure you want to use Double as you id type. Normally databases are using integers for ids. Try to use Long ,or Integer if you can gurarantee that you won't exceed the max int value, instead?

          With kind regards
          Oskar

          • 2. Re: what´s the error
            sashaxiv

            thanks Oscar, i tried to use Long and the error persists.....

            • 3. Re: what´s the error
              sashaxiv

              i think this is interesting. I fixed my error but it was not in my UsuarioEJb class!! Jboss was misleading me. The error was in other class related to UsuarioEJb

              i had
              Column(name="idUsuario", updatable=false, insertable=false)

              public UsuarioEJB getUsuario(){
              return this.usuario;
              }

              and this is how i fixed the error

              @ManyToOne
              @JoinColumn(name="idUsuario", updatable=false, insertable=false)

              public UsuarioEJB getUsuario(){
              return this.usuario;
              }

              i think jboss should have other trace for the error.

              Regards!!

              • 4. Re: what´s the error
                oskar.carlstedt

                Good work!

                Sometimes it is hard for JBoss to find a good error message. When you specify the column annotation, JBoss tries to save/serialize the object into that column, no matter of what type it is. So in this case, JBoss finds the UsuarioEJB and then i tries to save it into the column idUsuario - and here is the place where everything goes wrong. How can Jboss serialize UsuarioEJB into the specified column, it doesn't have a type for it, ...

                //Oskar