CDO – Connected Data Objects

Introduzione a CDO

Questo framework, che è un componente del progetto EMF, permette la condivisione di un modello EMF.
Se con Teneo quindi possiamo fare in modo che ciascun client possa accedere ad un database (realizzando un client/server a due livelli), con CDO abbiamo la possibilità che i vari client accedano ad un server che mette loro a disposizione la medesima istanza, condivisa, del modello EMF adobe reader 무료.
In questo tutorial vedremo come:

  • installare CDO
  • creare un server CDO
  • creare un client CDO

Per una documentazione dettagliata su CDO potete consultare il seguente link http://www.eclipse.org/cdo/documentation/
Mentre qui potete scaricare le varie versioni http://www.eclipse.org/cdo/downloads/

Installazione di CDO

Vediamo quindi come installare CDO partendo dalla versione Eclipse 4.3 (Kepler) Modeling. CDO può essere utilizzato con diversi tipi di Store; in questo caso installeremo i necessari plugins per l’utilizzo di DBStore skt lte.

Inoltre visto che useremo un database MySQL dovremo anche assicurarci di aver installato il plug-in che contiene il JDBC driver corrispondente (se avete seguito il tutorial Setup Teneo per Eclipse 4.2 ÔÇô Juno potete saltare questo step).
(Nota: per l’esecuzione corretta di questo tutorial si consiglia di usare una versione di MySQL non superiore alla 5.5)

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

  • MySQL Connector/J

A questo punto installiamo Net4j DB Adapter per MySQL
Update Site =>
http://download.eclipse.org/modeling/emf/cdo/updates/releases

Espandiamo la categoria pi├╣ recente e selezioniamo:

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

Creare un server CDO

In questa sezione vedremo come realizzare un prodotto Eclipse, basato su features, in grado di lanciare un server CDO attraverso un file di configurazione XML 쉘부르의 우산 다운로드.

In terminologia Eclipse una feature rappresenta un gruppo di plug-ins che collaborano per la realizzazione di una determinata funzionalità.

Creiamo quindi un Feature Project selezionando File -> New -> Project… -> Plug-in Development -> Feature Project

premiamo Next e allo step successivo diamo un nome al nostro progetto, ad es rhino mac. it.rcpvision.rcptutorial.cdo.server

poi Finish.

Quello che abbiamo ottenuto è una feature vuota; andiamo quindi a specificare (tab Plug-ins) da quali plug-ins è composta premendo il bottone Add… e aggiungendo i seguenti

Per comodità riportiamo di seguito il contenuto testuale del file feature.xml, modificabile attraverso il tab “feature.xml

A questo punto creiamo un product basato su questa feature, selezionando il progetto, tasto destro New -> Other… -> Plug-in Development -> Product Configuration

premiamo Next 생일축하 다운로드.

Allo step successivo diamo un nome al nostro Prodotto, ad es. CDO-Server.product,

selezioniamo il radio-button “Use an existing product” e nella combo a fianco del radio-button selezionato impostiamo il valore “org.eclipse.emf.cdo.server.product.tcp_h2“, poi Finish.

Ciò che abbiamo ottenuto è un prodotto, basato però su plug-ins.

per basarlo su features dobbiamo selezionare il secondo radio-button

a questo punto, per indicare da quali features è composto il prodotto, selezioniamo il tab Dependencies

premiamo il bottone Add…

e selezioniamo la feature creata in precedenza (it.rcpvision.rcptutorial.cdo.server)

e salviamo il prodotto (Ctrl-S) video from the web.

Dobbiamo ora definire il file XML di configurazione per CDO. Selezioniamo quindi il progetto e creiamo una cartella chiamata “rootfiles” con tasto destro New -> Folder

e poi un’altra sottocartella chiamata “configuration

all’interno di quest’ultima creiamo un file (tasto destro, New -> File) chiamato cdo-server.xml e copiamo all’interno del file il seguente contenuto

In pratica questo file di configurazione indica che il server CDO sarà attivo sulla porta TCP 2036 e metterà a disposizione un repository CDO chiamato “demo“. Seguono le coordinate per l’accesso al database.

Notate che al primo avvio o dopo modifiche al modello, è opportuno effettuare un preventivo drop del database; esso verrà creato all’avvio del server wget 폴더 다운로드.

Prima di lanciare il server dobbiamo ancora indicare il valore del parametro che specifica la posizione del file di configurazione appena creato. Per fare questo selezioniamo nuovamente il prodotto, andiamo nel tab Launching e nella sezione VM Arguments indichiamo

salviamo il prodotto, torniamo sul tab Overview e lanciamo, con

Launch An Eclipse Application

La console dovrebbe presentare un output che termina con

Verificate ora che il database sia stato creato correttamente Tingalba download.

(Nota: se ricevete messaggi di errore assicuratevi che il firewall di sistema non stia bloccando le porte 2036 e 3306)

Bene, ora all’indirizzo di rete della macchina in questione, alla porta di Net4j configurata (2036) è a disposizione il CDO repositorydemo“.

Un’ultima osservazione: in vista di un successivo deploy del prodotto è opportuno indicare che esso deve comprendere anche il file di configurazione praises. Per fare ciò apriamo il file build.properties, andiamo sul tab Build e nella sezione “Binary Build” selezioniamo la cartella “rootfiles“.

Creare un client CDO

Useremo anche qui lo stesso modello EMF (il plug-in it.rcpvision.rcptutorial.model) usato in precedenza e illustrato nel tutorial Eclipse EMF: Progettare il Modello 침대렐라 다운로드. Nel caso stiate per rifare quel tutorial, tenete conto che stavolta, al momento della creazione dell’EMF Generator Model (.genmodel), allo step “Select a Model Importer” dovrete selezionare “Ecore model (CDO Native)“.

Altrimenti, se avete già pronto il precedente plugin di model (creato senza la compatibilità con CDO) potete convertirlo selezionando il file .genmodel e premendo tasto destro CDO -> Migrate EMF Generator Model (dynamic feature delegation)

e naturalmente rigenerando i sorgenti

inoltre è necessario in questo caso aggiungere, nel plug-in it.rcpvision.rcptutorial.model, la dipendenza da CDO

Siamo finalmente pronti per realizzare il nostro client. Creiamo quindi un’applicazione RCP nel solito modo (vedi Come creare unÔÇÖapplicazione Eclipse RCP) e aggiungiamo le seguenti dipendenze:

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

Creiamo ora una classe chiamata “TestCdoClient” nel package principale, con il seguente contenuto

Come potete osservare si tratta di un test JUnit che si connette al repository “demo” disponibile all’indirizzo “localhost” (se il client viene eseguito su una macchina diversa questo indirizzo deve ovviamente essere quello dove gira il server CDO). Vengono poi create istanze degli oggetti del modello e salvate all’interno di una transazione CDO.

Lanciamola con tasto destro Run As -> JUnit Test

Se il tutto ha girato correttamente dovreste vedere un esito positivo sulla View di JUnit

e sul database troverete i dati inseriti.

Notate che abbiamo creato un’applicazione RCP e poi abbiamo in realtà utilizzato CDO da una semplice classe (standalone) di JUnit. Questo è stato fatto per due ragioni:

  • per brevità di tutorial (ci è bastato aggiungere alcune dipendenze nel tab Dependencies)
  • per dimostrare la facilità con cui è possibile accedere ad un server CDO (non è necessario avere OSGi/Equinox in esecuzione)

Nei tutorial che seguiranno peraltro ci troveremo spesso a realizzare applicazioni RCP che accedono ad un CDO server repository.

Per sviluppo o consulenza su CDO   info@rcp-vision.com

Per informazioni sulla formazione su CDO   training@rcp-vision.com

Torna allÔÇÖindice

By |2020-04-27T09:20:45+00:00September 23rd, 2011|

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