Skip to content

Data store Specific Configuration

chhavigangwal edited this page Mar 26, 2015 · 10 revisions

Kundera allows you to specify data-store specific hooks into a configuration file. You need to add below entry into persistence.xml for your persistence unit.

<property name="kundera.client.property" value="property-file" />

Here property-file is the name of XML configuration file that must be in classpath of your application:

XML Property File

Kundera allows to specify datastore specific configuration in an XML file in below format:

<?xml version="1.0" encoding="UTF-8"?>
<clientProperties>
    <datastores>
        <dataStore>
	    <name>mongo/cassandra/hbase</name>
	        <connection>
		    <properties>
		        <property name="connection.property1" value="connection.property1.value"></property>
			<property name="connection.property2" value="connection.property2.value"></property>
			<!--  More connection properties -->
		    </properties>
		    <servers>
		        <server>
			    <host>host1</host>
			    <port>port1</port>
			</server>
			<server>
			    <host>host2</host>
			    <port>port2</port>
			</server>
			<!--  More servers -->
		    </servers>
		</connection>
		<schemas>
		    <schema>
		        <name>schemaName</name>
			<properties>
			    <property name="schema.property1" value="schema.property1.value" />
			    <property name="schema.property2" value="schema.property2.value" />	
			    <!--  More schema properties -->					
			</properties>
			<dataCenters>
			    <dataCenter>
			        <name>data.center1.name</name>
				<value>data.center1.value</value>
			    </dataCenter>
			    <dataCenter>
			        <name>data.center2.name</name>
				<value>data.center2.value</value>
			    </dataCenter>
			    <!--  More data centres -->
			</dataCenters>
			<tables>
			    <table>
			        <name>Table1</name>
				<properties>
				    <property name="table.property1" value="table.property1.value"></property>
                                    <property name="table.property2" value="table.property2.value"></property>
				    <!--  More table properties -->
				</properties>
			    </table>
			    <!--  More tables -->
			</tables>
		    </schema>
		    <!--  More schemas -->
		</schemas>
	    </dataStore>	
	</datastores>
</clientProperties>

Click on respective links below for datastore specific configuration details:

Home

Clone this wiki locally