Jump to: navigation, search

Difference between revisions of "CDO/Hibernate Store/Configuration and Setup"

(New page: __TOC__ The configuration of the CDO server with the CDO Hibernate Store consists of 2 parts: 1) a cdo-server.xml configuration file, 2) a launch configuration in Eclipse. For this tutor...)
 
(Configuration file)
Line 1: Line 1:
 
 
__TOC__
 
__TOC__
  
Line 17: Line 16:
 
An example configuration file is shown here:
 
An example configuration file is shown here:
 
<source lang="xml">
 
<source lang="xml">
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
<cdoServer>
  
 +
<!--
 +
<acceptor type="http"/>
 +
-->
 +
 +
<acceptor type="tcp" listenAddr="0.0.0.0" port="2036">
 +
<!--
 +
<negotiator type="challenge" description="/temp/users.db"/>
 +
-->
 +
</acceptor>
 +
 +
<repository name="repo1">
 +
<property name="overrideUUID" value=""/>
 +
<property name="supportingAudits" value="false"/>
 +
<property name="verifyingRevisions" value="false"/>
 +
<property name="currentLRUCapacity" value="10000"/>
 +
<property name="revisedLRUCapacity" value="10000"/>
 +
 +
 +
<!--
 +
NOTE: the following properties are currently defined on repository level.
 +
In future builds of the CDO Hibernate store these properties are defined
 +
within the store and mappingProvider tags.
 +
-->
 +
 +
<!--
 +
Teneo options:
 +
see: http://www.elver.org/hibernate/options.html
 +
or the org.eclipse.emf.teneo.PersistenceOptions class
 +
-->
 +
 +
<!-- The following value must be set normally like this, use this in your app also -->
 +
<property name="teneo.mapping.cascade_policy_on_non_containment" value="PERSIST,MERGE"/>
 +
 +
<!-- some demo settings -->
 +
<!--
 +
using an external xml file for annotations, note this xml file
 +
is located in the org.eclipse.emf.cdo.examples.hibernate.annotations
 +
which is available on the cdo server by adding it to the CDOHibernateServer.launch configuration
 +
-->
 +
<property name="teneo.mapping.persistence_xml" value="/META-INF/company_model_teneo_annotations.xml"/>
 +
<!-- create tables for each subclass with joining to the parent table -->
 +
<property name="teneo.mapping.inheritance" value="JOINED"/>
 +
<!-- create an index for each fk -->
 +
<property name="teneo.mapping.add_index_for_fk" value="true"/>
 +
 +
 +
<!-- Hibernate properties , see: http://docs.jboss.org/hibernate/stable/core/reference/en/html_single/#configuration-optional -->
 +
<property name="hibernate.hbm2ddl.auto" value="update"/>
 +
<property name="hibernate.show_sql" value="false"/>
 +
<property name="hibernate.connection.pool_size" value="10"/>
 +
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
 +
 +
<!-- Setting for hsqldb -->
 +
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
 +
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
 +
<property name="hibernate.connection.url" value="jdbc:hsqldb:mem:cdohibernate"/>
 +
<property name="hibernate.connection.username" value="sa"/>
 +
<property name="hibernate.connection.password" value=""/>
 +
<property name="hibernate.connection.autocommit" value="true"/>
 +
 +
<!-- Setting for mysql
 +
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
 +
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
 +
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/cdohibernate"/>
 +
<property name="hibernate.connection.username" value="root"/>
 +
<property name="hibernate.connection.password" value="root"/>
 +
-->
 +
 +
<store type="hibernate">
 +
<mappingProvider type="teneo">
 +
</mappingProvider>
 +
</store>
 +
</repository>
 +
 +
</cdoServer>
 
</source>
 
</source>
  
Line 24: Line 100:
  
 
CDO_Hibernate_Store
 
CDO_Hibernate_Store
 
  
 
== Run Launch Config ==
 
== Run Launch Config ==

Revision as of 19:06, 20 January 2010

The configuration of the CDO server with the CDO Hibernate Store consists of 2 parts: 1) a cdo-server.xml configuration file, 2) a launch configuration in Eclipse. For this tutorial the CDO server will be started from within Eclipse.

Example Project

This document discusses the setup and configuration of the CDO server. This page assumes that required plugins have been downloaded and installed and that they are correctly loaded/installed after restarting Eclipse.

This page uses the org.eclipse.emf.cdo.examples.hibernate.server project as an example. This development project can be downloaded from here:

  • server: dev.eclipse.org
  • main directory: /cvsroot/modeling
  • path: org.eclipse.emf/org.eclipse.emf.cdo/examples/org.eclipse.emf.cdo.examples.hibernate.server

Configuration file

An example configuration file is shown here:

<?xml version="1.0" encoding="UTF-8"?>
<cdoServer>
 
	<!--
	<acceptor type="http"/>
	-->
 
	<acceptor type="tcp" listenAddr="0.0.0.0" port="2036">
		<!--
		<negotiator type="challenge" description="/temp/users.db"/>
		-->
	</acceptor>
 
	<repository name="repo1">
		<property name="overrideUUID" value=""/>
		<property name="supportingAudits" value="false"/>
		<property name="verifyingRevisions" value="false"/>
		<property name="currentLRUCapacity" value="10000"/>
		<property name="revisedLRUCapacity" value="10000"/>
 
 
		<!-- 
			NOTE: the following properties are currently defined on repository level.
			In future builds of the CDO Hibernate store these properties are defined
			within the store and mappingProvider tags.
		-->
 
			<!-- 
				Teneo options: 
				see: http://www.elver.org/hibernate/options.html 
				or the org.eclipse.emf.teneo.PersistenceOptions class
			-->
 
			<!-- The following value must be set normally like this, use this in your app also -->
			<property name="teneo.mapping.cascade_policy_on_non_containment" value="PERSIST,MERGE"/>
 
			<!-- some demo settings -->
			<!-- 
				using an external xml file for annotations, note this xml file 
				is located in the org.eclipse.emf.cdo.examples.hibernate.annotations
				which is available on the cdo server by adding it to the CDOHibernateServer.launch configuration
			-->
			<property name="teneo.mapping.persistence_xml" value="/META-INF/company_model_teneo_annotations.xml"/>
			<!-- create tables for each subclass with joining to the parent table -->
			<property name="teneo.mapping.inheritance" value="JOINED"/>
			<!-- create an index for each fk -->
			<property name="teneo.mapping.add_index_for_fk" value="true"/>
 
 
			<!-- Hibernate properties , see: http://docs.jboss.org/hibernate/stable/core/reference/en/html_single/#configuration-optional -->
			<property name="hibernate.hbm2ddl.auto" value="update"/>
			<property name="hibernate.show_sql" value="false"/>
			<property name="hibernate.connection.pool_size" value="10"/>
			<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
 
			<!-- Setting for hsqldb -->
			<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
			<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
			<property name="hibernate.connection.url" value="jdbc:hsqldb:mem:cdohibernate"/>
			<property name="hibernate.connection.username" value="sa"/>
			<property name="hibernate.connection.password" value=""/>
			<property name="hibernate.connection.autocommit" value="true"/>
 
			<!-- Setting for mysql
			<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
			<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
			<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/cdohibernate"/>
			<property name="hibernate.connection.username" value="root"/>
			<property name="hibernate.connection.password" value="root"/>
			-->
 
		<store type="hibernate">
			<mappingProvider type="teneo">
			</mappingProvider>
		</store>
	</repository>
 
</cdoServer>

This file is present in the config folder of the org.eclipse.emf.cdo.examples.hibernate.server project. Note: the config file


CDO_Hibernate_Store

Run Launch Config

org.eclipse.emf.cdo org.eclipse.emf.cdo.common org.eclipse.emf.cdo.examples.hibernate.server org.eclipse.emf.cdo.server org.eclipse.emf.cdo.server.hibernate org.eclipse.emf.cdo.server.hibernate.teneo org.eclipse.emf.cdo.server.net4j org.eclipse.emf.cdo.net4j org.eclipse.emf.cdo.net4j.tcp org.eclipse.emf.cdo.net4j.util




Wikis: CDO | Net4j | EMF | Eclipse