Slick, UUID and Postgres

I am trying to map java.util.UUIDto a Slick column, which should be possible according to this: https://github.com/slick/slick/issues/79

I define the columns as follows:

def id = column[UUID]("id", O.PrimaryKey, O.DBType("UUID"))

According to the Github issue related above, manually redefining DBType should not be necessary, but I could not get it to work without it.

The error I get when I try to insert a line in Postgres is this:

org.postgresql.util.PSQLException: 
ERROR: column "id" is of type uuid but expression is of type bytea 

Mapping from java.util.UUIDto Postgres type uuiddoes not seem to work.

I use the following versions of the artifact:

"com.typesafe.slick" %% "slick" % "2.0.1",
"org.slf4j" % "slf4j-nop" % "1.6.4",
"org.postgresql" % "postgresql" % "9.3-1101-jdbc41"

My version of postgres $ psql - psql version (PostgreSQL) 9.3.3

What am I doing wrong?

+4
source share

Source: https://habr.com/ru/post/1534648/


All Articles