CDO – Connected Data Objects

CDO – Connected Data Objects

An introduction to CDO

This framework, which is a component of the EMF project, allows the sharing of an EMF model.
Whereas with Teneo we can make each client access a database (implementing a two-tier client/server solution), with CDO we make each client access a server which shares them the same model instance.
In this tutorial we will see how to:

  • install CDO
  • create a CDO server
  • create a CDO client

You can find a detailed documentation about CDO at the following link http://www.eclipse.org/cdo/documentation/
While you can download the various versions here http://www.eclipse.org/cdo/downloads/

Installing CDO

Let’s see now how to install CDO starting from version Eclipse 4.3 (Kepler) Modeling. CDO can use several Store implementations; here we will prepare to use the DBStore.

Furthermore, since we will use a MySQL database, we have to make sure that the correspondent JDBC plug-in is installed (please note that if you followed the tutorial Teneo Setup for Eclipse 4.2 ÔÇô Juno you can skip this step).
(Note: for a straightforward following of this tutorial it is advisable to use a MySQL version not beyond the 5.5)

Update Site => http://www.elver.org/eclipse/2.0.0/update/

  • MySQL Connector/J

Now let’s install Net4j DB Adapter for MySQL
Update Site =>
http://download.eclipse.org/modeling/emf/cdo/updates/releases

Let’s expland the more recent category and select the following:

CDO R
> Net4j DB Framework
>> Net4j DB Framework MYSQL Adapter

Creating a CDO server

In this section we will see how to create a feature-based Eclipse product that will handle the launch of a CDO server defined by an XML configuration file.
In Eclipse a feature is a set of plug-ins which collaborate in order to provide a software functionality.
So let’s create a Feature Project with File -> New -> Project… -> Plug-in Development -> Feature Project

press Next and at the next step give a name to our project, for example it.rcpvision.rcptutorial.cdo.server

then Finish.

What we just obtained is an empty feature; let’s go to tab Plug-ins and add the following plug-ins using button Add…

Note: if you donÔÇÖt want to add them one by one, here is the content of file feature.xml, which you can modify with tab “feature.xml

Now let’s create a product based on this feature; just right-click on this project and select New -> Other… -> Plug-in Development -> Product Configuration

press Next.
At the next step give a name to our product, for instance CDO-Server.product,

select “Use an existing product” radio-button and in the combo next to the selected radio-button set the value “org.eclipse.emf.cdo.server.product.tcp_h2“, then Finish.
What we just obtained is a product, but it is now plug-ins based.

in order to have it feature-based we need to select the correspondent radio-button

now, to list the features that make part of that product, select tab Dependencies

press button Add…

and select the just created feature (it.rcpvision.rcptutorial.cdo.server)

and save the product (Ctrl-S).

Now it’s time to define the XML configuration file for CDO. Let’s select the project and create a folder named “rootfiles” (right click, New -> Folder)
and then add another subfolder named “configuration

inside this folder let’s create a file (right click, New -> File) named cdo-server.xml and copy the following content inside

This configuration file indicates that a CDO server will be active on TCP port 2036 and it will make available a CDO repository named “demo“. Just after we find the database coordinates. Please note that at first startup or after a model change, it is advisable to drop the database; it will be created automatically at startup. Before launching the server we need yet to pass the location of the configuration file . In order to do so just select the product, go to Launching tab and in the VM Arguments section provide the following parameter value

save the product, get back to Overview tab and launch, with
Launch An Eclipse Application

The console should end with a message like this

Verify that the database is successfully created.
(Note: if you get error messages please ensure that your firewall is not blocking ports 2036 and 3306)

Well, now at the network address of this computer, at the configured Net4j port (2036), the CDO repository named “demo” is available.

Just one note: in order to be prepared when we will need to deploy the product, it is advisable to make the product include also the configuration file (otherwise it would not be exported). To do this let’s open the build.properties file, go to Build tab and in the “Binary Build” section just select the folder “rootfiles“.

Creating a CDO client

Here we will use the same EMF model (the plug-in it.rcpvision.rcptutorial.model) used in previous tutorials (see ). In case you are going to do that tutorial again, consider that now, when creating the EMF Generator Model (.genmodel), at step “Select a Model Importer” you should select “Ecore model (CDO Native)“.
Otherwise, if you have the previous model plugin available (which was created without the CDO compatibility option) you can convert it by right-clicking file .genmodel and clicking on CDO -> Migrate EMF Generator Model (dynamic feature delegation)

and obviously re-generating model sources

further, in plug-in it.rcpvision.rcptutorial.model, we need to add a dependence on CDO

In the end we are ready to really create our client. Create an RCP application the usual way (see How to create an RCP application) and add the following dependences:

  • it.rcpvision.rcptutorial.model
  • org.eclipse.emf.cdo.net4j
  • org.eclipse.net4j.tcp
  • org.junit

Let’s create now a class named “TestCdoClient” in the main package, with the following content

As you can see it is a JUnit test that connects to the “demo” CDO repository which is available at address “localhost” (should the client be executed on a different computer you should obviously change this address with the one from the CDO server). Then some model instance are created and persisted inside a CDO transaction.

Let’s launch it with right-click Run As -> JUnit Test

If all run successfully you should see an ok outcome on JUnit View


and you should see the inserterd data on the database.

Please note that we created an RCP application and then created and used a simple (stand-alone) JUnit class to access CDO. This was made for the following reasons:

  • to obtain quickly a CDO client (we just needed to add some Dependencies)
  • to demonstrate how easily is accessing to a CDO server (no need of OSGi/Equinox at runtime)

Moreover, in the next tutorials we will often start with an RCP application that access to a CDO server repository.

For CDO development or consulting, send an email to   info@rcp-vision.com

For CDO training, send an email to   training@rcp-vision.com

Back to index

2014-12-22T17:02:55+00:00By |

31 Comments

  1. umashankarsubramani Thursday December 8th, 2011 at 06:09 PM - Reply

    When I run the server as “Eclipse Application” from the overview tab, I got the following error. Could you please help me?

    java.lang.NoClassDefFoundError: Workspace\it/rcpvision/rcptutorial/cdo/server\rootfiles\configuration
    Caused by: java.lang.ClassNotFoundException: Workspace\it.rcpvision.rcptutorial.cdo.server\rootfiles\configuration
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    Exception in thread “main”

    • Vincenzo Wednesday December 14th, 2011 at 12:27 AM - Reply

      Hi,
      did you added exactly the plug-ins listed in the Feature?
      Are you using Eclipse 3.7.1 and the Update Site indicated above?

      • umashankarsubramani Friday January 13th, 2012 at 06:15 PM - Reply

        I solved that problem. The location I specified was wrong.

        • Silvio Lopez Thursday October 3rd, 2013 at 11:45 PM - Reply

          how do you configure the location of server?

  2. umashankarsubramani Friday January 13th, 2012 at 06:13 PM - Reply

    The server configuration given here, does not work. Rather, I used the one given here: http://wiki.eclipse.org/Getting_started_with_CDO_Helios

    Is it okay, to use this server configuration?

  3. Giancarlo Tuesday February 7th, 2012 at 11:51 AM - Reply

    Ciao Vincenzo,

    innanzitutto complimenti per le guide.

    Ho un problema che non riesco a risolvere. Ho fatto tutti gli step, dall’app RCP alla creazione del server CDO.
    Però non riesco a far dialogare il server con il mio datasource. Non ho usato MySql perchè ho SQLServer, che devo dire, con gli altri esercizi funziona.
    Come posso ovviare al problema ?
    Ovviamente ho inserito nelle features quella della connessione a sqlserver. (com.microsoft.sqlserver.jdbc)
    Ti posto il datasource:
    ______________________________________________________________

    ___________________________________________________________
    Dove sbaglio ? L’errore della console è :

    ENTRY org.eclipse.emf.cdo.server 1 0 2012-02-07 11:31:10.953
    !MESSAGE CDO server starting
    [ERROR] Unknown DB adapter: sqlserver
    java.lang.IllegalArgumentException: Unknown DB adapter: sqlserver
    at org.eclipse.emf.cdo.server.internal.db.DBStoreFactory.getDBAdapter(DBStoreFactory.java:105)
    at org.eclipse.emf.cdo.server.internal.db.DBStoreFactory.createStore(DBStoreFactory.java:52)
    at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.createStore(RepositoryConfigurator.java:291)
    at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.getRepository(RepositoryConfigurator.java:163)
    at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.configure(RepositoryConfigurator.java:105)
    at org.eclipse.emf.cdo.internal.server.bundle.CDOServerApplication.doStart(CDOServerApplication.java:61)
    at org.eclipse.net4j.util.om.OSGiApplication.start(OSGiApplication.java:61)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.equinox.internal.app.AnyThreadAppLauncher.run(AnyThreadAppLauncher.java:26)
    at java.lang.Thread.run(Unknown Source)

    Grazie ciao….

    • Vincenzo Monday February 20th, 2012 at 11:32 PM - Reply

      Ciao Giancarlo,
      quando si cambia tipo di database la feature del driver JDBC (es. com.microsoft.sqlserver.jdbc) non è sufficiente.
      Occorre anche la feature dell’Adapter per Net4J (l’errore infatti dice “Unknown DB adapter: sqlserver”).
      Come puoi vedere nella figura in alto (sotto la dicitura “Net4j DB Framework MYSQL Adapter”) non è presente un Adapter per MsSQL al momento. Quindi se scegli CDO hai due strade: o scegli un tipo di database diverso (tra Derby, H2, HSQLDB, MYSQL, PostgreSQL) oppure implementi un Adapter per il database specifico.
      Se scegli invece Teneo (=il client accede direttamente al database, a differenza di CDO dove il client accede ad un server CDO il quale poi accede al db) allora potrai usare MsSQL (Teneo usa Hibernate, quindi basta cambiare il dialect).

  4. Giancarlo Tuesday February 7th, 2012 at 11:55 AM - Reply

    Ecco il datasource

    ..cdoServer…
    ..acceptor type=”tcp” listenAddr=”0.0.0.0″ port=”2036″…
    …acceptor…
    …repository name=”demo”…
    ..store type=”db”…
    …mappingStrategy type=”horizontal”/…
    …dbAdapter name=”sqlserver”/…
    …dataSource
    class=”com.microsoft.sqlserver.jdbc.SQLServerDriver”
    url=”jdbc:sqlserver://localhost:1433;DatabaseName=CDOSERVER”
    user=”++++”
    password=”——-”
    /…
    …/store…
    …/repository…
    ../cdoServer…

  5. Mark Rowe Saturday September 15th, 2012 at 09:01 PM - Reply

    Vincenzo, thanks for a really great tutorial. I wish I had read this earlier, will now continue with your series 🙂

  6. Julia Thursday November 8th, 2012 at 12:53 PM - Reply

    Hello,
    I’m trying to run the Client, but I got following error message:
    Exception in thread “main” org.eclipse.net4j.util.container.FactoryNotFoundException: Factory not found: org.eclipse.net4j.connectors[tcp]
    caused by:
    IConnector connector = (IConnector)container.getElement(“org.eclipse.net4j.connectors”, “tcp”, “localhost:2036”);
    I ‘m using Eclipse Indigo 3.7.2 and CDO 4.0
    Can you help me?

  7. Stefano Friday January 25th, 2013 at 11:37 AM - Reply

    io non ho questa opzione “org.eclipse.emf.cdo.server.product.tcp_h2“ come mai?

    • Stefano Friday January 25th, 2013 at 12:32 PM - Reply

      Risolto, mi mancavano dei plugin

  8. Modeji Thursday January 31st, 2013 at 10:49 AM - Reply

    Hello, I am trying to connect eclipse rcp 4 to a backend database (MySQL) using hibernate. I tried to follow your tutorial to do just that, however, am getting this error:

    SEVERE: Could not find EPackage “http://www.eclipse.org/emf/teneo/hibernate/examples/extlibrary”.
    org.xml.sax.SAXException: Could not find EPackage “http://www.eclipse.org/emf/teneo/hibernate/examples/extlibrary”.
    at org.eclipse.emf.teneo.annotations.xml.XmlPersistenceContentHandler.startElement(XmlPersistenceContentHandler.java:311)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:506)
    at org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initialize(HbSessionDataStore.java:112)
    at org.eclipse.emf.teneo.hibernate.examples.samples.Tutorial.main(Tutorial.java:97)

    I then commented out the following line:
    hibernateProperties.setProperty(PersistenceOptions.PERSISTENCE_XML, “org/eclipse/emf/teneo/hibernate/examples/annotations.xml”);

    I am now getting this error:

    Exception in thread “main” org.hibernate.QueryException: could not resolve property: name of: Writer [SELECT book FROM Book book, Writer writ WHERE book.title=’1984′ AND book.author=writ AND writ.name=’G. Orwell’]
    at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:83)
    at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1649)
    at org.eclipse.emf.teneo.hibernate.examples.samples.Tutorial.main(Tutorial.java:193)

    Please could you let me know where is it that am going wrong.
    Thanks

    • Vincenzo Friday February 1st, 2013 at 05:30 PM - Reply

      Hi Modeji,
      in CDO there exists several implementation of ‘Stores’, e.g. DBStore, HibernateStore, DB4OStore, MEMStore, ObjectivityStore.
      In this tutorial we use DBStore, which does not uses Hibernate.
      I suppose you are using HibernateStore instead, do you?
      In this case I cannot help unless you provide all sources and xml files content.

      Vincenzo

      • Modeji Friday February 1st, 2013 at 09:43 PM - Reply

        Hi Vincezo, thank you for the response.

        That was very informative. I am very new to the CDO project. I was actually trying to do databinding to an Elipse RCP SWT widget with the sample ExtlibraryPackage project. I tried to do so by following the above tutorial and the “WindowBuilder: installing and EMF databinding” tutorial.

        The most important question that I have is that: can I actually use the CDO HibernateStore to perform CRUD in Eclipse RCP without going through or creating the whole .genmodel, .ecore and ecore_diagram stuff? If so is there any example code that I could follow?

        • Vincenzo Saturday February 2nd, 2013 at 01:04 AM - Reply

          Hi Modeji,
          HibernateStore is just another way to let CDO persist data on a RDBMS, so, unless you need it for particular purposes (e.g. want to use a database supported by Hibernate, but not yet supported by DBStore) you barely see differences in a simple application.
          CDO works with an EMF Model, so, yes, you have to go through .ecore (diagram is not necessary, it’s just a different way to handle .ecore) and then .genmodel

  9. Modeji Thursday January 31st, 2013 at 10:52 AM - Reply

    I am using eclipse 4.2 (Juno) and CDO 4.1

  10. Ivan Alejandro Wednesday May 8th, 2013 at 01:10 AM - Reply

    ciao Vincenzo

    the method named “add” doesnt exist on the class “Author”,
    what should i do ?

    example:

    Author author = LibraryFactory.eINSTANCE.createAuthor();
    author.setName(“Ed”);
    library.getListAuthor().add(author);
    book.getAuthor().add(author); //ERROR

  11. Vincenzo Wednesday May 8th, 2013 at 09:24 AM - Reply

    Ciao Alejandro,
    the article has a reference to the (prerequiste) following tutorial
    http://www.rcp-vision.com/?p=603&lang=en
    At the end of this tutorial the model is changed in order to allow multiple authors for a book.
    Probably you did not followed this last step.
    Alternatively (if you want to keep a single author for a book) you can do just:

    book.setAuthor(author);

    Let me know
    Vincenzo

  12. Ivan Alejandro Tuesday May 28th, 2013 at 12:58 AM - Reply

    ciao vincezo,

    When I run the server as “Eclipse Application” from the overview tab, I got the following error. Could you please help me?

    [INFO] CDO server starting
    !SESSION 2013-05-27 18:48:36.356 ———————————————–
    eclipse.buildId=unknown
    java.version=1.6.0_45
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=es_CO
    Framework arguments: -product org.eclipse.emf.cdo.server.product.tcp_h2
    Command-line arguments: -product org.eclipse.emf.cdo.server.product.tcp_h2 -data F:\tesis\eclipse\workspace_rcpvision/../runtime-CDO-server.product -dev file:F:/tesis/eclipse/workspace_rcpvision/.metadata/.plugins/org.eclipse.pde.core/CDO-Server.product/dev.properties -os win32 -ws win32 -arch x86 -consoleLog

    !ENTRY org.eclipse.emf.cdo.server 1 0 2013-05-27 18:48:37.183
    !MESSAGE CDO server starting
    [ERROR] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘OPTION SQL_SELECT_LIMIT=DEFAULT’ at line 1
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘OPTION SQL_SELECT_LIMIT=DEFAULT’ at line 1
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    at com.mysql.jdbc.Util.getInstance(Util.java:381)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1051)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2687)
    at com.mysql.jdbc.ConnectionImpl.unsetMaxRows(ConnectionImpl.java:5571)
    at com.mysql.jdbc.StatementImpl.realClose(StatementImpl.java:2374)
    at com.mysql.jdbc.StatementImpl.close(StatementImpl.java:508)
    at org.eclipse.net4j.db.DBUtil.close(DBUtil.java:222)
    at org.eclipse.net4j.spi.db.DBAdapter.createTables(DBAdapter.java:123)
    at org.eclipse.net4j.spi.db.DBSchema.create(DBSchema.java:118)
    at org.eclipse.emf.cdo.server.internal.db.DBStore.doActivate(DBStore.java:531)
    at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:76)
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:114)
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:104)
    at org.eclipse.emf.cdo.internal.server.Repository.doActivate(Repository.java:1846)
    at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:76)
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:114)
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:104)
    at org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOServerUtil.java:208)
    at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.configure(RepositoryConfigurator.java:111)
    at org.eclipse.emf.cdo.internal.server.bundle.CDOServerApplication.doStart(CDOServerApplication.java:61)
    at org.eclipse.net4j.util.om.OSGiApplication.start(OSGiApplication.java:63)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.equinox.internal.app.AnyThreadAppLauncher.run(AnyThreadAppLauncher.java:26)
    at java.lang.Thread.run(Thread.java:662)

    [ERROR] Problem with table cdo_lobs: SELECT id, size, bdata, cdata FROM cdo_lobs
    org.eclipse.net4j.db.DBException: Problem with table cdo_lobs: SELECT id, size, bdata, cdata FROM cdo_lobs..

    :'( … another question -> do you speak spanish ?( Español )

    • Vincenzo Tuesday May 28th, 2013 at 10:06 PM - Reply

      Ciao Ivan,
      no, I don’t speak spanish, although, being italian probably I could easily understand most words 😉
      Anyway, I never saw the problem you are reporting.
      Could you please provide the exact versions of the following items?
      – Eclipse Juno SR1 or SR2?
      – Juno Modeling package or other?
      – versions of CDO R…, Net4j DB Framework, Net4j DB Framework MYSQL Adapter
      – version of MySQL
      Thank you
      Vincenzo

      • Ivan Alejandro Wednesday May 29th, 2013 at 11:38 PM - Reply

        vincenzo mira

        – Juno Service Release 2
        – Eclipse Modeling Framework Runtime and Tools Version: 2.8.3.
        – CDO Model Repository Client Version: 4.1.2
        – CDO Model Repository Server Version: 4.1.2
        – Net4j DB Framework Version: 4.1.2
        – Net4j DB Framework MYSQL Adapter Version: 4.1.0
        – MySQL Server 5.6

        Ojalá y pueda ayudarme, gracias!!

        • Darren Thursday May 30th, 2013 at 12:27 PM - Reply

          The problem is that in MySQL 56 they removed the SET OPTION syntax and replaced it with just SET, so
          SET SQL_SELECT_LIMIT=10;
          works, but:
          SET OPTION SQL_SELECT_LIMIT=10

          It seems that something in CDO/Net4j etc. is making statements that use the old and now defunct syntax, which means that CDO etc. is probably not compatible with MySQL 56 at present (unless there are later versions of the features used in this tutorial).

          See:
          http://stackoverflow.com/questions/13023548/mysql-server-version-for-the-right-syntax-to-use-near-option-sql-select-limit-1

          • Ivan Alejandro Friday May 31st, 2013 at 12:05 AM

            Is it necessary to change my version of MySQL?

          • Vincenzo Friday May 31st, 2013 at 05:23 PM

            Ivan,
            the problem is summarized here https://bugs.eclipse.org/bugs/show_bug.cgi?id=409558.
            For now you can do two things: either install MySQL 5.5 or do the following trick.
            – open view “Plug-ins”, select “com.mysql.jdbc”, right-click “Import as” -> “Source project”
            – go back to “Package Explorer” view
            – remove file “mysql-connector… .jar” and copy here the one you can find in your MySQL 5.6 installation (if you downloaded the Installer version and followed the default wizard you’ll find it in \Program Files\MySQL\Connector J 5.1.24\mysql-connector-java-5.1.24-bin.jar)
            – rename the file into com.mysql.jdbc_5.1.11.201210222237.jar
            or
            – go to MANIFEST.MF, tab Runtime and add the correct jar in the Classpath section and Export all its packages in the Exported Packages section
            then it works!

  13. Simone Wednesday July 24th, 2013 at 03:08 PM - Reply

    Ciao,
    ho dovuto modificare il tuo metodo openSession con il seguente codice:

    public static CDOSession openSession() {
    CDONet4jSessionConfiguration sc = CDONet4jUtil.createNet4jSessionConfiguration();
    IManagedContainer container = IPluginContainer.INSTANCE;
    Net4jUtil.prepareContainer(container); // Register Net4j factories
    TCPUtil.prepareContainer(container); // Register TCP factories
    CDONet4jUtil.prepareContainer(container); // Register CDO factories
    sc.setConnector(Net4jUtil.getConnector(container, “tcp://” + CONNECTION_ADDRESS));
    sc.setRepositoryName(REPO_NAME);
    CDONet4jSession session = sc.openNet4jSession();
    return session;
    }

    In questo modo sono riuscito a farlo funzionare. Magari può essere di aiuto a qualcun altro 🙂
    Complimenti per l’ottimo tutorial che hai scritto 🙂 Mi hai fatto risparmiare tantissimo tempo.

  14. Silvio Lopez Monday September 9th, 2013 at 10:22 PM - Reply

    I need help, I do “data binding” but not on the tutotial of cdo but on the local database, then I call the resource from the class “ViewPart”, but I run praises “data binding”, Am I doing wrong? :
    UriStr String = “hibernate :/ /?” + HibernateResource.DS_NAME_PARAM + “= mydb”;
    URI uri = URI.createURI end (uriStr);
    ResourceSetImpl resourceSet = new ();
    Resource resource = (Resource) resourceSet.getResources ();

    try {
    resource.load (null);
    library = (Library) resource.getContents (). get (0);
    resource.getContents (). add (LibraryFactory.eINSTANCE.createLibrary ());
    resource.save (null);

    } Catch (Exception e) {
    / / TODO Auto-generated catch block
    e.printStackTrace ();
    }

  15. Vincenzo Tuesday September 10th, 2013 at 10:37 PM - Reply

    Hi Silvio,
    can you describe better your use case?
    Looking at the code above seems that you are first loading the first (0) library object in the resource, then adding a new (second) library to the same resource and in the end saving. So at each execution you are adding a new library, but just the first is always assigned to library variable, while the others are discarded.
    Apart from this, what is the problem with data binding?

Leave A Comment