I have an SQL Enum:
CREATE TYPE position as ENUM ('G','W','D');
PreparedStatement ps = connection.prepareStatement("UPDATE players
SET position = ? WHERE id = 1");
position = ?::position
position = CAST(? AS position)
You will need to quote the name of your enum when you cast:
PreparedStatement stmt = con.prepareStatement("update players set position = ?::\"position\" where id = 1");
The syntax error is happening because POSITION is a keyword. Wrapping it in double quotes forces postgres to parse it as an identifier.
Probably a good idea to use a different name for the enum.