9
10
'hibernate.hbm2ddl.auto': 'update',
10
11
'hibernate.generate_statistics': 'true',
12
contexts = ['general','images','auth','config','walrus','storage','dns']
13
contexts = PersistenceContexts.list( );
14
contexts.each { String ctxName ->
15
String it = ctxName.replaceAll("eucalyptus_","")
14
16
pool_config = new pools(new Binding([context_name:it])).run()
15
17
cache_config = new caches(new Binding([context_name:it])).run()
16
18
config = new Ejb3Configuration();
17
LogUtil.logHeader( "Hibernate for ${it}" ).log(hiber_config.inspect())
19
LogUtil.logHeader( "Hibernate for ${ctxName}" ).log(hiber_config.inspect())
18
20
hiber_config.each { k, v -> config.setProperty(k, v) }
19
LogUtil.logHeader( "Pool for ${it}").log( pool_config.inspect() )
21
LogUtil.logHeader( "Pool for ${ctxName}").log( pool_config.inspect() )
20
22
pool_config.each { k, v -> config.setProperty(k, v) }
21
LogUtil.logHeader( "Cache for ${it}").log( cache_config )
23
LogUtil.logHeader( "Cache for ${ctxName}").log( cache_config )
22
24
cache_config.each { k, v -> config.setProperty(k, v) }
23
entity_list = new entities(new Binding([context_name:it])).run()
24
LogUtil.logHeader("Entities for ${it}")
25
entity_list = PersistenceContexts.listEntities( ctxName )
26
LogUtil.logHeader("Entities for ${ctxName}")
25
27
entity_list.each{ ent ->
26
28
LogUtil.log( ent.toString() )
27
29
config.addAnnotatedClass( ent )
30
DatabaseUtil.registerPersistenceContext("eucalyptus_${it}", config)
32
PersistenceContexts.registerPersistenceContext("${ctxName}", config)
31
33
} catch( Throwable t ) {
32
34
t.printStackTrace();