File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
hibernate-core/src/main/java/org/hibernate/mapping Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 3838
3939import static java .util .Collections .emptyList ;
4040import static java .util .Collections .unmodifiableList ;
41+ import static org .hibernate .internal .util .StringHelper .isBlank ;
4142
4243/**
4344 * A mapping model object representing a property or field of an {@linkplain PersistentClass entity}
@@ -184,17 +185,23 @@ else if ( elementType instanceof ComponentType componentType ) {
184185 }
185186
186187 private static CascadeStyle getCascadeStyle (String cascade ) {
187- if ( cascade ==null || cascade .equals ("none" ) ) {
188+ if ( cascade ==null || cascade .equals ("none" ) || isBlank ( cascade ) ) {
188189 return CascadeStyles .NONE ;
189190 }
190191 else {
191192 final StringTokenizer tokens = new StringTokenizer (cascade , ", " );
192- final CascadeStyle [] styles = new CascadeStyle [ tokens .countTokens () ] ;
193- int i =0 ;
194- while ( tokens .hasMoreTokens () ) {
195- styles [i ++] = CascadeStyles .getCascadeStyle ( tokens .nextToken () );
193+ final int length = tokens .countTokens ();
194+ if ( length == 1 ) {
195+ return CascadeStyles .getCascadeStyle ( tokens .nextToken () );
196+ }
197+ else {
198+ final CascadeStyle [] styles = new CascadeStyle [length ];
199+ int i = 0 ;
200+ while ( tokens .hasMoreTokens () ) {
201+ styles [i ++] = CascadeStyles .getCascadeStyle ( tokens .nextToken () );
202+ }
203+ return new CascadeStyles .MultipleCascadeStyle ( styles );
196204 }
197- return new CascadeStyles .MultipleCascadeStyle (styles );
198205 }
199206 }
200207
You can’t perform that action at this time.
0 commit comments