Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Import XMI files into database
Import XMI files into database [message #669253] Mon, 09 May 2011 15:22
Ricky de Klerck is currently offline Ricky de KlerckFriend
Messages: 295
Registered: January 2011
Senior Member
Hi,

We've build an application with an EMF model and we store our data in XMI files. We've generated all tables in a Oracle 10G XE database. Now we want to import all data from the XMI files into this database but we ran into some problems.

We import the file with this code:

HibernateResource resource = new HibernateResource(URI.createURI("hibernate://?dsname=TeneoSmartErp"));
resource.load(null);


ResourceSet rset = new ResourceSetImpl();

rset.createResource(URI.createFileURI("PATH_TO_FILE"));
rset.createResource(URI.createFileURI("PATH_TO_FILE"));

try {
	for(Resource res : rset.getResources()) {
		res.load(null);								}

		resource.getContents().addAll(res.getContents());

	}

	resource.save(null);
}
catch(Exception e) {
	e.printStackTrace();
	throw new RuntimeException(e);
}


This works well if none of the objects has any reference to another object. If there are references we get the following error:

The feature 'REFERENCE_OBJECT' of '.......Impl@3a7f1228{hibernate://?dsname=DATASTORENAME#OBJECT|id=838}' contains an unresolved proxy '.......Impl@43540a77{REFERENCE_FILE#287}'


Hope someone can help me. Thanks in advance!
Previous Topic:[CDO] adding and removing CDOResource from ResourceSet
Next Topic:Re: [Teneo] Unable to use addEntity with Teneo generated code
Goto Forum:
  


Current Time: Fri Apr 19 20:41:12 GMT 2024

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

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

Back to the top