-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: default_schema is not saved in each ShardConfiguration
PostPosted: Tue May 18, 2010 10:23 am 
Newbie

Joined: Tue May 18, 2010 9:33 am
Posts: 1
I run hibernate shards with 2 shards. The first shard configuration define one DB2 database, the second define another DB2 database.
Each database has it own default_schema. The default_schema specified for each shard is not saved in each ShardConfiguration

See configuration below

shard0.hibernate.cfg.xml
<hibernate-configuration>

<!-- <session-factory> -->
<session-factory name="HibernateSessionFactory0">
<property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
<property name="connection.url">jdbc:db2://server1:port/DB1</property>
<property name="default_schema">schema1</property>
<property name="connection.username">develo</property>
<property name="connection.password">password</property>
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="current_session_context_class">thread</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<property name="hibernate.connection.shard_id">0</property>
<property name="hibernate.shard.enable_cross_shard_relationship_checks">true</property>
</session-factory>
</hibernate-configuration>

shard1.hibernate.cfg.xml
<hibernate-configuration>
<!-- <session-factory> -->
<session-factory name="HibernateSessionFactory0">
<property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
<property name="connection.url">jdbc:db2://server2:port/DB2</property>
<property name="default_schema">schema2</property>
<property name="connection.username">develo</property>
<property name="connection.password">password</property>
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="current_session_context_class">thread</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<property name="hibernate.connection.shard_id">0</property>
<property name="hibernate.shard.enable_cross_shard_relationship_checks">true</property>
</session-factory>
</hibernate-configuration>

I resolved by

1. add

safeSet(prototypeConfiguration, Environment.DEFAULT_SCHEMA, config.getShardDefaultSchema());

in ShardedConfiguration.populatePrototypeWithVariableProperties(ShardConfiguration config)

2. add

String getShardDefaultSchema();

in the Interface ShardConfiguration

3. implement it in ConfigurationToShardConfigurationAdapter with

public String getShardDefaultSchema() {

return config.getProperty(Environment.DEFAULT_SCHEMA);

}

What is the best way to commit this fixe ?


Top
 Profile  
 
 Post subject: Re: default_schema is not saved in each ShardConfiguration
PostPosted: Wed May 19, 2010 3:17 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
I guess the first step is to create a jira issue in HSHARDS and attaching your patch.

Unfortunately, there hasn't been much development recently on Shards so I don't know when the patch will be picked up.

--Hardy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.