Skip to content

Instantly share code, notes, and snippets.

@de314
Created August 23, 2017 02:39
Show Gist options
  • Save de314/23ecfd90e521ffb13e5021266d7773a7 to your computer and use it in GitHub Desktop.
Save de314/23ecfd90e521ffb13e5021266d7773a7 to your computer and use it in GitHub Desktop.
SQL HEX
SELECT
LOWER(CONCAT(
SUBSTR(HEX(user_id), 1, 8), '-',
SUBSTR(HEX(user_id), 9, 4), '-',
SUBSTR(HEX(user_id), 13, 4), '-',
SUBSTR(HEX(user_id), 17, 4), '-',
SUBSTR(HEX(user_id), 21)
)) as userId
FROM user
WHERE company_id = unhex(replace('9c00fd3e-cd10-4797-8fb8-2fb433690ea6','-',''));
# Spring Data
# @Column(columnDefinition = "binary(16)", name="user_id", nullable = false)
# private UUID userId;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment