UUID field mapping

23 views
Skip to first unread message

Brian Miles

unread,
Nov 24, 2017, 10:16:42 AM11/24/17
to Querydsl
Hello,

I am experimenting with using Querydsl on a PostgreSQL database that uses time-based UUIDs for primary keys. The problem I am having is that the generated classes from Querydsl are mapping the UUID columns to SimplePath<byte[]>. This means it is not possible to (or at least I haven't figured out how to) order query results in ascending order based on the time-based UUID key. It seems like mapping the UUID columns to something like ComparablePath<UUID> would be more appropriate.

I can get the UUID columns to map to java.util.UUID instead of byte[] as follows:

<typeMappings>
  <typeMapping>
    <table>FOO</table>
    <column>ID</column>
    <type>java.util.UUID</type>
  </typeMapping>
</typeMappings>

As per here, however the final mapped type is still SimplePath<UUID>. Is there anyway to customize the mapping to force it to be ComparablePath<UUID>?


Thanks,


Brian


Reply all
Reply to author
Forward
0 new messages