[CDO] QuickStartTest with Spring/Teneo/Hibernate stack [message #634040] |
Wed, 20 October 2010 11:10 |
|
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 |
Stefan Winkler 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 |
|
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 |
|
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 |
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.04479 seconds