Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "CDO/Hibernate Store/Quick Start"

(start the CDO server)
(Download and install)
 
(22 intermediate revisions by 3 users not shown)
Line 8: Line 8:
  
 
== Download and install ==
 
== Download and install ==
Download the required software:
 
* [http://www.eclipse.org/downloads/ Eclipse 3.6 (Helios)], as Eclipse 3.6 is in development try the development tab
 
* [http://www.eclipse.org/modeling/emf/downloads/?project=emf EMF 2.6], is normally included with the java EE version of Eclipse
 
* [https://build.eclipse.org/hudson/job/cbi-emf-net4j-cdo-3.0/lastSuccessfulBuild/artifact/build CDO Nightly build], click on Nxyz (where xyz is a date) to open the nightly build location. The easiest is to download the all features and plugins zip: emf-cdo-AllFeaturesAndPlugins-N201001181004.zip (with a different date in your case ofcourse)
 
* [http://www.eclipse.org/modeling/emf/downloads/?project=teneo Teneo 1.2.0], Teneo 1.2.0 can be found a little down on the page
 
* [http://net4j.sourceforge.net/update/downloads Hibernate 3.3.2 or later and JDBC drivers], pick the latest ThirdPartyDrivers zip file
 
  
Install Eclipse and the plugins, see: [http://wiki.eclipse.org/Equinox_p2_Getting_Started#Supported_dropins_formats Eclipse p2 getting started].
+
All the Hibernate store dependencies are downloaded and installed through update sites.
 +
 
 +
To download Eclipse. To download it go to this page:
 +
[http://www.eclipse.org/downloads/ http://www.eclipse.org/downloads/], for the development builds go to the development builds tab. For the tutorials, the Eclipse IDE for Java EE Developers or Eclipse IDE for Java Developers can be used (no need to pick the full modeling tools).
 +
 
 +
EMF is probably included in the Eclipse IDE. It can be installed from the Helios update site directly.
 +
 
 +
First install the CDO Hibernate store dependencies from one of these update sites.
 +
 
 +
For CDO Hibernate Store 4.0 dependencies use these sites:
 +
* Hibernate and other 3rd party libs: http://www.elver.org/eclipse/update
 +
* Teneo: http://download.eclipse.org/modeling/emf/teneo/updates/1.2.0/interim/
 +
 
 +
For CDO Hibernate Store 3.0 dependencies use these sites:
 +
* Hibernate and other 3rd party libs: http://www.elver.org/eclipse/update_1.1.2
 +
* Teneo: http://download.eclipse.org/modeling/emf/teneo/updates/1.1.2/interim/
 +
 
 +
Then install the CDO plugins from one of the update sites listed here:
 +
* http://www.eclipse.org/cdo/downloads/updates.php
  
 
== Download the example projects from cvs ==
 
== Download the example projects from cvs ==
After installing Eclipse and the plugins, start Eclipse and in a workspace import/download the following three projects from CVS:
 
* org.eclipse.emf.cdo.examples.company: contains the example model which has already been prepared for CDO (see here how this is done)
 
* org.eclipse.emf.cdo.examples.hibernate.server: contains the server configuration and server side part of the tutorial
 
* org.eclipse.emf.cdo.examples.hibernate.client: shows client connection code and contains junit tests creating and querying for data
 
  
The cvs location of these projects is:
+
After installing Eclipse and the plugins, start Eclipse and in a workspace import/download the following three projects from [https://dev.eclipse.org/svnroot/modeling/org.eclipse.emf.cdo/trunk/plugins SVN]:
* dev.eclipse.org
+
* <tt>[https://dev.eclipse.org/svnroot/modeling/org.eclipse.emf.cdo/trunk/plugins/org.eclipse.emf.cdo.examples.company/ org.eclipse.emf.cdo.examples.company]</tt>: contains the example model which has already been prepared for CDO (see here how this is done)
* /cvsroot/modeling
+
* <tt>[https://dev.eclipse.org/svnroot/modeling/org.eclipse.emf.cdo/trunk/plugins/org.eclipse.emf.cdo.examples.hibernate.server/ org.eclipse.emf.cdo.examples.hibernate.server]</tt>: contains the server configuration and server launch config
* paths:
+
* <tt>[https://dev.eclipse.org/svnroot/modeling/org.eclipse.emf.cdo/trunk/plugins/org.eclipse.emf.cdo.examples.hibernate.client/ org.eclipse.emf.cdo.examples.hibernate.client]</tt>: shows client connection code and contains junit tests creating and querying for data
** org.eclipse.emf/org.eclipse.emf.cdo/examples/org.eclipse.emf.cdo.examples.company
+
** org.eclipse.emf/org.eclipse.emf.cdo/examples/org.eclipse.emf.cdo.examples.hibernate.server
+
** org.eclipse.emf/org.eclipse.emf.cdo/examples/org.eclipse.emf.cdo.examples.hibernate.client
+
  
== start the CDO server ==
+
Note: the examples in <tt>HEAD</tt> branch require CDO 4.0.
  
As a default the CDO Hibernate server uses hsqldb. To start the CDO server open the org.eclipse.emf.cdo.examples.hibernate.server project and right-click on the CDOHibernateServer.launch and then: Run As > CDOHibernateServer. Check the console view, after 5-10 seconds you should see:
+
 
 +
[[Image:org.eclipse.emf.cdo.hibernate.quick_view.png | center | 900px]]
 +
 
 +
== Start the CDO server ==
 +
 
 +
To start the CDO server open the org.eclipse.emf.cdo.examples.hibernate.server project and right-click on the CDOHibernateServer.launch and then: Run As > CDOHibernateServer.  
 +
 
 +
Note: if there is a ClassNotFoundException to org.hsqldb, in org.eclipse.emf.cdo.examples.hibernate.server project, open META-INF/MANIFEST.MF and add dependency to org.hsqldb bundle.
 +
 
 +
Check the console view, after 5-10 seconds you should see:
  
 
<source lang="text">
 
<source lang="text">
Line 51: Line 65:
 
Application Started: 8521
 
Application Started: 8521
 
</source>
 
</source>
 +
 +
As a default the CDO Hibernate server uses hsqldb.
 +
 +
For your info, the CDO server uses the config file: cdo-server.xml in the config directory in the org.eclipse.emf.cdo.examples.hibernate.server project.
 +
 +
== Run client side code ==
 +
 +
As a last step run some client side code to see the CDO server storing and retrieving data. Open the org.eclipse.emf.cdo.examples.server.hibernate.client project, go to the junit classes in the src directory:
 +
* QuickStartTest: a very simple test which creates one resource and stores a new address in it
 +
* HibernateQueryTest: extensive test which creates a complete test data set and then show various HQL queries.
 +
 +
do right click on one of these two classes and then: Run As > Junit Test. Or to get better visibility on what happens place some breakpoints in the test cases and run in debug mode.
 +
 +
== Quick Next Steps ==
 +
 +
The CDO Server uses hsqldb as a default. To change this to mysql (or another database) change the properties inside the cdo-server.xml file in the org.eclipse.emf.cdo.examples.hibernate.server/config. The file contains a commented block for mysql, change the url/passwords etc. to fit it to your situation.
 +
 +
Note that for mysql and most other databases Hibernate will not create the database itself for you. So you need to manually create a database and set the database name in the url in the cdo-server.xml.
 +
 +
As a next step create your own junit test case in the org.eclipse.emf.cdo.examples.hibernate.client project, extend the BaseTest class in that same plugin.
 +
 +
You can also try the standard [[Using_the_CDO_User_Interface|CDO View]].
 +
  
 
----
 
----
 
Wikis: [[CDO]] | [[Net4j]] | [[EMF]] | [[Eclipse]]
 
Wikis: [[CDO]] | [[Net4j]] | [[EMF]] | [[Eclipse]]

Latest revision as of 16:34, 16 June 2011

The quick start of the CDO Hibernate Store takes you through the following steps:

  • download and install
  • download example projects from cvs
  • start the CDO Server
  • run client side junit tests to see interaction between the client and server

Download and install

All the Hibernate store dependencies are downloaded and installed through update sites.

To download Eclipse. To download it go to this page: http://www.eclipse.org/downloads/, for the development builds go to the development builds tab. For the tutorials, the Eclipse IDE for Java EE Developers or Eclipse IDE for Java Developers can be used (no need to pick the full modeling tools).

EMF is probably included in the Eclipse IDE. It can be installed from the Helios update site directly.

First install the CDO Hibernate store dependencies from one of these update sites.

For CDO Hibernate Store 4.0 dependencies use these sites:

For CDO Hibernate Store 3.0 dependencies use these sites:

Then install the CDO plugins from one of the update sites listed here:

Download the example projects from cvs

After installing Eclipse and the plugins, start Eclipse and in a workspace import/download the following three projects from SVN:

Note: the examples in HEAD branch require CDO 4.0.


Org.eclipse.emf.cdo.hibernate.quick view.png

Start the CDO server

To start the CDO server open the org.eclipse.emf.cdo.examples.hibernate.server project and right-click on the CDOHibernateServer.launch and then: Run As > CDOHibernateServer.

Note: if there is a ClassNotFoundException to org.hsqldb, in org.eclipse.emf.cdo.examples.hibernate.server project, open META-INF/MANIFEST.MF and add dependency to org.hsqldb bundle.

Check the console view, after 5-10 seconds you should see:

main [debug.lifecycle.dump] DUMP  TCPAcceptor@20
  Acceptor.config = TransportConfig[receiveExecutor=java.util.concurrent.ThreadPoolExecutor@46f93, bufferProvider=BufferPool[4,096], protocolProvider=org.eclipse.net4j.ContainerProtocolProvider$Server@139358c, negotiator=null]
  Acceptor.connectorListener = org.eclipse.spi.net4j.Acceptor$1@ea9bc8
  Acceptor.acceptedConnectors = 
  selector = TCPSelector
  startSynchronously = true
  synchronousStartTimeout = 20000
  serverSocketChannel = sun.nio.ch.ServerSocketChannelImpl[/0.0.0.0:2036]
  address = 0.0.0.0
  port = 2036
 
[INFO] Net4j extension started
[INFO] CDO server started
Application Started: 8521

As a default the CDO Hibernate server uses hsqldb.

For your info, the CDO server uses the config file: cdo-server.xml in the config directory in the org.eclipse.emf.cdo.examples.hibernate.server project.

Run client side code

As a last step run some client side code to see the CDO server storing and retrieving data. Open the org.eclipse.emf.cdo.examples.server.hibernate.client project, go to the junit classes in the src directory:

  • QuickStartTest: a very simple test which creates one resource and stores a new address in it
  • HibernateQueryTest: extensive test which creates a complete test data set and then show various HQL queries.

do right click on one of these two classes and then: Run As > Junit Test. Or to get better visibility on what happens place some breakpoints in the test cases and run in debug mode.

Quick Next Steps

The CDO Server uses hsqldb as a default. To change this to mysql (or another database) change the properties inside the cdo-server.xml file in the org.eclipse.emf.cdo.examples.hibernate.server/config. The file contains a commented block for mysql, change the url/passwords etc. to fit it to your situation.

Note that for mysql and most other databases Hibernate will not create the database itself for you. So you need to manually create a database and set the database name in the url in the cdo-server.xml.

As a next step create your own junit test case in the org.eclipse.emf.cdo.examples.hibernate.client project, extend the BaseTest class in that same plugin.

You can also try the standard CDO View.



Wikis: CDO | Net4j | EMF | Eclipse

Back to the top