Reputation: 607
I have a project built on Spring MVC + Security + Hibernate. Hibernate and jdbc versions are:
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.7.Final</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1102-jdbc41</version>
</dependency>
I get this well-known error when I try to login via Spring Security form.
jan 13, 2015 12:51:05 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: operator does not exist: character varying = bytea
I have read that it can happen because of PostgreSQL and driver's versions discrepancy, but it seems OK to me.
Upvotes: 0
Views: 10039
Reputation: 16604
The foreign key is wrong. When using Hibernate/JPA, the foreign key should always point to the id (primary key) of the other table. Your foreign key references username
but it should reference id
. As an alternative, you could make username
primary key in users
table, and change entity annotations accordingly.
Upvotes: 1