Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » CDO-Hibernate setup problems
CDO-Hibernate setup problems [message #422939] Fri, 19 September 2008 11:37 Go to next message
daniel kroeni is currently offline daniel kroeniFriend
Messages: 19
Registered: July 2009
Junior Member
Hi all,
I try to setup cdo with a HibernateStore backend. After fighting with
https://bugs.eclipse.org/bugs/show_bug.cgi?id=238254 the server starts
now, but hibernate is not able to see CDOResource (trace at the bottom).

My target:
CDO I200809110653
EMF I200809021800
Net4j I200809110620
Teneo M200809101825
eclipse-equinox 3.4
some more core bundles from eclipse 3.4
hibernate libs copied from the CDO development target (those from the
spingsource repository)

My application:
Bundle A: contains an Activator that starts the server
Dependencies:
Require-Bundle: ch.psi.cpt.gpdb.domain;bundle-version="1.0.0",
org.eclipse.core.runtime;bundle-version="3.4.0",
org.eclipse.emf.cdo.server;bundle-version="1.0.0",
org.eclipse.net4j.jvm;bundle-version="1.0.0",
org.eclipse.emf.cdo;bundle-version="1.0.0",
org.eclipse.net4j.tcp;bundle-version="1.0.0",
org.eclipse.emf.cdo.server.hibernate.teneo;bundle-version="2.0.0 ",
com.mysql.jdbc;bundle-version="5.1.6"


Bundle B: contains the domain model (emf/cdo)
Dependencies:
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.emf.cdo;visibility:=reexport,
org.eclipse.emf.teneo.hibernate;visibility:=reexport,
org.hibernate;bundle-version="3.2.6";visibility:=reexport

The org.hibernate bundle contains the line: Eclipse-BuddyPolicy: dependent
Since org.eclipse.emf.cdo has no dependency on org.hibernate (for good
reason), I have no idea how this can be fixed. It also seems strange to
convert my domain model bundle to a fragment and attach it to
org.hibernate..

Has anybody an idea how to fix this class loading problem?

Cheers and thanks

Daniel

@Eike After I have a setup that works, I'm willing to implement the
hibernate query support, since my customer decided to put some effort into
CDO. This is good news =)


[ERROR] Unknown entity: CDOResource
org.hibernate.MappingException: Unknown entity: CDOResource
at
org.hibernate.impl.SessionFactoryImpl.getEntityPersister(Ses sionFactoryImpl.java:550)
at
org.hibernate.impl.SessionImpl.getOuterJoinLoadable(SessionI mpl.java:1584)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1550)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readResourceID(HibernateStoreReader.java:103)
at
org.eclipse.emf.cdo.internal.server.ResourceManager.loadID(R esourceManager.java:92)
at
org.eclipse.emf.cdo.internal.server.ResourceManager.getResou rceID(ResourceManager.java:53)
at
org.eclipse.emf.cdo.internal.server.protocol.ResourceIDIndic ation.indicating(ResourceIDIndication.java:51)
at
org.eclipse.emf.cdo.internal.server.protocol.CDOServerIndica tion.indicating(CDOServerIndication.java:116)
at org.eclipse.net4j.signal.Indication.execute(Indication.java: 48)
at
org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:38)
at
org.eclipse.emf.cdo.internal.server.protocol.CDOReadIndicati on.execute(CDOReadIndication.java:35)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:186)
at org.eclipse.net4j.signal.Signal.run(Signal.java:167)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Re: CDO-Hibernate setup problems [message #422951 is a reply to message #422939] Fri, 19 September 2008 14:17 Go to previous messageGo to next message
Roger Stocker is currently offline Roger StockerFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Daniel

it's not a class loading problem, but a hibernate mapping problem.

In org.eclipse.emf.cdo.server.hibernate/mapping/resource.hbm.xm l there is
the mapping:
<class entity-name="CDOResource" abstract="false" lazy="false"
discriminator-value="cdoresource" table="`cdo_resources`">
<meta attribute="eclassName">CDOResource</meta>

Obviously in your setup, this mapping file was not registered with
hibernate.

Did you undeploy org.eclipse.emf.cdo.server.hibernate to your workspace
and use this for your server?

Regards
Roger
Re: CDO-Hibernate setup problems [message #422963 is a reply to message #422951] Fri, 19 September 2008 16:30 Go to previous messageGo to next message
daniel kroeni is currently offline daniel kroeniFriend
Messages: 19
Registered: July 2009
Junior Member
Hi Roger,
thanks for your reply. Answers and even more questions are inlined.

> Hi Daniel

> it's not a class loading problem, but a hibernate mapping problem.
Uff.. While setting up an osgi server, I overlooked that there are other
exception than ClassNotFounds :-) Thanks for clarifying this.

> In org.eclipse.emf.cdo.server.hibernate/mapping/resource.hbm.xm l there is
> the mapping:
> <class entity-name="CDOResource" abstract="false" lazy="false"
> discriminator-value="cdoresource" table="`cdo_resources`">
> <meta attribute="eclassName">CDOResource</meta>

> Obviously in your setup, this mapping file was not registered with
> hibernate.
You are right. I do not register any mapping files in my actual setup.

> Did you undeploy org.eclipse.emf.cdo.server.hibernate to your workspace
> and use this for your server?
No, my server is a simple bundle with the following code invoked from the
Activator's start method:

<snip>
IManagedContainer container = IPluginContainer.INSTANCE;
ITCPAcceptor tcpAcceptor = TCPUtil.getAcceptor(container,
"127.0.0.1:2036");
CDOServerUtil.addRepository(container,
HbStoreRepositoryProvider.getInstance().createRepository(REP OSITORY_NAME,
new HashMap<String, String>()));

CDOSessionConfiguration config = CDOUtil.createSessionConfiguration();
connector = TCPUtil.getConnector(container,"127.0.0.1:2036");
config.setConnector(connector);
config.setRepositoryName(REPOSITORY_NAME);
config.setLegacySupportEnabled(false);
session = config.openSession();

session.getPackageRegistry().putEPackage(DomainPlugin.getPac kage());
</snip>

I copied the class HbStoreRepositoryProvider from the hibernate test
bundle. I assumed that cdo is initializing cdo specific hibernate
mappings. Do I have to do it by myself? It seems to that I am missing a
piece between hibernate and cdo.

> Regards
> Roger

Thanks for your help and regards
Daniel
Re: CDO-Hibernate setup problems [message #422998 is a reply to message #422963] Sat, 20 September 2008 16:12 Go to previous messageGo to next message
Roger Stocker is currently offline Roger StockerFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Daniel

no problem, I almost overlooked it myself that it is not a class loading
issue :-)

No, you don't have to register the internal mappings yourself.
I am not sure why these files weren't registered in your setup. I can just
tell you, how I did my setup, maybe it helps:

I am starting my cdo server as an eclipse application using
org.eclipse.emf.cdo.server.app as the Application class. Next I did
undeploy the plugin org.eclipse.emf.cdo.server.hibernate, because of the
bug you mentioned (and I guess there is also a problem with these mapping
files when using the plugin jar'd).

I configured everything within a cdo-server.xml inside a starter plugin.

Regards
Roger
Re: CDO-Hibernate setup problems [message #423007 is a reply to message #422998] Sun, 21 September 2008 08:21 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Guys,

Sorry that I jump in so late but it's nice to see that you're also
starting to help each other ;-)
Please tell me if any issues remain.

Enjoy your weekend
/Eike



Roger schrieb:
> Hi Daniel
>
> no problem, I almost overlooked it myself that it is not a class
> loading issue :-)
>
> No, you don't have to register the internal mappings yourself.
> I am not sure why these files weren't registered in your setup. I can
> just tell you, how I did my setup, maybe it helps:
>
> I am starting my cdo server as an eclipse application using
> org.eclipse.emf.cdo.server.app as the Application class. Next I did
> undeploy the plugin org.eclipse.emf.cdo.server.hibernate, because of
> the bug you mentioned (and I guess there is also a problem with these
> mapping files when using the plugin jar'd).
>
> I configured everything within a cdo-server.xml inside a starter plugin.
> Regards
> Roger
>


Re: CDO-Hibernate setup problems [message #423049 is a reply to message #422998] Mon, 22 September 2008 10:16 Go to previous messageGo to next message
daniel kroeni is currently offline daniel kroeniFriend
Messages: 19
Registered: July 2009
Junior Member
hi roger,

thanks for your help. I have tried your approach with the
org.eclipse.emf.cdo.server.app and the xml file and it almost works. Did
you also re-engineer the attributes of the hibernate store or am I missing
the main CDO documentation?

My actual server configuration looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<cdoServer>
<acceptor type="tcp" listenAddr="0.0.0.0" port="2036"/>

<repository name="gpdb">
<property name="overrideUUID"
value="1ff5d226-b1f0-40fb-aba2-0c31b38c764f"/>
<property name="supportingAudits" value="false"/>
<property name="supportingRevisionDeltas" value="false"/>
<property name="verifyingRevisions" value="false"/>
<property name="currentLRUCapacity" value="10000"/>
<property name="revisedLRUCapacity" value="100"/>
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLInnoDBDialect"/>
<property name="hibernate.connection.driver_class"
value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.url"
value="jdbc:mysql://localhost:3306/gpdb"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value="****"/>

<store type="hibernate">
<mappingProvider type="file">
<mappingFile location="mappings/gapadaba.hbm.xml"/>
</mappingProvider>

<dbAdapter name="mysql"/>
<dataSource class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
url="jdbc:mysql://localhost/gpdb"
user="root"
password="****"/>
</store>
</repository>
</cdoServer>

Then I start a bundle that executes the following code:
<snip>
CDOSessionConfiguration config = CDOUtil.createSessionConfiguration();
config.setRepositoryName("gpdb");
config.setLegacySupportEnabled(false);
connector = TCPUtil.getConnector(IPluginContainer.INSTANCE,
"127.0.0.1:2036");
config.setConnector(connector);
CDOSession session = config.openSession();
CDOTransaction trans = session.openTransaction();

//the next line crashes
CDOResource stateRes = trans.getOrCreateResource("/patientStates");
</snip>

org.eclipse.net4j.signal.SignalRemoteException:
org.hibernate.DuplicateMappingException: Duplicate class/entity mapping
org.eclipse.emf.cdo.common.model.CDOClassProxy
at
org.eclipse.net4j.signal.RequestWithConfirmation.setExceptio nMessage(RequestWithConfirmation.java:82)
at
org.eclipse.net4j.signal.SignalProtocol.stopSignal(SignalPro tocol.java:321)
at
org.eclipse.net4j.signal.ExceptionMessageIndication.indicati ng(ExceptionMessageIndication.java:37)
at org.eclipse.net4j.signal.Indication.execute(Indication.java: 48)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:186)
at org.eclipse.net4j.signal.Signal.run(Signal.java:167)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
The mapping file I am using is generated by teneo: Generate CDO -
Hibernate OR Mapping (super-class).

Any idea what causes the DuplicateMappingException to be thrown? The
meta.hbm.xml is the only file I found that maps CDOClassProxy.

cheers daniel
Re: CDO-Hibernate setup problems [message #423050 is a reply to message #423049] Mon, 22 September 2008 10:21 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Daniel,
The exception can be caused by two EClasses (in different EPackages) having the same name. Is this
the case with you?

If not can you post the mapping file?

gr. Martin

daniel wrote:
> hi roger,
>
> thanks for your help. I have tried your approach with the
> org.eclipse.emf.cdo.server.app and the xml file and it almost works. Did
> you also re-engineer the attributes of the hibernate store or am I
> missing the main CDO documentation?
>
> My actual server configuration looks like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <cdoServer>
> <acceptor type="tcp" listenAddr="0.0.0.0" port="2036"/>
>
> <repository name="gpdb">
> <property name="overrideUUID"
> value="1ff5d226-b1f0-40fb-aba2-0c31b38c764f"/>
> <property name="supportingAudits" value="false"/>
> <property name="supportingRevisionDeltas" value="false"/>
> <property name="verifyingRevisions" value="false"/>
> <property name="currentLRUCapacity" value="10000"/>
> <property name="revisedLRUCapacity" value="100"/>
> <property name="hibernate.dialect"
> value="org.hibernate.dialect.MySQLInnoDBDialect"/>
> <property name="hibernate.connection.driver_class"
> value="com.mysql.jdbc.Driver"/>
> <property name="hibernate.connection.url"
> value="jdbc:mysql://localhost:3306/gpdb"/>
> <property name="hibernate.connection.username" value="root"/>
> <property name="hibernate.connection.password" value="****"/>
> <store type="hibernate">
> <mappingProvider type="file">
> <mappingFile location="mappings/gapadaba.hbm.xml"/>
> </mappingProvider>
> <dbAdapter name="mysql"/>
> <dataSource class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
> url="jdbc:mysql://localhost/gpdb"
> user="root"
> password="****"/>
> </store>
> </repository>
> </cdoServer>
>
> Then I start a bundle that executes the following code:
> <snip>
> CDOSessionConfiguration config = CDOUtil.createSessionConfiguration();
> config.setRepositoryName("gpdb");
> config.setLegacySupportEnabled(false);
> connector = TCPUtil.getConnector(IPluginContainer.INSTANCE,
> "127.0.0.1:2036");
> config.setConnector(connector);
> CDOSession session = config.openSession();
> CDOTransaction trans = session.openTransaction();
>
> //the next line crashes
> CDOResource stateRes = trans.getOrCreateResource("/patientStates");
> </snip>
>
> org.eclipse.net4j.signal.SignalRemoteException:
> org.hibernate.DuplicateMappingException: Duplicate class/entity mapping
> org.eclipse.emf.cdo.common.model.CDOClassProxy
> at
> org.eclipse.net4j.signal.RequestWithConfirmation.setExceptio nMessage(RequestWithConfirmation.java:82)
>
> at
> org.eclipse.net4j.signal.SignalProtocol.stopSignal(SignalPro tocol.java:321)
> at
> org.eclipse.net4j.signal.ExceptionMessageIndication.indicati ng(ExceptionMessageIndication.java:37)
>
> at org.eclipse.net4j.signal.Indication.execute(Indication.java: 48)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:186)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:167)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:885)
>
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:907)
>
> at java.lang.Thread.run(Thread.java:619)
> The mapping file I am using is generated by teneo: Generate CDO -
> Hibernate OR Mapping (super-class).
> Any idea what causes the DuplicateMappingException to be thrown? The
> meta.hbm.xml is the only file I found that maps CDOClassProxy.
>
> cheers daniel
>


--

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
Re: CDO-Hibernate setup problems [message #423052 is a reply to message #423050] Mon, 22 September 2008 10:44 Go to previous messageGo to next message
daniel kroeni is currently offline daniel kroeniFriend
Messages: 19
Registered: July 2009
Junior Member
hi martin,
my model consists of one package only!

my generated mapping:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping auto-import="false">
<class name="ch.psi.cpt.gpdb.domain.impl.BaseEntityImpl"
entity-name="BaseEntity" abstract="false" lazy="false"
discriminator-value="BaseEntity" table="`baseentity`">
<meta attribute="eclassName">BaseEntity</meta>
<meta attribute="epackage">http://gapadaba.psi.ch/domain/1.0.0</meta>
<tuplizer entity-mode="pojo"
class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
<tuplizer entity-mode="dynamic-map"
class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
<id type="long" name="e_id" column="e_id"
access=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOSy ntheticIdPropertyHandler ">
<meta attribute="syntheticId">true</meta>
<generator class="native"/>
</id>
<discriminator column="`dtype`" type="string"/>
<version name="e_version" column="e_version"
access=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOSy ntheticVersionPropertyHandler ">
<meta attribute="syntheticVersion">true</meta>
</version>
<property name="resourceID"
type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOID UserType ">
<column name="_resID_Entity"/>
<column name="_resID_ID"/>
<column name="_resID_class"/>
</property>
<property name="containerID"
type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOID UserType ">
<column name="_contID_Entity"/>
<column name="_contID_ID"/>
<column name="_contID_class"/>
</property>
<property name="containingFeatureID" column="_contFeatureID" type="int"/>
<property name="id" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.Long">
<column not-null="false" unique="false" name="`id`"/>
</property>
</class>
<subclass name="ch.psi.cpt.gpdb.domain.impl.PersonImpl"
entity-name="Person" abstract="false" lazy="false" extends="BaseEntity"
discriminator-value="Person">
<meta attribute="eclassName">Person</meta>
<meta attribute="epackage">http://gapadaba.psi.ch/domain/1.0.0</meta>
<tuplizer entity-mode="pojo"
class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
<tuplizer entity-mode="dynamic-map"
class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
<property name="firstName" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`firstname`"/>
</property>
<property name="lastName" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`lastname`"/>
</property>
</subclass>
<subclass name="ch.psi.cpt.gpdb.domain.impl.PatientImpl"
entity-name="Patient" abstract="false" lazy="false" extends="Person"
discriminator-value="Patient">
<meta attribute="eclassName">Patient</meta>
<meta attribute="epackage">http://gapadaba.psi.ch/domain/1.0.0</meta>
<tuplizer entity-mode="pojo"
class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
<tuplizer entity-mode="dynamic-map"
class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
<list name="physician" lazy="true" table="`patient_physician`">
<key update="true">
<column name="`patient_e_id`" not-null="true" unique="false"/>
</key>
<list-index column="`patient_physician_idx`"/>
<many-to-many entity-name="Physician" unique="false"
foreign-key="patient_physician">
<column name="`physician_e_id`" not-null="true" unique="false"/>
</many-to-many>
</list>
<many-to-one name="currentState" entity-name="PatientState"
cascade="merge,persist,save-update,lock,refresh" not-null="false"
lazy="false" insert="true" update="true"/>
<property name="diagnosis" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`diagnosis`"/>
</property>
</subclass>
<subclass name="ch.psi.cpt.gpdb.domain.impl.PhysicianImpl"
entity-name="Physician" abstract="false" lazy="false" extends="Person"
discriminator-value="Physician">
<meta attribute="eclassName">Physician</meta>
<meta attribute="epackage">http://gapadaba.psi.ch/domain/1.0.0</meta>
<tuplizer entity-mode="pojo"
class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
<tuplizer entity-mode="dynamic-map"
class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
<list name="patients" lazy="true" table="`physician_patients`">
<key update="true">
<column name="`physician_e_id`" not-null="true" unique="false"/>
</key>
<list-index column="`physician_patients_idx`"/>
<many-to-many entity-name="Patient" unique="false"
foreign-key="physician_patients">
<column name="`patient_e_id`" not-null="true" unique="false"/>
</many-to-many>
</list>
</subclass>
<class name="ch.psi.cpt.gpdb.domain.impl.ProtonTherapyCenterImpl"
entity-name="ProtonTherapyCenter" abstract="false" lazy="false"
discriminator-value="ProtonTherapyCenter" table="`protontherapycenter`">
<meta attribute="eclassName">ProtonTherapyCenter</meta>
<meta attribute="epackage">http://gapadaba.psi.ch/domain/1.0.0</meta>
<tuplizer entity-mode="pojo"
class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
<tuplizer entity-mode="dynamic-map"
class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
<id type="long" name="e_id" column="e_id"
access=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOSy ntheticIdPropertyHandler ">
<meta attribute="syntheticId">true</meta>
<generator class="native"/>
</id>
<discriminator column="`dtype`" type="string"/>
<version name="e_version" column="e_version"
access=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOSy ntheticVersionPropertyHandler ">
<meta attribute="syntheticVersion">true</meta>
</version>
<property name="resourceID"
type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOID UserType ">
<column name="_resID_Entity"/>
<column name="_resID_ID"/>
<column name="_resID_class"/>
</property>
<property name="containerID"
type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOID UserType ">
<column name="_contID_Entity"/>
<column name="_contID_ID"/>
<column name="_contID_class"/>
</property>
<property name="containingFeatureID" column="_contFeatureID" type="int"/>
<list name="physicians" table="`protontherapycenter_physicians`"
lazy="true">
<key update="true">
<column name="`protontherapycenter_e_id`" not-null="true"
unique="false"/>
</key>
<list-index column="`protontherapycenter_physicians_idx`"/>
<many-to-many entity-name="Physician" unique="true"
foreign-key="protontherapycenter_physicians">
<column name="`physician_e_id`" not-null="true" unique="false"/>
</many-to-many>
</list>
<list name="patients" table="`protontherapycenter_patients`" lazy="true">
<key update="true">
<column name="`protontherapycenter_e_id`" not-null="true"
unique="false"/>
</key>
<list-index column="`protontherapycenter_patients_idx`"/>
<many-to-many entity-name="Patient" unique="true"
foreign-key="protontherapycenter_patients">
<column name="`patient_e_id`" not-null="true" unique="false"/>
</many-to-many>
</list>
</class>
<subclass name="ch.psi.cpt.gpdb.domain.impl.PatientStateImpl"
entity-name="PatientState" abstract="false" lazy="false"
extends="BaseEntity" discriminator-value="PatientState">
<meta attribute="eclassName">PatientState</meta>
<meta attribute="epackage">http://gapadaba.psi.ch/domain/1.0.0</meta>
<tuplizer entity-mode="pojo"
class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
<tuplizer entity-mode="dynamic-map"
class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
<property name="name" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`name`"/>
</property>
<one-to-one name="patients" entity-name="Patient"
cascade="merge,persist,save-update,lock,refresh" lazy="false"
property-ref="currentState"/>
</subclass>
</hibernate-mapping>


my small model:

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="domain"
nsURI="http://gapadaba.psi.ch/domain/1.0.0" nsPrefix="">
<eClassifiers xsi:type="ecore:EClass" name="Patient"
eSuperTypes="#//Person">
<eStructuralFeatures xsi:type="ecore:EReference" name="physician"
upperBound="-1"
eType="#//Physician" eOpposite="#//Physician/patients"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="currentState"
eType="#//PatientState"
eOpposite="#//PatientState/patients"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="diagnosis"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Physician"
eSuperTypes="#//Person">
<eStructuralFeatures xsi:type="ecore:EReference" name="patients"
upperBound="-1"
eType="#//Patient" eOpposite="#//Patient/physician"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Person"
eSuperTypes="#//BaseEntity">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="firstName"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="lastName"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="BaseEntity">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ProtonTherapyCenter">
<eStructuralFeatures xsi:type="ecore:EReference" name="physicians"
upperBound="-1"
eType="#//Physician"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="patients"
upperBound="-1"
eType="#//Patient"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="PatientState"
eSuperTypes="#//BaseEntity">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral=""/>
<eStructuralFeatures xsi:type="ecore:EReference" name="patients"
eType="#//Patient"
eOpposite="#//Patient/currentState"/>
</eClassifiers>
</ecore:EPackage>

Thanks for your help!
Daniel
Re: CDO-Hibernate setup problems [message #423055 is a reply to message #423052] Mon, 22 September 2008 11:22 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Sorry Daniel, I should have read your post better, you already mention CDOClassProxy...

Can you see/post the stack trace from the server?

gr. Martin

daniel wrote:
> hi martin,
> my model consists of one package only!
>
> my generated mapping:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
> 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
>
> <hibernate-mapping auto-import="false">
> <class name="ch.psi.cpt.gpdb.domain.impl.BaseEntityImpl"
> entity-name="BaseEntity" abstract="false" lazy="false"
> discriminator-value="BaseEntity" table="`baseentity`">
> <meta attribute="eclassName">BaseEntity</meta>
> <meta
> attribute="epackage">http://gapadaba.psi.ch/domain/1.0.0</meta>
> <tuplizer entity-mode="pojo"
> class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
>
> <tuplizer entity-mode="dynamic-map"
> class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
>
> <id type="long" name="e_id" column="e_id"
> access=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOSy ntheticIdPropertyHandler ">
>
> <meta attribute="syntheticId">true</meta>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOSy ntheticVersionPropertyHandler ">
>
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="resourceID"
> type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOID UserType ">
>
> <column name="_resID_Entity"/>
> <column name="_resID_ID"/>
> <column name="_resID_class"/>
> </property>
> <property name="containerID"
> type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOID UserType ">
>
> <column name="_contID_Entity"/>
> <column name="_contID_ID"/>
> <column name="_contID_class"/>
> </property>
> <property name="containingFeatureID" column="_contFeatureID"
> type="int"/>
> <property name="id" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.Long">
> <column not-null="false" unique="false" name="`id`"/>
> </property>
> </class>
> <subclass name="ch.psi.cpt.gpdb.domain.impl.PersonImpl"
> entity-name="Person" abstract="false" lazy="false" extends="BaseEntity"
> discriminator-value="Person">
> <meta attribute="eclassName">Person</meta>
> <meta
> attribute="epackage">http://gapadaba.psi.ch/domain/1.0.0</meta>
> <tuplizer entity-mode="pojo"
> class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
>
> <tuplizer entity-mode="dynamic-map"
> class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
>
> <property name="firstName" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`firstname`"/>
> </property>
> <property name="lastName" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`lastname`"/>
> </property>
> </subclass>
> <subclass name="ch.psi.cpt.gpdb.domain.impl.PatientImpl"
> entity-name="Patient" abstract="false" lazy="false" extends="Person"
> discriminator-value="Patient">
> <meta attribute="eclassName">Patient</meta>
> <meta
> attribute="epackage">http://gapadaba.psi.ch/domain/1.0.0</meta>
> <tuplizer entity-mode="pojo"
> class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
>
> <tuplizer entity-mode="dynamic-map"
> class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
>
> <list name="physician" lazy="true" table="`patient_physician`">
> <key update="true">
> <column name="`patient_e_id`" not-null="true"
> unique="false"/>
> </key>
> <list-index column="`patient_physician_idx`"/>
> <many-to-many entity-name="Physician" unique="false"
> foreign-key="patient_physician">
> <column name="`physician_e_id`" not-null="true"
> unique="false"/>
> </many-to-many>
> </list>
> <many-to-one name="currentState" entity-name="PatientState"
> cascade="merge,persist,save-update,lock,refresh" not-null="false"
> lazy="false" insert="true" update="true"/>
> <property name="diagnosis" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`diagnosis`"/>
> </property>
> </subclass>
> <subclass name="ch.psi.cpt.gpdb.domain.impl.PhysicianImpl"
> entity-name="Physician" abstract="false" lazy="false" extends="Person"
> discriminator-value="Physician">
> <meta attribute="eclassName">Physician</meta>
> <meta
> attribute="epackage">http://gapadaba.psi.ch/domain/1.0.0</meta>
> <tuplizer entity-mode="pojo"
> class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
>
> <tuplizer entity-mode="dynamic-map"
> class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
>
> <list name="patients" lazy="true" table="`physician_patients`">
> <key update="true">
> <column name="`physician_e_id`" not-null="true"
> unique="false"/>
> </key>
> <list-index column="`physician_patients_idx`"/>
> <many-to-many entity-name="Patient" unique="false"
> foreign-key="physician_patients">
> <column name="`patient_e_id`" not-null="true"
> unique="false"/>
> </many-to-many>
> </list>
> </subclass>
> <class name="ch.psi.cpt.gpdb.domain.impl.ProtonTherapyCenterImpl"
> entity-name="ProtonTherapyCenter" abstract="false" lazy="false"
> discriminator-value="ProtonTherapyCenter" table="`protontherapycenter`">
> <meta attribute="eclassName">ProtonTherapyCenter</meta>
> <meta
> attribute="epackage">http://gapadaba.psi.ch/domain/1.0.0</meta>
> <tuplizer entity-mode="pojo"
> class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
>
> <tuplizer entity-mode="dynamic-map"
> class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
>
> <id type="long" name="e_id" column="e_id"
> access=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOSy ntheticIdPropertyHandler ">
>
> <meta attribute="syntheticId">true</meta>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOSy ntheticVersionPropertyHandler ">
>
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="resourceID"
> type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOID UserType ">
>
> <column name="_resID_Entity"/>
> <column name="_resID_ID"/>
> <column name="_resID_class"/>
> </property>
> <property name="containerID"
> type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOID UserType ">
>
> <column name="_contID_Entity"/>
> <column name="_contID_ID"/>
> <column name="_contID_class"/>
> </property>
> <property name="containingFeatureID" column="_contFeatureID"
> type="int"/>
> <list name="physicians" table="`protontherapycenter_physicians`"
> lazy="true">
> <key update="true">
> <column name="`protontherapycenter_e_id`"
> not-null="true" unique="false"/>
> </key>
> <list-index column="`protontherapycenter_physicians_idx`"/>
> <many-to-many entity-name="Physician" unique="true"
> foreign-key="protontherapycenter_physicians">
> <column name="`physician_e_id`" not-null="true"
> unique="false"/>
> </many-to-many>
> </list>
> <list name="patients" table="`protontherapycenter_patients`"
> lazy="true">
> <key update="true">
> <column name="`protontherapycenter_e_id`"
> not-null="true" unique="false"/>
> </key>
> <list-index column="`protontherapycenter_patients_idx`"/>
> <many-to-many entity-name="Patient" unique="true"
> foreign-key="protontherapycenter_patients">
> <column name="`patient_e_id`" not-null="true"
> unique="false"/>
> </many-to-many>
> </list>
> </class>
> <subclass name="ch.psi.cpt.gpdb.domain.impl.PatientStateImpl"
> entity-name="PatientState" abstract="false" lazy="false"
> extends="BaseEntity" discriminator-value="PatientState">
> <meta attribute="eclassName">PatientState</meta>
> <meta
> attribute="epackage">http://gapadaba.psi.ch/domain/1.0.0</meta>
> <tuplizer entity-mode="pojo"
> class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
>
> <tuplizer entity-mode="dynamic-map"
> class=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDORe visionTuplizer "/>
>
> <property name="name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <one-to-one name="patients" entity-name="Patient"
> cascade="merge,persist,save-update,lock,refresh" lazy="false"
> property-ref="currentState"/>
> </subclass>
> </hibernate-mapping>
>
>
> my small model:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="domain"
> nsURI="http://gapadaba.psi.ch/domain/1.0.0" nsPrefix="">
> <eClassifiers xsi:type="ecore:EClass" name="Patient"
> eSuperTypes="#//Person">
> <eStructuralFeatures xsi:type="ecore:EReference" name="physician"
> upperBound="-1"
> eType="#//Physician" eOpposite="#//Physician/patients"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="currentState"
> eType="#//PatientState"
> eOpposite="#//PatientState/patients"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="diagnosis"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Physician"
> eSuperTypes="#//Person">
> <eStructuralFeatures xsi:type="ecore:EReference" name="patients"
> upperBound="-1"
> eType="#//Patient" eOpposite="#//Patient/physician"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Person"
> eSuperTypes="#//BaseEntity">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="firstName"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="lastName"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="BaseEntity">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
> eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="ProtonTherapyCenter">
> <eStructuralFeatures xsi:type="ecore:EReference" name="physicians"
> upperBound="-1"
> eType="#//Physician"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="patients"
> upperBound="-1"
> eType="#//Patient"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="PatientState"
> eSuperTypes="#//BaseEntity">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
> defaultValueLiteral=""/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="patients"
> eType="#//Patient"
> eOpposite="#//Patient/currentState"/>
> </eClassifiers>
> </ecore:EPackage>
>
> Thanks for your help!
> Daniel
>
>


--

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
Re: CDO-Hibernate setup problems [message #423058 is a reply to message #423055] Mon, 22 September 2008 11:38 Go to previous messageGo to next message
daniel kroeni is currently offline daniel kroeniFriend
Messages: 19
Registered: July 2009
Junior Member
here is the server part of the trace:

[ERROR] Duplicate class/entity mapping
org.eclipse.emf.cdo.common.model.CDOClassProxy
org.hibernate.DuplicateMappingException: Duplicate class/entity mapping
org.eclipse.emf.cdo.common.model.CDOClassProxy
at org.hibernate.cfg.Mappings.addClass(Mappings.java:118)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:145)
at org.hibernate.cfg.Configuration.add(Configuration.java:675)
at org.hibernate.cfg.Configuration.addInputStream(Configuration .java:510)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .initConfiguration(HibernateStore.java:283)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .getHibernateSessionFactory(HibernateStore.java:102)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Accessor.beginHibernateSession(HibernateStoreAccessor.java:1 12)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Accessor.getHibernateSession(HibernateStoreAccessor.java:162 )
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readResourceID(HibernateStoreReader.java:100)
at
org.eclipse.emf.cdo.internal.server.ResourceManager.loadID(R esourceManager.java:92)
at
org.eclipse.emf.cdo.internal.server.ResourceManager.getResou rceID(ResourceManager.java:53)
at
org.eclipse.emf.cdo.internal.server.protocol.ResourceIDIndic ation.indicating(ResourceIDIndication.java:51)
at
org.eclipse.emf.cdo.internal.server.protocol.CDOServerIndica tion.indicating(CDOServerIndication.java:116)
at org.eclipse.net4j.signal.Indication.execute(Indication.java: 48)
at
org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:38)
at
org.eclipse.emf.cdo.internal.server.protocol.CDOReadIndicati on.execute(CDOReadIndication.java:35)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:186)
at org.eclipse.net4j.signal.Signal.run(Signal.java:167)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)

thanks daniel
Re: CDO-Hibernate setup problems [message #423171 is a reply to message #423007] Wed, 24 September 2008 10:37 Go to previous messageGo to next message
daniel kroeni is currently offline daniel kroeniFriend
Messages: 19
Registered: July 2009
Junior Member
Hi Eike,
my issue with the DuplicateMappingException still remains in my original
setup as described in my first post. This is why I switched to CDO from
cvs head. After changing:

### Eclipse Workspace Patch 1.0
#P org.eclipse.net4j.util
Index: src/org/eclipse/net4j/internal/util/om/OSGiBundle.java
============================================================ =======
RCS file:
/cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.net4j/plug ins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/ut il/om/OSGiBundle.java,v
retrieving revision 1.3
diff -u -r1.3 OSGiBundle.java
--- src/org/eclipse/net4j/internal/util/om/OSGiBundle.java 28 Dec 2007
12:54:48 -0000 1.3
+++ src/org/eclipse/net4j/internal/util/om/OSGiBundle.java 24 Sep 2008
10:28:19 -0000
@@ -43,7 +43,7 @@
{
try
{
- URL entry = getBundleContext().getBundle().getEntry(".");
//$NON-NLS-1$
+ URL entry = getBundleContext().getBundle().getEntry("/");
//$NON-NLS-1$
return FileLocator.resolve(entry);
}
catch (IOException ex)

I come a step further but now I get a strange CCE (at the bottom)

Thanks for any help
Cheers Daniel

[ERROR] ch.psi.cpt.gpdb.domain.impl.ProtonTherapyCenterImpl cannot be cast
to org.eclipse.emf.cdo.spi.common.InternalCDORevision
java.lang.ClassCastException:
ch.psi.cpt.gpdb.domain.impl.ProtonTherapyCenterImpl cannot be cast to
org.eclipse.emf.cdo.spi.common.InternalCDORevision
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil. getCDORevision(HibernateUtil.java:176)
at
org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOSy ntheticIdPropertyHandler.get(CDOSyntheticIdPropertyHandler.j ava:63)
at
org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifie rValue(UnsavedValueFactory.java:44)
at
org.hibernate.tuple.PropertyFactory.buildIdentifierProperty( PropertyFactory.java:44)
at
org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:124)
at
org.hibernate.persister.entity.AbstractEntityPersister.<init >(AbstractEntityPersister.java:434)
at
org.hibernate.persister.entity.SingleTableEntityPersister.<init >(SingleTableEntityPersister.java:109)
at
org.hibernate.persister.PersisterFactory.createClassPersiste r(PersisterFactory.java:55)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1300)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .getHibernateSessionFactory(HibernateStore.java:103)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Accessor.beginHibernateSession(HibernateStoreAccessor.java:1 32)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Accessor.getHibernateSession(HibernateStoreAccessor.java:182 )
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readResourceID(HibernateStoreReader.java:106)
at org.eclipse.emf.cdo.internal.server.View.getResourceID(View. java:88)
at
org.eclipse.emf.cdo.internal.server.protocol.ResourceIDIndic ation.indicating(ResourceIDIndication.java:59)
at
org.eclipse.emf.cdo.internal.server.protocol.CDOServerIndica tion.indicating(CDOServerIndication.java:113)
at org.eclipse.net4j.signal.Indication.execute(Indication.java: 48)
at
org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:38)
at
org.eclipse.emf.cdo.internal.server.protocol.CDOReadIndicati on.execute(CDOReadIndication.java:35)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:186)
at org.eclipse.net4j.signal.Signal.run(Signal.java:167)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Re: CDO-Hibernate setup problems [message #423233 is a reply to message #423171] Thu, 25 September 2008 10:43 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Daniel,

Can you please file a Bugzilla for the OSGiBundle.java issue?
And the other exception looks as if you are not generating your model
for CDO. Have you already read
http://wiki.eclipse.org/Preparing_EMF_Models_for_CDO ?

Cheers
/Eike


daniel kroeni schrieb:
> Hi Eike,
> my issue with the DuplicateMappingException still remains in my
> original setup as described in my first post. This is why I switched
> to CDO from cvs head. After changing:
>
> ### Eclipse Workspace Patch 1.0
> #P org.eclipse.net4j.util
> Index: src/org/eclipse/net4j/internal/util/om/OSGiBundle.java
> ============================================================ =======
> RCS file:
> /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.net4j/plug ins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/ut il/om/OSGiBundle.java,v
>
> retrieving revision 1.3
> diff -u -r1.3 OSGiBundle.java
> --- src/org/eclipse/net4j/internal/util/om/OSGiBundle.java 28 Dec
> 2007 12:54:48 -0000 1.3
> +++ src/org/eclipse/net4j/internal/util/om/OSGiBundle.java 24 Sep
> 2008 10:28:19 -0000
> @@ -43,7 +43,7 @@
> {
> try
> {
> - URL entry = getBundleContext().getBundle().getEntry(".");
> //$NON-NLS-1$
> + URL entry = getBundleContext().getBundle().getEntry("/");
> //$NON-NLS-1$
> return FileLocator.resolve(entry);
> }
> catch (IOException ex)
>
> I come a step further but now I get a strange CCE (at the bottom)
>
> Thanks for any help
> Cheers Daniel
>
> [ERROR] ch.psi.cpt.gpdb.domain.impl.ProtonTherapyCenterImpl cannot be
> cast to org.eclipse.emf.cdo.spi.common.InternalCDORevision
> java.lang.ClassCastException:
> ch.psi.cpt.gpdb.domain.impl.ProtonTherapyCenterImpl cannot be cast to
> org.eclipse.emf.cdo.spi.common.InternalCDORevision
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil. getCDORevision(HibernateUtil.java:176)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOSy ntheticIdPropertyHandler.get(CDOSyntheticIdPropertyHandler.j ava:63)
>
> at
> org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifie rValue(UnsavedValueFactory.java:44)
>
> at
> org.hibernate.tuple.PropertyFactory.buildIdentifierProperty( PropertyFactory.java:44)
>
> at
> org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:124)
>
> at
> org.hibernate.persister.entity.AbstractEntityPersister.<init >(AbstractEntityPersister.java:434)
>
> at
> org.hibernate.persister.entity.SingleTableEntityPersister.<init >(SingleTableEntityPersister.java:109)
>
> at
> org.hibernate.persister.PersisterFactory.createClassPersiste r(PersisterFactory.java:55)
>
> at
> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1300)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .getHibernateSessionFactory(HibernateStore.java:103)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Accessor.beginHibernateSession(HibernateStoreAccessor.java:1 32)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Accessor.getHibernateSession(HibernateStoreAccessor.java:182 )
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readResourceID(HibernateStoreReader.java:106)
>
> at
> org.eclipse.emf.cdo.internal.server.View.getResourceID(View. java:88)
> at
> org.eclipse.emf.cdo.internal.server.protocol.ResourceIDIndic ation.indicating(ResourceIDIndication.java:59)
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CDOServerIndica tion.indicating(CDOServerIndication.java:113)
>
> at org.eclipse.net4j.signal.Indication.execute(Indication.java: 48)
> at
> org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:38)
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CDOReadIndicati on.execute(CDOReadIndication.java:35)
>
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:186)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:167)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:885)
>
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:907)
>
> at java.lang.Thread.run(Thread.java:619)
>


Re: CDO-Hibernate setup problems [message #423247 is a reply to message #423233] Thu, 25 September 2008 13:34 Go to previous messageGo to next message
daniel kroeni is currently offline daniel kroeniFriend
Messages: 19
Registered: July 2009
Junior Member
Hi Eike,

Eike Stepper wrote:

> Hi Daniel,

> Can you please file a Bugzilla for the OSGiBundle.java issue?

I digged deeper and found that the patch is not necessary if the
mappingFile location starts with a '/'

<store type="hibernate">
<mappingProvider type="file">
<mappingFile location="/mappings/gapadaba.hbm.xml"/>
</mappingProvider>
..
</store>

but to enable
org.eclipse.emf.cdo.server.internal.hibernate.FileHibernateM appingProvider
to find my mapping file, I had to add the following buddy policy to the
manifest of the bundle: org.eclipse.emf.cdo.server.hibernate

Eclipse-BuddyPolicy: dependent

Shall I add a Bugzilla for this one?


> And the other exception looks as if you are not generating your model
> for CDO. Have you already read
> http://wiki.eclipse.org/Preparing_EMF_Models_for_CDO ?

Sure I did! The server runs without problems if I use:

<store type="db">
<mappingStrategy type="horizontal">
<property name="qualifiedNames" value="false"/>
<property name="toManyReferences" value="ONE_TABLE_PER_REFERENCE"/>
<property name="toOneReferences" value="LIKE_ATTRIBUTES"/>
</mappingStrategy>

<dbAdapter name="derby-embedded"/>
<dataSource class="org.apache.derby.jdbc.EmbeddedDataSource"
databaseName="/home/dk/derby"
createDatabase="create"/>
</store>

instead of

<store type="hibernate">
<mappingProvider type="file">
<mappingFile location="/mappings/gapadaba.hbm.xml"/>
</mappingProvider>

<dbAdapter name="mysql"/>
<dataSource class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
url="jdbc:mysql://localhost/gpdb"
user="root"
password="****"/>
</store>

> Cheers
> /Eike


Cheers Daniel
Re: CDO-Hibernate setup problems [message #423252 is a reply to message #423247] Thu, 25 September 2008 14:19 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
daniel kroeni schrieb:
> I digged deeper and found that the patch is not necessary if the
> mappingFile location starts with a '/'
>
> <store type="hibernate">
> <mappingProvider type="file">
> <mappingFile location="/mappings/gapadaba.hbm.xml"/>
> </mappingProvider>
> ..
> </store>
>
> but to enable
> org.eclipse.emf.cdo.server.internal.hibernate.FileHibernateM appingProvider
> to find my mapping file, I had to add the following buddy policy to
> the manifest of the bundle: org.eclipse.emf.cdo.server.hibernate
>
> Eclipse-BuddyPolicy: dependent
>
> Shall I add a Bugzilla for this one?
Yes, then we can discuss it with Martin.
I could also imagine of an Eclipse-BuddyPolicy: registered...

>
>
>> And the other exception looks as if you are not generating your model
>> for CDO. Have you already read
>> http://wiki.eclipse.org/Preparing_EMF_Models_for_CDO ?
>
> Sure I did! The server runs without problems if I use:
Hmm, then it looks like a problem in the HibernateStore.
Can you please also add a Bugzilla to track this?

Cheers
/Eike


Previous Topic:EOperation at runtime
Next Topic:Map values as children
Goto Forum:
  


Current Time: Thu Mar 28 18:08:40 GMT 2024

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

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

Back to the top