36
36
import org .jboss .logging .Logger ;
37
37
38
38
import org .hibernate .HibernateException ;
39
+ import org .hibernate .cfg .AvailableSettings ;
39
40
import org .hibernate .cfg .Mappings ;
40
41
import org .hibernate .dialect .Dialect ;
41
42
import org .hibernate .engine .jdbc .spi .JdbcConnectionAccess ;
@@ -58,7 +59,11 @@ public class PersistentTableBulkIdStrategy implements MultiTableBulkIdStrategy {
58
59
private static final Logger log = Logger .getLogger ( PersistentTableBulkIdStrategy .class );
59
60
60
61
public static final String CLEAN_UP_ID_TABLES = "hibernate.hql.bulk_id_strategy.persistent.clean_up" ;
62
+ public static final String SCHEMA = "hibernate.hql.bulk_id_strategy.persistent.schema" ;
63
+ public static final String CATALOG = "hibernate.hql.bulk_id_strategy.persistent.catalog" ;
61
64
65
+ private String catalog ;
66
+ private String schema ;
62
67
private boolean cleanUpTables ;
63
68
private List <String > tableCleanUpDdl ;
64
69
@@ -69,7 +74,18 @@ public void prepare(
69
74
Mappings mappings ,
70
75
Mapping mapping ,
71
76
Map settings ) {
72
- cleanUpTables = ConfigurationHelper .getBoolean ( CLEAN_UP_ID_TABLES , settings , false );
77
+ this .catalog = ConfigurationHelper .getString (
78
+ CATALOG ,
79
+ settings ,
80
+ ConfigurationHelper .getString ( AvailableSettings .DEFAULT_CATALOG , settings )
81
+ );
82
+ this .schema = ConfigurationHelper .getString (
83
+ SCHEMA ,
84
+ settings ,
85
+ ConfigurationHelper .getString ( AvailableSettings .DEFAULT_SCHEMA , settings )
86
+ );
87
+ this .cleanUpTables = ConfigurationHelper .getBoolean ( CLEAN_UP_ID_TABLES , settings , false );
88
+
73
89
final Iterator <PersistentClass > entityMappings = mappings .iterateClasses ();
74
90
final List <Table > idTableDefinitions = new ArrayList <Table >();
75
91
while ( entityMappings .hasNext () ) {
@@ -82,6 +98,12 @@ public void prepare(
82
98
83
99
protected Table generateIdTableDefinition (PersistentClass entityMapping ) {
84
100
Table idTable = new Table ( entityMapping .getTemporaryIdTableName () );
101
+ if ( catalog != null ) {
102
+ idTable .setCatalog ( catalog );
103
+ }
104
+ if ( schema != null ) {
105
+ idTable .setSchema ( schema );
106
+ }
85
107
Iterator itr = entityMapping .getIdentityTable ().getPrimaryKey ().getColumnIterator ();
86
108
while ( itr .hasNext () ) {
87
109
Column column = (Column ) itr .next ();
0 commit comments