After discussing the matter with Steve, I've created https://hibernate.atlassian.net/browse/HHH-8757 for this and will create a PR for the change.
2013/11/26 Gunnar Morling <gun...@hibernate.org> > Thoughts, anyone? Steve? > > Thanks, > > --Gunnar > > > > 2013/11/21 Gunnar Morling <gun...@hibernate.org> > >> All, >> >> I'm working on supporting on the CouchDB backend for OGM, and more >> specifically on integrating the optimistic locking functionality which is >> built into CouchDB [1]. >> >> For that purpose, each CouchDB document has a defined field "_rev" which >> is a UUID and is updated on the server-side upon each write. So I thought I >> could map this attribute like this: >> >> @Generated //this prop. needs to be read back value after writes >> @Version //this prop. is used for optimistic locking >> String _rev; >> >> But this gave me a CCE since @Version is not allowed on Strings >> (org.hibernate.type.StringType is no VersionType). >> >> Looking around, I found BinaryType which looks like what'd I need for >> Strings, there is also a note mentioning basically the same use case case >> [2]. If I register a custom type derived from StringType with an equivalent >> implementation of the VersionType contract, I get the behavior I need. >> >> Does anyone see a problem with making o.h.t.String a VersionType in this >> way (i.e. it'd only support DB-generated values)? >> >> Thanks, >> >> --Gunnar >> >> [1] https://hibernate.atlassian.net/browse/OGM-392 >> [2] "only known application of binary types for versioning is for use >> with the TIMESTAMP datatype supported by Sybase and SQL Server, which are >> completely db-generated values" >> >> > _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev