Difference between revisions of "CDO/Hibernate Store"
|Line 77:||Line 77:|
Wikis: [[CDO]] | [[Net4j]] | [[EMF]] | [[Eclipse]]
Wikis: [[CDO]] | [[Net4j]] | [[EMF]] | [[Eclipse]]
Revision as of 01:16, 19 December 2010
- Database support: Hibernate provides superior runtime Object Relational Mapping to many different relational databases. We test with mysql and hsqldb but there are no known obstacles for using CDO on other databases supported by Hibernate.
- HQL: the CDO Hibernate store makes it possible to execute HQL queries on the client. The complete HQL syntax is supported (incl. joins, aggregations, functions, etc.).
- Automatic Model-Relational Mapping: Teneo takes care of automatic mapping of your model to a relation database schema. The relational database schema explicitly implements the domain model. The automatic mapping can be manually overridden using JPA annotations in the model or in a separate XML file. All JPA annotations (and several Hibernate extensions) are supported.
The CDO Hibernate store is focused on creating a human-understandable, sensible, practical and performant relational database schema. The store is especially suited for data oriented business administrative (ERP-like) applications with a RCP interface.
The documentation for the CDO Hibernate Store consists of the following sections.
- Quick start: in just a few steps you have an up-and-running CDO server with Hibernate and automatic mapping using Teneo.
- Architecture: describes how the different components of the store operate together.
- Download and install: lists the required plugins and their download locations. In addition the examples projects used in the tutorials are specified (with their cvs location).
- Configuration: discusses the setup and configuration of the CDO Hibernate store (database, launch configuration, model, etc.). The description is supported by an example Eclipse project which is available in cvs.
- Tutorial: gives a quick intro in how to connect from a client to the CDO Hibernate datastore. This tutorial illustrates that for a standard usage there is no difference in using a CDO Hibernate store compared to other stores. A downloadable Example Eclipse project is used to give the reader a good start. The examples use junit testcases on the client to facilitate easy testing and debugging.
- Hibernate Query Language (HQL) support: several examples of HQL queries, ranging from very simple to queries with functions and array results. The example queries can be run directly using a provided Eclipse project.
- Model relational mapping page describes how the generated model-relational mapping can be extended and overridden using JPA annotations in the model. The same example Eclipse project as in previous steps is used to illustrate the functions and features.
- Trouble shooting: when you encounter specific CDO Hibernate issues. For remaining questions visit the EMF newsgroup.
Note: the tutorials have been run also using Eclipse 3.5 and EMF 2.5 and this works fine (using CDO 3.0, Teneo 1.2.0 and Hibernate 3.3.2). There should not be any binary incompatibility between CDO 3.0 and Eclipse 3.5, EMF 2.5.
Visit the download page to download the required dependencies.
Plugins and CVS
The CDO Hibernate Store can be found in CVS in the following location:
- main path: org.eclipse.emf/org.eclipse.emf.cdo/hibernate
The functionality is implemented in the following plugins (the other plugins/projects in the same cvs location can be ignored):
- org.eclipse.emf.cdo.server.hibernate: implements the CDO Hibernate Store itself
- org.eclipse.emf.cdo.server.hibernate.teneo: integrates Teneo with the CDO Hibernate Store, takes care of calling Teneo to generate the mapping
- org.eclipse.emf.cdo.test.hibernate: contains the Hibernate specific parts of the cdo tests. This plugin extends the org.eclipse.emf.cdo.tests plugin
The documentation makes use of three projects (used in the documentation) in the org.eclipse.emf/org.eclipse.emf.cdo/examples folder:
- org.eclipse.emf.cdo.examples.company: contains the test model which has been enabled for use with CDO
- org.eclipse.emf.cdo.examples.hibernate.server: contains server configuration and a launch configuration
- org.eclipse.emf.cdo.examples.hibernate.client: contains several test cases showing how a client can create data and query for data in a remote CDO server.
(Un)Supported Functions and Features
Currently the CDO Hibernate Store successfully passes 963 testcases.
The CDO Hibernate Store supports the main CDO features except for the following:
- auditing and revisions: this topic is being researched. Support for auditing as it is currently implemented in CDO implies that there are no foreign key constraints in the database. This has to be matched with the focus of the CDO Hibernate store on supporting more traditional ERP/Business Administration applications.
- Branching: is not supported
The following details are related to differences in the way CDO works natively and the Teneo mapping layer:
- Non-transient containment ereference with a transient e-opposite container ereference: CDO will ignore the transient container ereference, while Teneo and the Hibernate Store will try to persist it. This results in runtime exceptions. This case is a very special case, support for this case will be provided when it is specifically requested on the EMF newsgroup.
- CDOStaleReferencePolicy option is not supported: the Hibernate Store will treat all stale references as an exception.
- Move of child from one container to another container: Hibernate does not support moving of a child (part of a containment or orphan-delete association) to another parent. Hibernate will throw an exception with a message like: 'Deleted object will be re-saved'. To work around this issue make a shallow copy of the child and insert the copy in the new parent.