File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -146,15 +146,23 @@ delete from Person p where p.association.someAttr = 1
146
146
147
147
148
148
[[manually-assigned-generated-ids]]
149
- == Manually Assigned Identifiers with @GeneratedValue
149
+ == Manually Assigned Identifiers with custom `IdentifierGenerator`s
150
150
151
- Manually assigned identifier values can now be used with `GeneratedValue` identifiers .
151
+ Manually assigned identifier values can now be used with custom `IdenfierGenerator`s thanks to the new `allowAssignedIdentifiers()` method .
152
152
153
153
[source,java]
154
154
----
155
+ class MyGenerator implements IdentifierGenerator {
156
+ ...
157
+ @Override public boolean allowAssignedIdentifiers() {
158
+ return true;
159
+ }
160
+ }
161
+
155
162
@Entity
163
+ @GenericGenerator( type = MyGenerator.class, name = "my_generator" )
156
164
class Book {
157
- @Id @GeneratedValue
165
+ @Id @GeneratedValue( generator = "my_generator" )
158
166
Integer id;
159
167
...
160
168
}
You can’t perform that action at this time.
0 commit comments