File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
src/main/java/org/mybatis/spring Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -425,7 +425,15 @@ protected SqlSessionFactory buildSqlSessionFactory() throws IOException {
425425 }
426426 }
427427 }
428-
428+
429+ if (this .databaseIdProvider != null ) {//fix #64 set databaseId before parse mapper xmls
430+ try {
431+ configuration .setDatabaseId (this .databaseIdProvider .getDatabaseId (this .dataSource ));
432+ } catch (SQLException e ) {
433+ throw new NestedIOException ("Failed getting a databaseId" , e );
434+ }
435+ }
436+
429437 if (xmlConfigBuilder != null ) {
430438 try {
431439 xmlConfigBuilder .parse ();
@@ -446,14 +454,6 @@ protected SqlSessionFactory buildSqlSessionFactory() throws IOException {
446454
447455 configuration .setEnvironment (new Environment (this .environment , this .transactionFactory , this .dataSource ));
448456
449- if (this .databaseIdProvider != null ) {
450- try {
451- configuration .setDatabaseId (this .databaseIdProvider .getDatabaseId (this .dataSource ));
452- } catch (SQLException e ) {
453- throw new NestedIOException ("Failed getting a databaseId" , e );
454- }
455- }
456-
457457 if (!isEmpty (this .mapperLocations )) {
458458 for (Resource mapperLocation : this .mapperLocations ) {
459459 if (mapperLocation == null ) {
You can’t perform that action at this time.
0 commit comments