You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: migration-guide.adoc
+86-88Lines changed: 86 additions & 88 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ For many years Hibernate has used the Hibernate Commons Annotations (HCANN) libr
41
41
related to understanding the structure of an application domain model, reading annotations and weaving in XML
42
42
mapping documents.
43
43
44
-
However, HCANN suffers from a number of limitations that continue to be problematic. And given
44
+
However, HCANN suffers from a number of limitations that continued to be problematic. And given
45
45
the use of HCANN across multiple projects, doing the needed refactoring was simply not possible.
46
46
47
47
The https://github.com/hibernate/hibernate-models[Hibernate Models] project was developed to be a better alternative
@@ -50,16 +50,16 @@ annotations. Check out its project page for complete details.
50
50
51
51
7.0 uses Hibernate Models in place of HCANN.
52
52
53
-
NOTE: Currently, the `hibernate-envers` module still uses HCANN. That will change during continued 7.0 development.
53
+
NOTE: Currently, the `hibernate-envers` module still uses HCANN. That will change during continued 7.x development.
54
54
55
55
56
56
57
-
[[annotation-validation]]
58
-
== Annotation Validations
57
+
[[model-validation]]
58
+
== Domain Model Validations
59
59
60
60
7.0 adds many more checks about illegal use of annotations.
61
61
62
-
62
+
[[PersistentAttributeType]]
63
63
=== PersistentAttributeType
64
64
65
65
As of 7.0, Hibernate applies much better validation of an attribute specifying multiple PersistentAttributeTypes.
@@ -100,9 +100,74 @@ class Book {
100
100
// previously ignored, this is an error now
101
101
@Column(name="category")
102
102
String getType() { ... }
103
+
}
104
+
----
105
+
106
+
[[java-beans]]
107
+
=== JavaBean Conventions
108
+
109
+
Previous versions allowed some questionable (at best) attribute naming patterns. These are no longer supported. E.g.
110
+
111
+
[source,java]
112
+
----
113
+
@Basic
114
+
String isDefault();
115
+
----
116
+
117
+
118
+
119
+
[[flush-persist]]
120
+
== Session flush and persist
121
+
122
+
The removal of `CascadeType.SAVE_UPDATE` slightly changes the persist and flush behaviour to conform with Jakarta Persistence.
123
+
124
+
Persisting a transient entity or flushing a manged entity with an associated detached entity having the association annotated with `cascade = CascadeType.ALL` or `cascade = CascadeType.PERSIST` throws now an `jakarta.persistence.EntityExistsException` if the detached entity has not been re-associated with the Session.
125
+
126
+
To re-associate the detached entity with the Session the `Session#merge` method can be used.
Assuming we have `c1` as a detached `Child`, the following code will now result in `jakarta.persistence.EntityExistsException` being thrown at flush time:
@@ -123,36 +188,6 @@ as part of schema generation. 7.0 adds the same capability for enums mapped usi
123
188
by asking the converter to convert all the enum constants on start up.
124
189
125
190
126
-
[[java-beans]]
127
-
== JavaBean Conventions
128
-
129
-
Previous versions allowed some questionable (at best) attribute naming patterns. These are no longer supported. E.g.
130
-
131
-
[source,java]
132
-
----
133
-
@Basic
134
-
String isDefault();
135
-
----
136
-
137
-
138
-
139
-
[[cleanup]]
140
-
== Some Cleanup
141
-
142
-
* Removed `SqmQualifiedJoin`. All joins are qualified.
143
-
* Removed `AdditionalJaxbMappingProducer`, deprecated in favor of `AdditionalMappingContributor`
144
-
* Removed `MetadataContributor`, deprecated in favor of `AdditionalMappingContributor`
145
-
* Removed `@Persister`.
146
-
* Removed `hibernate.mapping.precedence` and friends
147
-
* Removed `org.hibernate.Session#save(Object object)` and `org.hibernate.Session#save(String entityName, Object object)` in favor of `org.hibernate.Session#persist(Object object)` and `org.hibernate.Session#persist(String entityName, Object object)`
148
-
* Removed `org.hibernate.Session#saveOrUpdate(Object object)` and `org.hibernate.Session#saveOrUpdate(String entityName, Object object)` in favor `persist` if the entity is transient or `merge` if the entity is detached.
149
-
* Removed `org.hibernate.Session#update(Object object` and `org.hibernate.Session#update(String entityName, Object object)` in favor of `org.hibernate.Session.merge(T object)` and `org.hibernate.Session.merge(String entityName, T object)`
150
-
* Removed `org.hibernate.annotations.CascadeType.SAVE_UPDATE` in favor of `org.hibernate.annotations.CascadeType.PERSIST` + `org.hibernate.annotations.CascadeType.MERGE`
151
-
* Removed `@SelectBeforeUpdate`
152
-
* Removed `org.hibernate.Session#delete(Object object)` and `org.hibernate.Session#delete(String entityName, Object object)` in favor of `org.hibernate.Session#remove(Object object)`
153
-
* Removed `org.hibernate.annotations.CascadeType.DELETE` in favor of `org.hibernate.annotations.CascadeType#REMOVE`
154
-
* Removed the attribute value from `@DynamicInsert` and `@DynamicUpdate`
155
-
156
191
[[ddl-implicit-datatype-timestamp]]
157
192
== Default precision for timestamp on some databases
158
193
@@ -194,61 +229,24 @@ one file at a time. This is now done across the entire set of `hbm.xml` files a
194
229
While most users will never see this change, it might impact integrations which tie-in to
195
230
XML processing.
196
231
197
-
[[flush-persist]]
198
-
== Session flush and persist
199
-
200
-
The removal of `CascadeType.SAVE_UPDATE` slightly changes the persist and flush behaviour (not affecting application using `Entitymanager`) that now conforms with the Jakarta JPA specifications.
201
-
202
-
Persisting a transient entity or flushing a manged entity with an associated detached entity having the association annotated with `cascade = CascadeType.ALL` or `cascade = CascadeType.PERSIST` throws now an `jakarta.persistence.EntityExistsException` if the detached entity has not been re-associated with the the Session.
203
-
204
-
To re-associate the detached entity with the Session the `Session#merge` method can be used.
Instead, c1 must first be re-associated with the Session using merge:
236
+
* Removed `SqmQualifiedJoin`. All joins are qualified.
237
+
* Removed `AdditionalJaxbMappingProducer`, deprecated in favor of `AdditionalMappingContributor`
238
+
* Removed `MetadataContributor`, deprecated in favor of `AdditionalMappingContributor`
239
+
* Removed `@Persister`.
240
+
* Removed `hibernate.mapping.precedence` and friends
241
+
* Removed `org.hibernate.Session#save` in favor of `org.hibernate.Session#persist`
242
+
* Removed `org.hibernate.Session#saveOrUpdate` in favor `#persist` if the entity is transient or `#merge` if the entity is detached.
243
+
* Removed `org.hibernate.Session#update` in favor of `org.hibernate.Session.merge`
244
+
* Removed `org.hibernate.annotations.CascadeType.SAVE_UPDATE` in favor of `org.hibernate.annotations.CascadeType.PERSIST` + `org.hibernate.annotations.CascadeType.MERGE`
245
+
* Removed `@SelectBeforeUpdate`
246
+
* Removed `org.hibernate.Session#delete` in favor of `org.hibernate.Session#remove`
247
+
* Removed `org.hibernate.annotations.CascadeType.DELETE` in favor of `org.hibernate.annotations.CascadeType#REMOVE`
248
+
* Removed the attribute value from `@DynamicInsert` and `@DynamicUpdate`
0 commit comments