[TENEO] Issues when loading models from an already existing Teneo database or deleting them [message #609861] |
Mon, 01 October 2007 11:48 |
Eclipse User |
|
|
|
Hi,
I'm using Teneo in order to provide a database-based implementation of
the AM3 model repository generic interface (see
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.gmt/AM3 /plugins/org.eclipse.gmt.am3.core/src/org/eclipse/gmt/am3/co re/storage/?root=Technology_Project).
I don't (or at least I don't seem to) have problems when adding,
retrieving or deleting metamodels (i.e. EPackages) into/from the repository.
However, I'm facing some issues when trying to do the same thing with
terminal models conforming to loaded metamodels (i.e. EObjects which are
instances of EClasses contained in previously loaded EPackages). For
both issues, I have already checked that the models stored into the EMF
resources are correct.
1) When calling
" this.getHibernateDataStoreSession().delete(res.getContents() .get(0)); "
with "res" the EMF resource storing the terminal model, the following
exception is raised:
org.eclipse.gmt.am3.core.storage.RepositoryException:
org.hibernate.NonUniqueObjectException: a different object with the same
identifier value was already associated with the session: [Deb#2]
at
org.eclipse.gmt.am3.repository.teneo.TeneoRepository.removeM odel(TeneoRepository.java:487)
at
org.eclipse.gmt.am3.repository.teneo.testrepository.main(tes trepository.java:178)
Caused by: org.hibernate.NonUniqueObjectException: a different object
with the same identifier value was already associated with the session:
[Deb#2]
at
org.hibernate.engine.StatefulPersistenceContext.checkUniquen ess(StatefulPersistenceContext.java:556)
at
org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:88)
at
org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:49)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 66)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
at
org.eclipse.emf.teneo.hibernate.HbSessionWrapper.delete(HbSe ssionWrapper.java:156)
As a consequence, the EObjects composing the model are still stored into
the database. Maybe this issue is one of the causes of the next problem
but I'm not sure of that!
2) When working on a database which has been previously created (by
another session) and trying to add a new terminal model (which conforms
to an already stored metamodel), from
" this.getHibernateDataStoreSession().saveOrUpdate(res.getCont ents().get(0)); "
I got:
org.eclipse.gmt.am3.core.storage.RepositoryException:
java.lang.IllegalArgumentException: No annotated model element present
for: Deb for type EClass has its epackage been registered with Teneo?
at
org.eclipse.gmt.am3.repository.teneo.TeneoRepository.addMode l(TeneoRepository.java:413)
at
org.eclipse.gmt.am3.repository.teneo.TeneoRepository.updateM odel(TeneoRepository.java:439)
at
org.eclipse.gmt.am3.repository.teneo.TeneoRepository.updateM odel(TeneoRepository.java:464)
at
org.eclipse.gmt.am3.repository.teneo.testrepository.main(tes trepository.java:127)
Caused by: java.lang.IllegalArgumentException: No annotated model
element present for: Deb for type EClass has its epackage been
registered with Teneo?
at
org.eclipse.emf.teneo.annotations.pamodel.impl.PAnnotatedMod elImpl.checkAnnotatedPresent(PAnnotatedModelImpl.java:337)
at
org.eclipse.emf.teneo.annotations.pamodel.impl.PAnnotatedMod elImpl.getPAnnotated(PAnnotatedModelImpl.java:279)
at
org.eclipse.emf.teneo.mapping.strategy.impl.EntityResolvingN ameStrategy.toEntityName(EntityResolvingNameStrategy.java:84 )
at
org.eclipse.emf.teneo.hibernate.EMFInterceptor.getEntityName (EMFInterceptor.java:75)
at org.hibernate.impl.SessionImpl.guessEntityName(SessionImpl.j ava:1765)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImp l.java:1338)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.jav a:180)
at
org.hibernate.event.def.AbstractSaveEventListener.getEntityS tate(AbstractSaveEventListener.java:487)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.per formSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:84)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onS aveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl. java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java :499)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java :495)
at
org.eclipse.emf.teneo.hibernate.HbSessionWrapper.saveOrUpdat e(HbSessionWrapper.java:151)
What is strange is that I'm succeeding in retrieving the corresponding
metamodel (i.e. EPackages)...
Does anybody have ideas about where do these problems come from and how
to solve them?
Best regards,
Hugo
--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
|
|
|
Powered by
FUDForum. Page generated in 0.06444 seconds