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!