Dear,
I try the UUID type but failed. Following exception:
Code:
Caused by: java.sql.BatchUpdateException: Batch-Eintrag 0 insert into ClassToPersist (name, vorname, uuid) values ('jkfdhjks', NULL, '<stream of 16 bytes>') wurde abgebrochen. Rufen Sie 'getNextException' auf, um die Ursache zu erfahren.
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2598)
at org.postgresql.core.v3.QueryExecutorImpl$1.handleError(QueryExecutorImpl.java:459)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2737)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
... 16 more
getNextException() =
Code:
org.postgresql.util.PSQLException: FEHLER: Spalte »uuid« hat Typ uuid, aber der Ausdruck hat Typ bytea
Hinweis: Sie müssen den Ausdruck umschreiben oder eine Typumwandlung vornehmen.
Position: 66
Code:
SQLState: 42804
My Id Field is annotated as the following:
Code:
@Id
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "uuid2", parameters = { @Parameter(name = "org.hibernate.id.uuid.StandardRandomStrategy", value = "") })
@Column(columnDefinition = "uuid")
private UUID uuid;
I try to insert a UUID with plain jdbc. If I try:
Code:
PreparedStatement ps = DriverManager.getConnection("").prepareStatement("INSERT INTO TABLE (uuid) VALUES (?)");
ps.setObject(1, UUID.randomUUID());
with success. The mapping in the PostgresSQLDialect seems correctly.
My exact Postgres Version is: 8.4.8
Can you please help me? Whats wrong?