java - How to handle Postgresql UUIDs with Hibernate -


i'm adding jpa (hibernate) project uses uuids in postgresql. uuids postgresql uuid type.

i've followed these instructions , added hibernate annotations this:

@column(name = "uid") @type(type="pg-uuid") private uuid uid; 

hibernate supposedly added support postgres uuids in hibernate 3.6. i've tried hibernate 3.6 , 4.0 both throw exception below.

the exception shows postgresql driver trying convert uuid long. i've tried 9.0-801.jdbc4 , 9.1-901.jdbc4 postgres drivers. need different database driver?

caused by: org.postgresql.util.psqlexception: bad value type long : dbada1e4-a165-4601-b34e-d08428cd81df     @ org.postgresql.jdbc2.abstractjdbc2resultset.tolong(abstractjdbc2resultset.java:2796)     @ org.postgresql.jdbc2.abstractjdbc2resultset.getlong(abstractjdbc2resultset.java:2019)     @ org.postgresql.jdbc4.jdbc4resultset.getblob(jdbc4resultset.java:52)     @ org.postgresql.jdbc2.abstractjdbc2resultset.getblob(abstractjdbc2resultset.java:335)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25)     @ java.lang.reflect.method.invoke(method.java:597)     @ org.hibernate.engine.jdbc.internal.proxy.abstractresultsetproxyhandler.continueinvocation(abstractresultsetproxyhandler.java:104)     ... 32 more 


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -