23
23
import org .hibernate .MappingException ;
24
24
import org .hibernate .SessionFactory ;
25
25
import org .hibernate .SessionFactoryObserver ;
26
- import org .hibernate .boot .Metadata ;
27
26
import org .hibernate .boot .MetadataBuilder ;
28
27
import org .hibernate .boot .MetadataSources ;
29
28
import org .hibernate .boot .SessionFactoryBuilder ;
@@ -470,9 +469,9 @@ public Configuration configure(File configFile) throws HibernateException {
470
469
* @param highlightSql should logged SQL be highlighted with pretty colors
471
470
*/
472
471
public Configuration showSql (boolean showSql , boolean formatSql , boolean highlightSql ) {
473
- setProperty ( AvailableSettings .SHOW_SQL , Boolean .toString (showSql ) );
474
- setProperty ( AvailableSettings .FORMAT_SQL , Boolean .toString (formatSql ) );
475
- setProperty ( AvailableSettings .HIGHLIGHT_SQL , Boolean .toString (highlightSql ) );
472
+ setProperty ( JdbcSettings .SHOW_SQL , Boolean .toString (showSql ) );
473
+ setProperty ( JdbcSettings .FORMAT_SQL , Boolean .toString (formatSql ) );
474
+ setProperty ( JdbcSettings .HIGHLIGHT_SQL , Boolean .toString (highlightSql ) );
476
475
return this ;
477
476
}
478
477
@@ -482,7 +481,7 @@ public Configuration showSql(boolean showSql, boolean formatSql, boolean highlig
482
481
* @param action the {@link Action}
483
482
*/
484
483
public Configuration setSchemaExportAction (Action action ) {
485
- setProperty ( AvailableSettings .HBM2DDL_AUTO , action .getExternalHbm2ddlName () );
484
+ setProperty ( SchemaToolingSettings .HBM2DDL_AUTO , action .getExternalHbm2ddlName () );
486
485
return this ;
487
486
}
488
487
@@ -493,8 +492,8 @@ public Configuration setSchemaExportAction(Action action) {
493
492
* @param pass the password
494
493
*/
495
494
public Configuration setCredentials (String user , String pass ) {
496
- setProperty ( AvailableSettings .USER , user );
497
- setProperty ( AvailableSettings .PASS , pass );
495
+ setProperty ( JdbcSettings .USER , user );
496
+ setProperty ( JdbcSettings .PASS , pass );
498
497
return this ;
499
498
}
500
499
@@ -514,7 +513,7 @@ public Configuration setJdbcUrl(String url) {
514
513
* @param jndiName the JNDI name of the datasource
515
514
*/
516
515
public Configuration setDatasource (String jndiName ) {
517
- setProperty ( AvailableSettings .DATASOURCE , jndiName );
516
+ setProperty ( JdbcSettings .DATASOURCE , jndiName );
518
517
return this ;
519
518
}
520
519
@@ -524,7 +523,7 @@ public Configuration setDatasource(String jndiName) {
524
523
* @param transactionType the {@link PersistenceUnitTransactionType}
525
524
*/
526
525
public Configuration setTransactionType (PersistenceUnitTransactionType transactionType ) {
527
- setProperty ( AvailableSettings .JAKARTA_TRANSACTION_TYPE , transactionType .toString () );
526
+ setProperty ( PersistenceSettings .JAKARTA_TRANSACTION_TYPE , transactionType .toString () );
528
527
return this ;
529
528
}
530
529
@@ -783,8 +782,8 @@ public Configuration addAnnotatedClass(Class<?> annotatedClass) {
783
782
*
784
783
* @return this (for method chaining)
785
784
*/
786
- public Configuration addAnnotatedClasses (Class ... annotatedClasses ) {
787
- for (Class annotatedClass : annotatedClasses ) {
785
+ public Configuration addAnnotatedClasses (Class <?> ... annotatedClasses ) {
786
+ for ( var annotatedClass : annotatedClasses ) {
788
787
addAnnotatedClass ( annotatedClass );
789
788
}
790
789
return this ;
@@ -814,7 +813,7 @@ public Configuration addPackage(String packageName) throws MappingException {
814
813
* @throws MappingException in case there is an error in the mapping data
815
814
*/
816
815
public Configuration addPackages (String ... packageNames ) throws MappingException {
817
- for (String packageName : packageNames ) {
816
+ for ( String packageName : packageNames ) {
818
817
addPackage ( packageName );
819
818
}
820
819
return this ;
@@ -1078,8 +1077,8 @@ public SessionFactory buildSessionFactory(ServiceRegistry serviceRegistry) throw
1078
1077
.forEach ( metadataBuilder ::applyAttributeConverter );
1079
1078
}
1080
1079
1081
- final Metadata metadata = metadataBuilder .build ();
1082
- final SessionFactoryBuilder sessionFactoryBuilder = metadata .getSessionFactoryBuilder ();
1080
+ final var metadata = metadataBuilder .build ();
1081
+ final var sessionFactoryBuilder = metadata .getSessionFactoryBuilder ();
1083
1082
1084
1083
if ( interceptor != null && interceptor != EmptyInterceptor .INSTANCE ) {
1085
1084
sessionFactoryBuilder .applyInterceptor ( interceptor );
@@ -1130,7 +1129,7 @@ public SessionFactory buildSessionFactory(ServiceRegistry serviceRegistry) throw
1130
1129
public SessionFactory buildSessionFactory () throws HibernateException {
1131
1130
log .trace ( "Building session factory using internal StandardServiceRegistryBuilder" );
1132
1131
standardServiceRegistryBuilder .applySettings ( properties );
1133
- StandardServiceRegistry serviceRegistry = standardServiceRegistryBuilder .build ();
1132
+ var serviceRegistry = standardServiceRegistryBuilder .build ();
1134
1133
try {
1135
1134
return buildSessionFactory ( serviceRegistry );
1136
1135
}
0 commit comments