Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] QuickStartTest with Spring/Teneo/Hibernate stack
[CDO] QuickStartTest with Spring/Teneo/Hibernate stack [message #634040] Wed, 20 October 2010 11:10 Go to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Hi all,

we are trying to set up CDO for use in a JavaEE application on the server side and RCP as client. Therefore we have adjusted the org.eclipse.emf.cdo.examples.spring example to use Teneo/Hibernate in a standalone environment, where we took the initialization from org.eclipse.emf.cdo.examples.hibernate.server.

So far the server starts up, CDO tables are created in the database etc. But now we are stuck with the client, where we take the QuickStartTest from org.eclipse.emf.cdo.examples.hibernate.client. When we understand correctly this we should not need any modifications to this code. However, we run in a problem when creating the resource.

      final CDOSession session = openSession();
      final CDOTransaction transaction = session.openTransaction();
      // get/create a resource
      CDOResource resource = transaction.getOrCreateResource("/res1"); //$NON-NLS-1$


The last line fails, since there is no root resource. The session object is ready, we have a transaction.

In CDOViewImpl#getRootResource() there is the following line:
      CDOID rootResourceID = session.getRepositoryInfo().getRootResourceID();


As result we get the CDOIDNullImpl instance.

On the server side after initialization we get a dump from the Repository on the console (we use Repository$Default and run activate() on it before use). This dump also says that the rootResourceId is null.

Does anyone know what has to be initialized/changed to get this setup working? Any hints appreciated.

~Karsten


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: [CDO] QuickStartTest with Spring/Teneo/Hibernate stack [message #634048 is a reply to message #634040] Wed, 20 October 2010 11:36 Go to previous messageGo to next message
Stefan Winkler is currently offline Stefan WinklerFriend
Messages: 307
Registered: July 2009
Location: Germany
Senior Member
Hi Karsten,

the root resource is created on the server side of CDO.
The code responsible for this is
org.eclipse.emf.cdo.internal.server.Repository.initRootResou rce()
which is called in Repository.doActivate().

Could you set a breakpoint there and have a look what's going on?

Cheers,
Stefan




On 20.10.2010 13:10, Karsten Thoms wrote:
> Hi all,
>
> we are trying to set up CDO for use in a JavaEE application on the
> server side and RCP as client. Therefore we have adjusted the
> org.eclipse.emf.cdo.examples.spring example to use Teneo/Hibernate in a
> standalone environment, where we took the initialization from
> org.eclipse.emf.cdo.examples.hibernate.server.
>
> So far the server starts up, CDO tables are created in the database etc.
> But now we are stuck with the client, where we take the QuickStartTest
> from org.eclipse.emf.cdo.examples.hibernate.client. When we understand
> correctly this we should not need any modifications to this code.
> However, we run in a problem when creating the resource.
>
>
> final CDOSession session = openSession();
> final CDOTransaction transaction = session.openTransaction();
> // get/create a resource
> CDOResource resource = transaction.getOrCreateResource("/res1");
> //$NON-NLS-1$
>
>
> The last line fails, since there is no root resource. The session object
> is ready, we have a transaction.
>
> In CDOViewImpl#getRootResource() there is the following line:
>
> CDOID rootResourceID = session.getRepositoryInfo().getRootResourceID();
>
>
> As result we get the CDOIDNullImpl instance.
>
> On the server side after initialization we get a dump from the
> Repository on the console (we use Repository$Default and run activate()
> on it before use). This dump also says that the rootResourceId is null.
>
> Does anyone know what has to be initialized/changed to get this setup
> working? Any hints appreciated.
>
> ~Karsten
Re: [CDO] QuickStartTest with Spring/Teneo/Hibernate stack [message #634050 is a reply to message #634040] Wed, 20 October 2010 11:50 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Hi Stefan!

The method is not called. We found out in the meantime that in Repository#doActivate()
    
if (store.isFirstTime())
    {
      initSystemPackages();
      initRootResource();
    }

store.isFirstTime() returns false and indeed the table cdo_system_information already holds an entry. This causes that initRootResource() is not called.

Maybe this is an inconsistent state we produced before. We will now drop the database and try again.

Many thanks for your valuable feedback!

~Karsten


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: [CDO] QuickStartTest with Spring/Teneo/Hibernate stack [message #634061 is a reply to message #634040] Wed, 20 October 2010 12:14 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Hi Stefan!

We actually came further now. The CDO tables contains now informations about some packages. Now we are facing some more problems with Teneo and Hibernate, but our root resource is created successfully. The server log contains an entry for the root resource at the end of the startup procedure.

These kind of problems we can handle again. When we are stuck or hopefully through I'll give a notice again.

Once again thank you!

~Karsten
Re: [CDO] QuickStartTest with Spring/Teneo/Hibernate stack [message #634118 is a reply to message #634040] Wed, 20 October 2010 14:54 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

OK, we are through. We stumbled over one issue in TeneoHibernateMappingProvider:

In method generateMapping() the EcorePackage and EresourcePackage are removed by reference from the list of packages that should be generated:
    // translate the list of EPackages to an array
    final List<EPackage> epacks = getHibernateStore().getPackageHandler().getEPackages();
    // remove the ecore and resource package
    epacks.remove(EcorePackage.eINSTANCE);
    epacks.remove(EresourcePackage.eINSTANCE);

But the PackageHandler retrieves other instances. These both packages must be removed by comparing their eNS_URI. Otherwise these packages are not removed from 'epacks' and with restarting the server it fails with a DuplicateMappingException.

I think I will open a bug for that soon.

Thanks again for listening!

~Karsten
Re: [CDO] QuickStartTest with Spring/Teneo/Hibernate stack [message #634134 is a reply to message #634118] Wed, 20 October 2010 15:16 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Karsten,
Great that you found this..., I was travellling so I did not see your post earlier, enter a bugzilla and I will take
care of it asap.

gr. Martin

On 10/20/2010 04:54 PM, Karsten Thoms wrote:
> OK, we are through. We stumbled over one issue in
> TeneoHibernateMappingProvider:
>
> In method generateMapping() the EcorePackage and EresourcePackage are
> removed by reference from the list of packages that should be generated:
>
> // translate the list of EPackages to an array
> final List<EPackage> epacks =
> getHibernateStore().getPackageHandler().getEPackages();
> // remove the ecore and resource package
> epacks.remove(EcorePackage.eINSTANCE);
> epacks.remove(EresourcePackage.eINSTANCE);
>
> But the PackageHandler retrieves other instances. These both packages
> must be removed by comparing their eNS_URI. Otherwise these packages are
> not removed from 'epacks' and with restarting the server it fails with a
> DuplicateMappingException.
>
> I think I will open a bug for that soon.
>
> Thanks again for listening!
>
> ~Karsten


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:Re: Data type and configuring to existing DB
Next Topic:[CDO] Problem after CDO Source Installation
Goto Forum:
  


Current Time: Tue Apr 16 09:54:32 GMT 2024

Powered by FUDForum. Page generated in 0.04287 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top