66package org .hibernate .reactive .schema ;
77
88
9+ import java .net .URL ;
10+
911import org .hibernate .boot .registry .StandardServiceRegistryBuilder ;
12+ import org .hibernate .cfg .AvailableSettings ;
1013import org .hibernate .cfg .Configuration ;
1114import org .hibernate .reactive .BaseReactiveTest ;
12- import org .hibernate .reactive .provider .Settings ;
1315import org .hibernate .reactive .annotations .DisabledFor ;
16+ import org .hibernate .reactive .annotations .EnabledFor ;
17+ import org .hibernate .reactive .provider .Settings ;
1418import org .hibernate .tool .schema .spi .SchemaManagementException ;
1519
1620import org .junit .jupiter .api .AfterEach ;
1923
2024import io .vertx .junit5 .Timeout ;
2125import io .vertx .junit5 .VertxTestContext ;
26+ import jakarta .persistence .Column ;
2227import jakarta .persistence .Entity ;
2328import jakarta .persistence .GeneratedValue ;
2429import jakarta .persistence .Id ;
2530import jakarta .persistence .Table ;
2631
2732import static java .util .concurrent .TimeUnit .MINUTES ;
2833import static org .hibernate .reactive .containers .DatabaseConfiguration .DBType .DB2 ;
34+ import static org .hibernate .reactive .containers .DatabaseConfiguration .DBType .ORACLE ;
2935import static org .hibernate .tool .schema .JdbcMetadaAccessStrategy .GROUPED ;
3036import static org .hibernate .tool .schema .JdbcMetadaAccessStrategy .INDIVIDUALLY ;
3137import static org .junit .jupiter .api .Assertions .assertEquals ;
@@ -74,6 +80,11 @@ public void before(VertxTestContext context) {
7480 Configuration createConf = constructConfiguration ( "create" );
7581 createConf .addAnnotatedClass ( BasicTypesTestEntity .class );
7682
83+ final URL importFileURL = Thread .currentThread ()
84+ .getContextClassLoader ()
85+ .getResource ( "oracle-SchemaValidationTest.sql" );
86+ createConf .setProperty ( AvailableSettings .JAKARTA_HBM2DDL_LOAD_SCRIPT_SOURCE , importFileURL .getFile () );
87+
7788 // Make sure that the extra table is not in the db
7889 Configuration dropConf = constructConfiguration ( "drop" );
7990 dropConf .addAnnotatedClass ( Extra .class );
@@ -92,6 +103,18 @@ public void after(VertxTestContext context) {
92103 closeFactory ( context );
93104 }
94105
106+ @ Test
107+ @ Timeout (value = 10 , timeUnit = MINUTES )
108+ @ EnabledFor ( ORACLE )
109+ public void testOracleColumnTypeValidation (VertxTestContext context ) {
110+ Configuration validateConf = constructConfiguration ( "validate" );
111+ validateConf .addAnnotatedClass ( Fruit .class );
112+
113+ StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder ()
114+ .applySettings ( validateConf .getProperties () );
115+ test ( context , setupSessionFactory ( validateConf ) );
116+ }
117+
95118 // When we have created the table, the validation should pass
96119 @ Test
97120 @ Timeout (value = 10 , timeUnit = MINUTES )
@@ -139,4 +162,43 @@ public static class Extra {
139162
140163 private String description ;
141164 }
165+
166+ @ Entity (name = "Fruit" )
167+ public static class Fruit {
168+
169+ @ Id
170+ @ GeneratedValue
171+ private Integer id ;
172+
173+ @ Column (name = "something_name" , nullable = false , updatable = false )
174+ private String name ;
175+
176+ public Fruit () {
177+ }
178+
179+ public Fruit (String name ) {
180+ this .name = name ;
181+ }
182+
183+ public Integer getId () {
184+ return id ;
185+ }
186+
187+ public void setId (Integer id ) {
188+ this .id = id ;
189+ }
190+
191+ public String getName () {
192+ return name ;
193+ }
194+
195+ public void setName (String name ) {
196+ this .name = name ;
197+ }
198+
199+ @ Override
200+ public String toString () {
201+ return "Fruit{" + id + "," + name + '}' ;
202+ }
203+ }
142204}
0 commit comments