For single database can i use multiple hibernate configuration file? -


1.for single database can use multiple hibernate configuration file? 2.databasesession factory applicable whole application.is possible create multiple databasesession factory single database.

could clarify doubt? in advance.

1) single project or db, multiple hibernate config files can used. this , this makes clear.

2) multiple session factories can created single data source or single db. first define db details in applicationcontext-database.xml as:

<bean id="dbname_datasource"  		class="required_datasource_type"  		destroy-method="required_type">  		<property name="driverclassname" value="required_driver_name" />      		<property name="url" value="" />      		<property name="username" value="" />      		<property name="password" value="" />         		<property name="initialsize" value="" />      		<property name="minidle" value="" />      		<property name="maxidle" value="" />      		<property name="maxactive" value="" />  		<property name="testonborrow" value="" />  		<property name="validationinterval" value=""/>  		<property name="validationquery" value=""/>   	</bean>

and above data source, multiple sessionfactories can created in applicationcontext-database xml below:

<bean id="sessionfactory1"  		class="required_sessionfactory_type">  		<property name="datasource" ref="dbname_datasource" />  		<property name="hibernateproperties">  		...required_additional_details_to_be_provided  	</bean>    <bean id="sessionfactory2"  		class="required_sessionfactory_type">  		<property name="datasource" ref="dbname_datasource" />  		<property name="hibernateproperties">  		...required_additional_details_to_be_provided	  	</bean>

at runtime, appropriate sessionfactory should retrieved , should used execute queries.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -