Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
App Blocks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Genesys PGR
App Blocks
Commits
e27ee1fc
Commit
e27ee1fc
authored
Feb 25, 2019
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use @Type(type = "uuid-binary") for UUID
parent
6dc323df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
core/src/main/java/org/genesys/blocks/model/IdUUID.java
core/src/main/java/org/genesys/blocks/model/IdUUID.java
+3
-2
core/src/main/java/org/genesys/blocks/model/UuidModel.java
core/src/main/java/org/genesys/blocks/model/UuidModel.java
+4
-1
No files found.
core/src/main/java/org/genesys/blocks/model/IdUUID.java
View file @
e27ee1fc
...
...
@@ -23,8 +23,9 @@ import java.util.UUID;
* UUID column should not be updatable:
*
* <pre>
* @Column(updatable = false, nullable = false, columnDefinition = "binary(16)")
* private UUID uuid;
* @Column(unique = true, updatable = false, nullable = false)
* @@Type(type = "uuid-binary")
* protected UUID uuid;
* </pre>
*
* The entity must generate a UUID before persisting the data:
...
...
core/src/main/java/org/genesys/blocks/model/UuidModel.java
View file @
e27ee1fc
...
...
@@ -21,6 +21,8 @@ import javax.persistence.Column;
import
javax.persistence.MappedSuperclass
;
import
javax.persistence.PrePersist
;
import
org.hibernate.annotations.Type
;
import
com.fasterxml.jackson.annotation.JsonIdentityInfo
;
import
com.fasterxml.jackson.annotation.ObjectIdGenerators
;
...
...
@@ -35,7 +37,8 @@ public abstract class UuidModel extends AuditedVersionedModel implements IdUUID
private
static
final
long
serialVersionUID
=
2639238742778129554L
;
/** The uuid. */
@Column
(
unique
=
true
,
updatable
=
false
,
nullable
=
false
,
columnDefinition
=
"binary(16)"
)
@Column
(
unique
=
true
,
updatable
=
false
,
nullable
=
false
)
@Type
(
type
=
"uuid-binary"
)
protected
UUID
uuid
;
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment