title: Hibernate error "operator does not exist: bigint = character varying"
body: <p>I'm using hibernate to read my database datas but i'm having a issue with the relationship of the tables when i run a query. And i don't find the reason
  That's the error:</p>
  <p>2021-01-23 18:16:55.427  WARN 1192 --- [nio-8080-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState: 42883
  2021-01-23 18:16:55.427 ERROR 1192 --- [nio-8080-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : ERROR: operator does not exist: bigint = character varying
  Dica: No operator matches the given name and argument types. You might need to add explicit type casts.
  Posição: 384</p>
  <p>That's the query:</p>
  <pre><code>public interface QueryUsuario extends CrudRepository&lt;EntidadeUsuario, Integer&gt; {
      
      @Query(value = &quot;select * from usuario where email = :email&quot;, nativeQuery = true)
      public EntidadeUsuario consultaUsuarioPorPorEmail(@Param(&quot;email&quot;) String email); 
  
  }
  </code></pre>
  <p>And that's how I call the query:</p>
  <pre><code>public void consultaUsuario(String email) {
      var x = queryUsuario.consultaUsuarioPorPorEmail(email);
  }
  </code></pre>
  <p>Entities:</p>
  <pre><code>@Getter
  @Setter
  @Table(name = &quot;usuario&quot;)
  @Entity
  public class EntidadeUsuario {
  
      @Id
      @Column(name = &quot;id_usuario&quot;)
      String idUsuario;
      
      @Column(name = &quot;cd_usuario&quot;)
      String usuario;
      
      @Column(name = &quot;senha&quot;)
      String senha;
      
      @Column(name = &quot;email&quot;)
      String email;
  
      @Column(name = &quot;nome&quot;)
      String nome;
      
      @Column(name = &quot;descricao&quot;)
      String descricao;
      
      @Column(name = &quot;endereco&quot;)
      String endereco;
      
      @Column(name = &quot;foto&quot;)
      String fotoBase64;
  
      @Column(name = &quot;dt_atz&quot;)
      Date data;
  
      @OneToMany(mappedBy = &quot;idUsuario&quot;)
      private List&lt;EntidadeUsuarioCursos&gt; entidadeUsuarioCursos;
      
      // @OneToMany(mappedBy = &quot;usuario&quot;)
      // private List&lt;EntidadeGrupoEstudoUsuario&gt; entidadeGrupoEstudoUsuario;
  }
  
  @Getter
  @Setter
  @Table(name = &quot;usuario_perfil_cursos_interesse&quot;)
  @Entity
  
      public class EntidadeUsuarioCursos {
      
          @Id
          @Column(name = &quot;id_usuario_perfil_cursos_interesse&quot;)
          Integer idUsuarioPerfilCursosInteresse;
          
          @Getter(AccessLevel.NONE)
          @ManyToOne
          @JoinColumn(name = &quot;id_usuario&quot;)
          EntidadeUsuario idUsuario;
          
          @Column(name = &quot;id_curso&quot;)
          Integer idCurso;
          
          @Column(name = &quot;dt_atz&quot;)
          Date data;
          
      }
  </code></pre>
  <p>sql script:</p>
  <pre><code>CREATE TABLE public.usuario (
      id_usuario bigint DEFAULT nextval('public.usuario_id_seq'::regclass) NOT NULL,
      cd_usuario character varying NOT NULL,
      senha character varying NOT NULL,
      dt_atz timestamp(0) without time zone,
      email character varying,
      nome character varying,
      endereco character varying,
      descricao character varying,
      foto bytea
  );
  
  ALTER TABLE ONLY public.usuario
      ADD CONSTRAINT usuario_pk PRIMARY KEY (id_usuario);
  
  CREATE TABLE public.usuario_perfil_cursos_interesse (
      id_usuario bigint NOT NULL,
      id_curso bigint NOT NULL,
      dt_atz timestamp(0) without time zone,
      id_usuario_perfil_cursos_interesse bigint DEFAULT nextval('public.usuario_perfil_cursos_interesse_id_seq'::regclass) NOT NULL
  );
  ALTER TABLE ONLY public.usuario_perfil_cursos_interesse
      ADD CONSTRAINT usuario_perfil_cursos_interesse_fk FOREIGN KEY (id_usuario) REFERENCES public.usuario(id_usuario);
  ALTER TABLE ONLY public.usuario_perfil_cursos_interesse
      ADD CONSTRAINT usuario_perfil_cursos_interesse_fk_1 FOREIGN KEY (id_curso) REFERENCES public.curso(id_curso);
  </code></pre>