Hi there (Hi Martin ),
as i have a large containment feature, i want to try the extra lazy loading property. So, first I set the property
props.setProperty(PersistenceOptions.FETCH_ASSOCIATION_EXTRA_LAZY, "true");
When i try to import data into the DB, i get the following exception:
org.hibernate.MappingException: Duplicate property mapping of GuideStylehorizontalGuides found in Guide
at org.hibernate.mapping.PersistentClass.checkPropertyDuplication(PersistentClass.java:477)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:467)
at org.hibernate.mapping.RootClass.validate(RootClass.java:215)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1149)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1334)
at org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSessionFactory(HbSessionDataStore.java:205)
at org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initialize(HbSessionDataStore.java:90)
at brms.helper.StoreController.initializeDataStore(StoreController.java:109)
at brms.helper.ImportFile2DB.convert(ImportFile2DB.java:47)
at brm_s.StartUp.main(StartUp.java:46)
The GuideStylehorizontalGuides seems to be a GMF class so i have no real influence on that one. Therefore i tried to annotate just the containment feature which i would actually need the lazy loading feature for with the corresponding attribute (@OneToMany(fetch=EXTRA) ), regenerated the model code and then retried importing my data into the database. However, then i get the following exception:
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: SyntacticElement
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:242)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:430)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:265)
at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:619)
at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:3141)
at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:501)
at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:227)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:150)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:49)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
at org.eclipse.emf.teneo.hibernate.HbSessionWrapper.flush(HbSessionWrapper.java:171)
at org.eclipse.emf.teneo.hibernate.resource.HibernateResource.saveResource(HibernateResource.java:373)
at org.eclipse.emf.teneo.resource.StoreResource.save(StoreResource.java:405)
at brms.helper.ModelUtils.saveDBResource(ModelUtils.java:235)
at brm_s.StartUp.main(StartUp.java:54)
So I know that this element is not yet saved within the database, as i want to save the complete result at the end of the process. Which options do I have, to solve this problem? The SyntacticElement is one of the types that is part of this containment feature.
Thanks in advance!
Wolf