@@ -497,6 +497,18 @@ private void initializeConfigurationIfNecessary() {
497
497
}
498
498
}
499
499
500
+ /**
501
+ * Subclasses can override this method to perform custom initialization
502
+ * of the Configuration instance used for SessionFactory creation.
503
+ * The properties of this Builder will be applied to
504
+ * the Configuration object that gets returned here.
505
+ * <p>The default implementation creates a new Configuration instance.
506
+ * A custom implementation could prepare the instance in a specific way,
507
+ * or use a custom Configuration subclass.
508
+ * @return the Configuration instance
509
+ * @throws HibernateException in case of Hibernate initialization errors
510
+ * @see org.hibernate.cfg.Configuration#Configuration()
511
+ */
500
512
/**
501
513
* Instantiate and return an instance of the {@link Configuration} class
502
514
* type for this builder. Subclasses may override in order to customize
@@ -655,7 +667,7 @@ public void createDatabaseSchema() throws DataAccessException {
655
667
new HibernateCallback <Object >() {
656
668
@ SuppressWarnings ("deprecation" )
657
669
public Object doInHibernate (Session session ) throws HibernateException , SQLException {
658
- Dialect dialect = ((SessionFactoryImplementor ) session .getSessionFactory ()).getDialect ();
670
+ Dialect dialect = ((SessionFactoryImplementor )session .getSessionFactory ()).getDialect ();
659
671
String [] sql = configuration .generateSchemaCreationScript (dialect );
660
672
executeSchemaScript (session .connection (), sql );
661
673
return null ;
@@ -706,7 +718,7 @@ public void updateDatabaseSchema() throws DataAccessException {
706
718
public Void doInHibernate (Session session ) throws HibernateException , SQLException {
707
719
@ SuppressWarnings ("deprecation" )
708
720
Connection conn = session .connection ();
709
- Dialect dialect = ((SessionFactoryImplementor ) session .getSessionFactory ()).getDialect ();
721
+ Dialect dialect = ((SessionFactoryImplementor )session .getSessionFactory ()).getDialect ();
710
722
DatabaseMetadata metadata = new DatabaseMetadata (conn , dialect );
711
723
String [] sql = configuration .generateSchemaUpdateScript (dialect , metadata );
712
724
executeSchemaScript (conn , sql );
@@ -756,7 +768,7 @@ public void validateDatabaseSchema() throws DataAccessException {
756
768
new HibernateCallback <Object >() {
757
769
@ SuppressWarnings ("deprecation" )
758
770
public Object doInHibernate (Session session ) throws HibernateException , SQLException {
759
- Dialect dialect = ((SessionFactoryImplementor ) session .getSessionFactory ()).getDialect ();
771
+ Dialect dialect = ((SessionFactoryImplementor )session .getSessionFactory ()).getDialect ();
760
772
DatabaseMetadata metadata = new DatabaseMetadata (session .connection (), dialect );
761
773
configuration .validateSchema (dialect , metadata );
762
774
return null ;
@@ -798,7 +810,7 @@ public void dropDatabaseSchema() throws DataAccessException {
798
810
new HibernateCallback <Object >() {
799
811
@ SuppressWarnings ("deprecation" )
800
812
public Void doInHibernate (Session session ) throws HibernateException , SQLException {
801
- Dialect dialect = ((SessionFactoryImplementor ) session .getSessionFactory ()).getDialect ();
813
+ Dialect dialect = ((SessionFactoryImplementor )session .getSessionFactory ()).getDialect ();
802
814
String [] sql = configuration .generateDropSchemaScript (dialect );
803
815
executeSchemaScript (session .connection (), sql );
804
816
return null ;
0 commit comments