Skip to content

Commit 7f0777e

Browse files
committed
HBX-2789: Review WrapperFactory class and create only new Wrapper intances
- Handle 'null' case in method 'org.hibernate.tool.orm.jbt.internal.factory.PersistentClassWrapperFactory.PersistentClassWrapperImpl#setTable(TableWrapper)' Signed-off-by: Koen Aers <[email protected]>
1 parent 28337ca commit 7f0777e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/PersistentClassWrapperFactory.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,14 @@ public PropertyWrapper getProperty() {
102102
}
103103

104104
@Override
105-
public void setTable(TableWrapper table) {
105+
public void setTable(TableWrapper tableWrapper) {
106+
Table table = tableWrapper == null ? null : (Table)tableWrapper.getWrappedObject();
106107
if (isInstanceOfRootClass()) {
107-
((RootClass)persistentClass).setTable((Table)table.getWrappedObject());
108+
((RootClass)persistentClass).setTable(table);
108109
} else if (isInstanceOfJoinedSubclass()) {
109-
((JoinedSubclass)persistentClass).setTable((Table)table.getWrappedObject());
110+
((JoinedSubclass)persistentClass).setTable(table);
110111
} else if (isInstanceOfSpecialRootClass()) {
111-
((SpecialRootClass)persistentClass).setTable((Table)table.getWrappedObject());
112+
((SpecialRootClass)persistentClass).setTable(table);
112113
} else {
113114
throw new RuntimeException("Method 'setTable(Table)' is not supported.");
114115
}

0 commit comments

Comments
 (0)