Skip to content

Commit 0c8ac1c

Browse files
committed
HHH-18640 - Add note to migration guide about @table and subclasses
1 parent 67fbc97 commit 0c8ac1c

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

migration-guide.adoc

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,32 @@ The behaviour of `jakarta.persistence.criteria.Expression#as(Class)` has been ch
105105
In order to perform an actual typecast, `org.hibernate.query.criteria.JpaExpression#cast(Class)` can be used.
106106

107107
E.g.
108-
```
108+
109+
[source,java]
110+
----
109111
( (JpaExpression) from.get( "theInt" ) ).cast( String.class )
110-
```
112+
----
113+
114+
115+
[[table-annotation-subclasses]]
116+
== @Table and SINGLE_TABLE inheritance
117+
118+
In previous versions, `@Table` on a subclass in a SINGLE_TABLE hierarchy was simply ignored. E.g.
119+
120+
[source,java]
121+
----
122+
@Entity
123+
@Inherited
124+
class RootClass {
125+
// ...
126+
}
127+
@Entity
128+
@Table(...)
129+
class SubClass extends RootClass {
130+
// ...
131+
}
132+
----
133+
134+
As part of a larger effort toward better annotation validation, this now results in a mapping exception.
135+
All classes in the hierarchy are stored to a single table as defined by the root. `@Table` on the subclasses is,
136+
at best, confusing.

0 commit comments

Comments
 (0)