[270298]
diff --git a/plugins/org.eclipse.emf.teneo.hibernate/src/org/eclipse/emf/teneo/hibernate/HbDataStore.java b/plugins/org.eclipse.emf.teneo.hibernate/src/org/eclipse/emf/teneo/hibernate/HbDataStore.java
index feef501..97e5ef1 100644
--- a/plugins/org.eclipse.emf.teneo.hibernate/src/org/eclipse/emf/teneo/hibernate/HbDataStore.java
+++ b/plugins/org.eclipse.emf.teneo.hibernate/src/org/eclipse/emf/teneo/hibernate/HbDataStore.java
@@ -77,11 +77,10 @@
 import org.hibernate.mapping.Value;
 
 /**
- * Common base class for the standard hb datastore and the entity manager
- * oriented datastore.
+ * Common base class for the standard hb datastore and the entity manager oriented datastore.
  * 
  * @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
- * @version $Revision: 1.48 $
+ * @version $Revision: 1.49 $
  */
 public abstract class HbDataStore implements DataStore {
 
@@ -96,18 +95,12 @@
 	/** Initializes emf types with jpox */
 	private static synchronized void initializeTypes() {
 		log.debug("Initializing protocol/extension for hibernate");
-		Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put(
-				"hibernate", new HibernateResourceFactory());
-		Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put("ehb",
-				new HibernateResourceFactory());
-		Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put(
-				"hbxml", new HibernateXMLResourceFactory());
-		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
-				"hibernate", new HibernateResourceFactory());
-		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
-				"ehb", new HibernateResourceFactory());
-		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
-				"hbxml", new HibernateXMLResourceFactory());
+		Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put("hibernate", new HibernateResourceFactory());
+		Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put("ehb", new HibernateResourceFactory());
+		Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put("hbxml", new HibernateXMLResourceFactory());
+		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("hibernate", new HibernateResourceFactory());
+		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ehb", new HibernateResourceFactory());
+		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("hbxml", new HibernateXMLResourceFactory());
 	}
 
 	/** HashMap with referers */
@@ -142,8 +135,7 @@
 	private Interceptor interceptor;
 
 	/**
-	 * The used mapping if not passed through a hbm file, can be retrieved for
-	 * debugging purposes
+	 * The used mapping if not passed through a hbm file, can be retrieved for debugging purposes
 	 */
 	private String mappingXML = null;
 
@@ -165,8 +157,7 @@
 	 */
 	public EPackage[] getEPackages() {
 		if (ePackages == null && ePackageConstructor != null) {
-			final java.util.List<EPackage> ePacks = ePackageConstructor
-					.getEPackages();
+			final java.util.List<EPackage> ePacks = ePackageConstructor.getEPackages();
 			final EPackage[] ePacksArray = new EPackage[ePacks.size()];
 			int i = 0;
 			for (EPackage ePack : ePacks) {
@@ -249,7 +240,7 @@
 
 		if (getPersistenceOptions().isUpdateSchema()) {
 			log
-					.warn("The teneo update schema option is not used anymore for hibernate, use the hibernate option: hibernate.hbm2ddl.auto");
+				.warn("The teneo update schema option is not used anymore for hibernate, use the hibernate option: hibernate.hbm2ddl.auto");
 		}
 
 		log.debug("Registering datastore with persistent classes");
@@ -270,14 +261,13 @@
 	protected abstract Configuration getHibernateConfiguration();
 
 	/**
-	 * Gets the persistence options. The persistence options is a type
-	 * representation of the persistence options. If not set through the
-	 * setPersistenceProperties method then a properties file is searched If
-	 * found it is used to set the persistence options.
+	 * Gets the persistence options. The persistence options is a type representation of the
+	 * persistence options. If not set through the setPersistenceProperties method then a properties
+	 * file is searched If found it is used to set the persistence options.
 	 * <p>
-	 * If no properties have been set explicitly, the method will attempt to
-	 * load them from the file "/elver-persistence.properties" at the root of
-	 * the classpath. (A mechanism similar to "hibernate.properties".)
+	 * If no properties have been set explicitly, the method will attempt to load them from the file
+	 * "/elver-persistence.properties" at the root of the classpath. (A mechanism similar to
+	 * "hibernate.properties".)
 	 * 
 	 * @throws HbMapperException
 	 *             if an error occured reading the properties file.
@@ -286,8 +276,7 @@
 	public PersistenceOptions getPersistenceOptions() {
 		if (persistenceOptions == null) {
 			final Properties props = new Properties();
-			final InputStream in = this.getClass().getResourceAsStream(
-					PersistenceOptions.DEFAULT_CLASSPATH_FILENAME);
+			final InputStream in = this.getClass().getResourceAsStream(PersistenceOptions.DEFAULT_CLASSPATH_FILENAME);
 			if (in != null) {
 				try {
 					props.load(in);
@@ -301,8 +290,7 @@
 					}
 				}
 			}
-			persistenceOptions = getExtensionManager().getExtension(
-					PersistenceOptions.class, new Object[] { props });
+			persistenceOptions = getExtensionManager().getExtension(PersistenceOptions.class, new Object[] { props });
 		}
 		return persistenceOptions;
 	}
@@ -314,8 +302,8 @@
 	 */
 	@Deprecated
 	public void setPersistenceProperties(Properties persistenceOptions) {
-		this.persistenceOptions = getExtensionManager().getExtension(
-				PersistenceOptions.class, new Object[] { persistenceOptions });
+		this.persistenceOptions =
+				getExtensionManager().getExtension(PersistenceOptions.class, new Object[] { persistenceOptions });
 	}
 
 	/**
@@ -344,25 +332,19 @@
 
 	/** Sets both the persistence as well as the hibernate properties */
 	public void setProperties(Properties props) {
-		this.persistenceOptions = getExtensionManager().getExtension(
-				PersistenceOptions.class, new Object[] { props });
+		this.persistenceOptions = getExtensionManager().getExtension(PersistenceOptions.class, new Object[] { props });
 		this.properties = props;
 	}
 
 	protected void setDefaultProperties(Properties properties) {
 		if (properties.getProperty("hibernate.cache.provider_class") == null) {
-			log.warn("No hibernate cache provider set, using "
-					+ HashtableCacheProvider.class.getName());
-			log
-					.warn("For production use please set the ehcache (or other) provider explicitly and configure it");
-			properties.setProperty("hibernate.cache.provider_class",
-					HashtableCacheProvider.class.getName());
+			log.warn("No hibernate cache provider set, using " + HashtableCacheProvider.class.getName());
+			log.warn("For production use please set the ehcache (or other) provider explicitly and configure it");
+			properties.setProperty("hibernate.cache.provider_class", HashtableCacheProvider.class.getName());
 		}
-		final String hbmUpdate = properties
-				.getProperty(Environment.HBM2DDL_AUTO);
+		final String hbmUpdate = properties.getProperty(Environment.HBM2DDL_AUTO);
 		if (hbmUpdate == null) {
-			log.info("Hibernate property: " + Environment.HBM2DDL_AUTO
-					+ " not set, setting to update");
+			log.info("Hibernate property: " + Environment.HBM2DDL_AUTO + " not set, setting to update");
 			properties.setProperty(Environment.HBM2DDL_AUTO, "update");
 		}
 		log.debug("Setting properties in Hibernate Configuration:");
@@ -409,58 +391,48 @@
 	public abstract Iterator<?> getClassMappings();
 
 	/**
-	 * Returns an array of EObjects and FeatureMapEntries which refer to a
-	 * certain EObject, note if the array is of length zero then no refering
-	 * EObjects where found. The passed Session is used to create a query. The
-	 * transaction handling should be done by the caller.
+	 * Returns an array of EObjects and FeatureMapEntries which refer to a certain EObject, note if
+	 * the array is of length zero then no refering EObjects where found. The passed Session is used
+	 * to create a query. The transaction handling should be done by the caller.
 	 */
 	public Object[] getCrossReferencers(Session session, Object referedTo) {
-		final ArrayList<Object> result = getCrossReferencers(
-				new HbSessionWrapper(this, session), referedTo, false);
+		final ArrayList<Object> result = getCrossReferencers(new HbSessionWrapper(this, session), referedTo, false);
 
 		return result.toArray(new Object[result.size()]);
 	}
 
 	/**
-	 * Returns an array of EObjects and FeatureMapEntries which refer to a
-	 * certain EObject, note if the array is of length zero then no refering
-	 * EObjects where found. The passed Session is used to create a query. The
-	 * transaction handling should be done by the caller.
+	 * Returns an array of EObjects and FeatureMapEntries which refer to a certain EObject, note if
+	 * the array is of length zero then no refering EObjects where found. The passed Session is used
+	 * to create a query. The transaction handling should be done by the caller.
 	 */
-	public Object[] getCrossReferencers(SessionWrapper sessionWrapper,
-			Object referedTo) {
-		final ArrayList<Object> result = getCrossReferencers(sessionWrapper,
-				referedTo, false);
+	public Object[] getCrossReferencers(SessionWrapper sessionWrapper, Object referedTo) {
+		final ArrayList<Object> result = getCrossReferencers(sessionWrapper, referedTo, false);
 		return result.toArray(new Object[result.size()]);
 	}
 
 	/**
-	 * Returns an array of EObjects which refer to a certain EObject, note if
-	 * the array is of length zero then no refering EObjects where found. The
-	 * passed Session is used to create a query. The transaction handling should
-	 * be done by the caller. onlyContainers means to only check containment
-	 * relations.
+	 * Returns an array of EObjects which refer to a certain EObject, note if the array is of length
+	 * zero then no refering EObjects where found. The passed Session is used to create a query. The
+	 * transaction handling should be done by the caller. onlyContainers means to only check
+	 * containment relations.
 	 */
-	private ArrayList<Object> getCrossReferencers(
-			SessionWrapper sessionWrapper, Object referedTo,
+	private ArrayList<Object> getCrossReferencers(SessionWrapper sessionWrapper, Object referedTo,
 			boolean onlyContainers) {
 		assert (referedTo != null);
 
 		String targetEntityName = null;
 		if (referedTo instanceof EObject) {
 			final EObject eReferedTo = (EObject) referedTo;
-			targetEntityName = getEntityNameStrategy().toEntityName(
-					eReferedTo.eClass());
+			targetEntityName = getEntityNameStrategy().toEntityName(eReferedTo.eClass());
 		} else if (referedTo instanceof HibernateFeatureMapEntry) {
 			final HibernateFeatureMapEntry fme = (HibernateFeatureMapEntry) referedTo;
 			targetEntityName = fme.getEntityName();
 		} else {
-			throw new IllegalArgumentException("Non eobject not yet supported "
-					+ referedTo.getClass().getName());
+			throw new IllegalArgumentException("Non eobject not yet supported " + referedTo.getClass().getName());
 		}
 
-		final java.util.List<ReferenceTo> refersList = referers
-				.get(targetEntityName);
+		final java.util.List<ReferenceTo> refersList = referers.get(targetEntityName);
 		if (refersList == null || refersList.size() == 0) {
 			return new ArrayList<Object>();
 		}
@@ -473,18 +445,14 @@
 				continue;
 			}
 
-			final java.util.List<?> list = sessionWrapper.executeQuery(refersTo
-					.getQueryStr(), "to", referedTo);
+			final java.util.List<?> list = sessionWrapper.executeQuery(refersTo.getQueryStr(), "to", referedTo);
 			for (Object obj : list) {
 				if (obj instanceof HibernateFeatureMapEntry) {
 					// search then again with the
-					final ArrayList<Object> fms = getCrossReferencers(
-							sessionWrapper, obj, false);
+					final ArrayList<Object> fms = getCrossReferencers(sessionWrapper, obj, false);
 					if (fms.size() == 0) {
-						new AssertionError(
-								"The featuremap for featuremap entry "
-										+ obj.getClass().getName()
-										+ " can not be found");
+						new AssertionError("The featuremap for featuremap entry " + obj.getClass().getName() +
+								" can not be found");
 					}
 					obj = fms.get(0);
 				}
@@ -560,18 +528,15 @@
 			final PersistentClass pc = (PersistentClass) pcs.next();
 			if (pc.getMetaAttribute(HbMapperConstants.FEATUREMAP_META) != null) { // featuremap
 				// entry
-				pc.addTuplizer(EntityMode.MAP,
-						getHbContext().getFeatureMapEntryTuplizer(
-								getHibernateConfiguration()).getName());
+				pc.addTuplizer(EntityMode.MAP, getHbContext().getFeatureMapEntryTuplizer(getHibernateConfiguration())
+					.getName());
 			} else if (pc.getMetaAttribute(HbMapperConstants.ECLASS_NAME_META) != null) {
 				// only the pc's with this meta should get a tuplizer
 
-				pc.addTuplizer(EntityMode.MAP, getHbContext()
-						.getEMFTuplizerClass(getHibernateConfiguration())
-						.getName());
-				pc.addTuplizer(EntityMode.POJO, getHbContext()
-						.getEMFTuplizerClass(getHibernateConfiguration())
-						.getName());
+				pc.addTuplizer(EntityMode.MAP, getHbContext().getEMFTuplizerClass(getHibernateConfiguration())
+					.getName());
+				pc.addTuplizer(EntityMode.POJO, getHbContext().getEMFTuplizerClass(getHibernateConfiguration())
+					.getName());
 			} else if (pc.getMetaAttribute(HbMapperConstants.ECLASS_NAME_META) == null) {
 				// don't change these pc's any further, these are not eclasses
 				continue;
@@ -598,12 +563,9 @@
 				}
 				final Value value = prop.getValue();
 				if (value instanceof Component) {
-					setComponentTuplizer((Component) value,
-							getHibernateConfiguration());
-				} else if (value instanceof Collection
-						&& ((Collection) value).getElement() instanceof Component) {
-					setComponentTuplizer((Component) ((Collection) value)
-							.getElement(), getHibernateConfiguration());
+					setComponentTuplizer((Component) value, getHibernateConfiguration());
+				} else if (value instanceof Collection && ((Collection) value).getElement() instanceof Component) {
+					setComponentTuplizer((Component) ((Collection) value).getElement(), getHibernateConfiguration());
 				}
 			}
 		}
@@ -614,14 +576,12 @@
 	}
 
 	/**
-	 * Sets the emf component tuplizer (if it is an eclass) or the hibernate
-	 * component tuplizer
+	 * Sets the emf component tuplizer (if it is an eclass) or the hibernate component tuplizer
 	 */
 	protected void setComponentTuplizer(Component component, Configuration cfg) {
 		// check if the eclass exists
 		// todo: change recognizing a component to using metadata!
-		final EClass eClass = getEntityNameStrategy().toEClass(
-				component.getComponentClassName());
+		final EClass eClass = getEntityNameStrategy().toEClass(component.getComponentClassName());
 		if (eClass != null) {
 			log.debug("Found " + eClass.getName() + " as a component");
 		} else {
@@ -630,10 +590,8 @@
 		// is a
 		// valid
 		// eclass
-		component.addTuplizer(EntityMode.MAP, getHbContext()
-				.getEMFComponentTuplizerClass(cfg).getName());
-		component.addTuplizer(EntityMode.POJO, getHbContext()
-				.getEMFComponentTuplizerClass(cfg).getName());
+		component.addTuplizer(EntityMode.MAP, getHbContext().getEMFComponentTuplizerClass(cfg).getName());
+		component.addTuplizer(EntityMode.POJO, getHbContext().getEMFComponentTuplizerClass(cfg).getName());
 		HbHelper.INSTANCE.registerDataStoreByComponent(this, component);
 	}
 
@@ -673,11 +631,9 @@
 		// allows use of
 		// Hibernate-specific annotations.
 		final PersistenceOptions po = getPersistenceOptions();
-		setPaModel(getExtensionManager().getExtension(
-				PersistenceMappingBuilder.class).buildMapping(getEPackages(),
-				po, getExtensionManager()));
-		final HibernateMappingGenerator hmg = getExtensionManager()
-				.getExtension(HibernateMappingGenerator.class);
+		setPaModel(getExtensionManager().getExtension(PersistenceMappingBuilder.class).buildMapping(getEPackages(), po,
+			getExtensionManager()));
+		final HibernateMappingGenerator hmg = getExtensionManager().getExtension(HibernateMappingGenerator.class);
 		hmg.setPersistenceOptions(po);
 		return hmg.generateToString(getPaModel());
 	}
@@ -713,9 +669,8 @@
 	// log.debug(">>> Update of schema finished");
 	// }
 	/**
-	 * Adds a econtainer mapping to the class mapping, is only called for
-	 * eclasses which do not have am explicit feature which points to the
-	 * container
+	 * Adds a econtainer mapping to the class mapping, is only called for eclasses which do not have
+	 * am explicit feature which points to the container
 	 */
 	protected void addContainerMapping(PersistentClass pc) {
 
@@ -748,24 +703,21 @@
 		// for which this was put together (i.e., the generated model editing
 		// code tries to eagerly resolve the
 		// container)
-		if (eclass == null
-				|| eclass
-						.getEAnnotation("http://facet.elver.org/SkipContainerMappings") != null) {
+		if (eclass == null || eclass.getEAnnotation("http://facet.elver.org/SkipContainerMappings") != null) {
 			return; // featuremap
 		}
 
 		for (EReference eref : eclass.getEAllReferences()) {
 			if (eref.isContainer()) {
 				log
-						.debug("There are container ereferences present, assuming that no separate econtainer columns are required.");
+					.debug("There are container ereferences present, assuming that no separate econtainer columns are required.");
 				return;
 			}
 		}
 
-		log.debug("Adding eContainer and econtainerfeatureid properties to "
-				+ pc.getClassName());
-		final EContainerFeaturePersistenceStrategy featurePersistenceStrategy = getPersistenceOptions()
-				.getEContainerFeaturePersistenceStrategy();
+		log.debug("Adding eContainer and econtainerfeatureid properties to " + pc.getClassName());
+		final EContainerFeaturePersistenceStrategy featurePersistenceStrategy =
+				getPersistenceOptions().getEContainerFeaturePersistenceStrategy();
 
 		final Property eContainer = new Property();
 		eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
@@ -776,51 +728,48 @@
 		final SimpleValue sv = new SimpleValue(pc.getTable());
 		sv.setTypeName(EContainerUserType.class.getName());
 
-		final Column eccColumn = new Column(HbConstants.COLUMN_ECONTAINER_CLASS);
+		final Column eccColumn =
+				new Column(getPersistenceOptions().getSQLColumnNamePrefix() + HbConstants.COLUMN_ECONTAINER_CLASS);
 		sv.addColumn(checkColumnExists(pc.getTable(), eccColumn));
 
-		final Column ecColumn = new Column(HbConstants.COLUMN_ECONTAINER);
+		final Column ecColumn =
+				new Column(getPersistenceOptions().getSQLColumnNamePrefix() + HbConstants.COLUMN_ECONTAINER);
 		sv.addColumn(checkColumnExists(pc.getTable(), ecColumn));
 
 		eContainer.setValue(sv);
 		pc.addProperty(eContainer);
 
-		if (featurePersistenceStrategy
-				.equals(EContainerFeaturePersistenceStrategy.FEATUREID)
-				|| featurePersistenceStrategy
-						.equals(EContainerFeaturePersistenceStrategy.BOTH)) {
+		if (featurePersistenceStrategy.equals(EContainerFeaturePersistenceStrategy.FEATUREID) ||
+				featurePersistenceStrategy.equals(EContainerFeaturePersistenceStrategy.BOTH)) {
 			final Property ecFID = new Property();
 			ecFID.setName(HbConstants.PROPERTY_ECONTAINER_FEATURE_ID);
 			ecFID.setMetaAttributes(new HashMap<Object, Object>());
 			ecFID.setNodeName(ecFID.getName());
-			ecFID.setPropertyAccessorName(EContainerFeatureIDAccessor.class
-					.getName());
+			ecFID.setPropertyAccessorName(EContainerFeatureIDAccessor.class.getName());
 			final SimpleValue svfid = new SimpleValue(pc.getTable());
 			svfid.setTypeName("integer");
 
-			final Column ecfColumn = new Column(
-					HbConstants.COLUMN_ECONTAINER_FEATUREID);
+			final Column ecfColumn =
+					new Column(getPersistenceOptions().getSQLColumnNamePrefix() +
+							HbConstants.COLUMN_ECONTAINER_FEATUREID);
 			svfid.addColumn(checkColumnExists(pc.getTable(), ecfColumn));
 
 			ecFID.setValue(svfid);
 			pc.addProperty(ecFID);
 		}
-		if (featurePersistenceStrategy
-				.equals(EContainerFeaturePersistenceStrategy.FEATURENAME)
-				|| featurePersistenceStrategy
-						.equals(EContainerFeaturePersistenceStrategy.BOTH)) {
+		if (featurePersistenceStrategy.equals(EContainerFeaturePersistenceStrategy.FEATURENAME) ||
+				featurePersistenceStrategy.equals(EContainerFeaturePersistenceStrategy.BOTH)) {
 			final Property ecFID = new Property();
 			ecFID.setName(HbConstants.PROPERTY_ECONTAINER_FEATURE_NAME);
 			ecFID.setMetaAttributes(new HashMap<Object, Object>());
 			ecFID.setNodeName(ecFID.getName());
-			ecFID
-					.setPropertyAccessorName(NewEContainerFeatureIDPropertyHandler.class
-							.getName());
+			ecFID.setPropertyAccessorName(NewEContainerFeatureIDPropertyHandler.class.getName());
 			final SimpleValue svfid = new SimpleValue(pc.getTable());
 			svfid.setTypeName(EContainerFeatureIDUserType.class.getName());
 
-			final Column ecfColumn = new Column(
-					HbConstants.COLUMN_ECONTAINER_FEATURE_NAME);
+			final Column ecfColumn =
+					new Column(getPersistenceOptions().getSQLColumnNamePrefix() +
+							HbConstants.COLUMN_ECONTAINER_FEATURE_NAME);
 
 			ecfColumn.setLength(getEContainerFeatureNameColumnLength());
 
@@ -847,8 +796,7 @@
 	}
 
 	/**
-	 * Checks if the passed object is by any change a contained object and if so
-	 * returns true
+	 * Checks if the passed object is by any change a contained object and if so returns true
 	 */
 	public boolean isContainedObject(Object obj) {
 		// TODO also check containment for superclasses
@@ -867,8 +815,8 @@
 	}
 
 	/**
-	 * Import the complete content from an inputstream into the EMF Data Store.
-	 * The ExportTarget is the constant defined in the EMFDataStore interface.
+	 * Import the complete content from an inputstream into the EMF Data Store. The ExportTarget is
+	 * the constant defined in the EMFDataStore interface.
 	 */
 	public void importDataStore(InputStream is, int importFormat) {
 		final Resource importResource;
@@ -878,8 +826,7 @@
 			importResource = new XMIResourceImpl();
 		}
 
-		final HibernateResource hibResource = new HibernateResource(URI
-				.createFileURI("." + name));
+		final HibernateResource hibResource = new HibernateResource(URI.createFileURI("." + name));
 
 		try {
 			importResource.load(is, Collections.EMPTY_MAP);
@@ -891,15 +838,12 @@
 	}
 
 	/**
-	 * Export the complete content of the EMF Data Store to an outputstream, the
-	 * exportFormat is a HbConstants.EXCHANGE_FORMAT_XML or
-	 * HbConstants.EXCHANGE_FORMAT_XMI, the encoding can be null and is used to
-	 * set XMLResource.OPTION_ENCODING.
+	 * Export the complete content of the EMF Data Store to an outputstream, the exportFormat is a
+	 * HbConstants.EXCHANGE_FORMAT_XML or HbConstants.EXCHANGE_FORMAT_XMI, the encoding can be null
+	 * and is used to set XMLResource.OPTION_ENCODING.
 	 */
-	public void exportDataStore(OutputStream os, int exportFormat,
-			String encoding) {
-		final HibernateResource hibResource = new HibernateResource(URI
-				.createFileURI("." + name));
+	public void exportDataStore(OutputStream os, int exportFormat, String encoding) {
+		final HibernateResource hibResource = new HibernateResource(URI.createFileURI("." + name));
 		hibResource.load(Collections.EMPTY_MAP);
 
 		try {
@@ -962,16 +906,14 @@
 				EClass eClass = null;
 				if (pc.getMetaAttribute(HbMapperConstants.FEATUREMAP_META) == null) {
 					if (pc.getEntityName() != null) {
-						eClass = getEntityNameStrategy().toEClass(
-								pc.getEntityName());
+						eClass = getEntityNameStrategy().toEClass(pc.getEntityName());
 					} else {
-						eClass = EModelResolver.instance().getEClass(
-								pc.getMappedClass());
+						eClass = EModelResolver.instance().getEClass(pc.getMappedClass());
 					}
 				}
 
-				final EStructuralFeature ef = eClass == null ? null : StoreUtil
-						.getEStructuralFeature(eClass, prop.getName());
+				final EStructuralFeature ef =
+						eClass == null ? null : StoreUtil.getEStructuralFeature(eClass, prop.getName());
 				try {
 					String toEntity = "";
 					boolean isContainer = false;
@@ -980,12 +922,10 @@
 						final ManyToOne mto = (ManyToOne) prop.getValue();
 						toEntity = mto.getReferencedEntityName();
 						if (ef != null) {
-							isContainer = ef instanceof EReference
-									&& ((EReference) ef).isContainment();
+							isContainer = ef instanceof EReference && ((EReference) ef).isContainment();
 						} else {
-							isContainer = prop.getCascadeStyle()
-									.hasOrphanDelete()
-									|| prop.getCascade().compareTo("all") == 0; // ugly
+							isContainer =
+									prop.getCascadeStyle().hasOrphanDelete() || prop.getCascade().compareTo("all") == 0; // ugly
 							// but
 						}
 						// this was
@@ -997,46 +937,37 @@
 						final OneToOne oto = (OneToOne) prop.getValue();
 						toEntity = oto.getReferencedEntityName();
 						if (ef != null) {
-							isContainer = ef instanceof EReference
-									&& ((EReference) ef).isContainment();
+							isContainer = ef instanceof EReference && ((EReference) ef).isContainment();
 						} else {
-							isContainer = prop.getCascadeStyle()
-									.hasOrphanDelete()
-									|| prop.getCascadeStyle() == CascadeStyle.ALL;
+							isContainer =
+									prop.getCascadeStyle().hasOrphanDelete() ||
+											prop.getCascadeStyle() == CascadeStyle.ALL;
 						}
 					} else if (prop.getValue() instanceof Collection) {
 						isMany = true;
 						if (ef == null) { // TODO can this happen?
-							isContainer = prop.getCascadeStyle()
-									.hasOrphanDelete()
-									|| prop.getCascadeStyle() == CascadeStyle.ALL;
+							isContainer =
+									prop.getCascadeStyle().hasOrphanDelete() ||
+											prop.getCascadeStyle() == CascadeStyle.ALL;
 							if (((Collection) prop.getValue()).getElement() instanceof OneToMany) {
-								final Collection coll = (Collection) prop
-										.getValue();
-								toEntity = ((OneToMany) coll.getElement())
-										.getReferencedEntityName();
-							} else if (((Collection) prop.getValue())
-									.getElement() instanceof ManyToOne) {
-								final Collection coll = (Collection) prop
-										.getValue();
-								toEntity = ((ManyToOne) coll.getElement())
-										.getReferencedEntityName();
+								final Collection coll = (Collection) prop.getValue();
+								toEntity = ((OneToMany) coll.getElement()).getReferencedEntityName();
+							} else if (((Collection) prop.getValue()).getElement() instanceof ManyToOne) {
+								final Collection coll = (Collection) prop.getValue();
+								toEntity = ((ManyToOne) coll.getElement()).getReferencedEntityName();
 							} else {
-								throw new HbMapperException("Type "
-										+ ((Collection) prop.getValue())
-												.getElement().getClass()
-												.getName() + " not supported");
+								throw new HbMapperException("Type " +
+										((Collection) prop.getValue()).getElement().getClass().getName() +
+										" not supported");
 							}
 						} else {
 							// in case of featuremap set containment always on
 							// true because only the featuremap entries
 							// themselves know if they are containment
-							if (ef instanceof EAttribute
-									&& ((EAttribute) ef).getEType()
-											.getInstanceClass() == Entry.class) {
+							if (ef instanceof EAttribute &&
+									((EAttribute) ef).getEType().getInstanceClass() == Entry.class) {
 								isContainer = true;
-								final OneToMany otm = (OneToMany) ((Collection) prop
-										.getValue()).getElement();
+								final OneToMany otm = (OneToMany) ((Collection) prop.getValue()).getElement();
 								toEntity = otm.getReferencedEntityName();
 							} else if (ef instanceof EReference) {
 								final EReference er = (EReference) ef;
@@ -1046,12 +977,8 @@
 								// prop.getCascadeStyle()
 								// ==
 								// CascadeStyle.ALL;
-								toEntity = getEntityNameStrategy()
-										.toEntityName(
-												((EReference) ef)
-														.getEReferenceType());
-							} else if (ef instanceof EAttribute
-									&& ef.getEType() instanceof EClass) { // TODO
+								toEntity = getEntityNameStrategy().toEntityName(((EReference) ef).getEReferenceType());
+							} else if (ef instanceof EAttribute && ef.getEType() instanceof EClass) { // TODO
 								// can
 								// this
 								// ever
@@ -1059,8 +986,7 @@
 								isContainer = true; // prop.getCascadeStyle().hasOrphanDelete()
 								// || prop.getCascadeStyle()
 								// == CascadeStyle.ALL;
-								toEntity = getEntityNameStrategy()
-										.toEntityName((EClass) ef.getEType());
+								toEntity = getEntityNameStrategy().toEntityName((EClass) ef.getEType());
 							}
 							// filter out non eobjects
 							else {
@@ -1077,12 +1003,9 @@
 						result.put(toEntity, list);
 					}
 
-					list.add(new ReferenceTo(getMappedName(pc), prop,
-							isContainer, isMany, toEntity));
+					list.add(new ReferenceTo(getMappedName(pc), prop, isContainer, isMany, toEntity));
 				} catch (StoreClassLoadException e) {
-					throw new HbMapperException(
-							"Class not found using property: " + prop.getName()
-									+ " of " + prop, e);
+					throw new HbMapperException("Class not found using property: " + prop.getName() + " of " + prop, e);
 				}
 			}
 		}
@@ -1108,12 +1031,11 @@
 	}
 
 	/**
-	 * Add the refersto for each superclass/interface to the subclass refersto
-	 * list. As a convenience returns the set list
+	 * Add the refersto for each superclass/interface to the subclass refersto list. As a
+	 * convenience returns the set list
 	 */
 	private java.util.List<ReferenceTo> setRefersToOfSupers(String eClassUri,
-			HashMap<String, java.util.List<ReferenceTo>> refersTo,
-			ArrayList<EClass> classDone) {
+			HashMap<String, java.util.List<ReferenceTo>> refersTo, ArrayList<EClass> classDone) {
 		final EntityNameStrategy ens = getEntityNameStrategy();
 		EClass eclass;
 		// eclass = null when the refered to eclass is not mapped
@@ -1127,23 +1049,20 @@
 			return refersTo.get(eClassUri);
 		}
 
-		final java.util.List<ReferenceTo> thisList = refersTo.get(ens
-				.toEntityName(eclass));
+		final java.util.List<ReferenceTo> thisList = refersTo.get(ens.toEntityName(eclass));
 		if (thisList == null) {
 			return new ArrayList<ReferenceTo>();
 		}
 		for (EClass class1 : eclass.getESuperTypes()) {
 			String eclassUri = ens.toEntityName(class1);
-			addUnique(thisList, setRefersToOfSupers(eclassUri, refersTo,
-					classDone));
+			addUnique(thisList, setRefersToOfSupers(eclassUri, refersTo, classDone));
 		}
 		classDone.add(eclass);
 		return thisList;
 	}
 
 	/** Adds list 2 to list 1 without duplicates */
-	private void addUnique(java.util.List<ReferenceTo> l1,
-			java.util.List<ReferenceTo> l2) {
+	private void addUnique(java.util.List<ReferenceTo> l1, java.util.List<ReferenceTo> l2) {
 		if (l2 == null) {
 			return; // this is a valid situation so do nothing
 		}
@@ -1176,19 +1095,14 @@
 		private final String qryStr;
 
 		/** Constructor */
-		public ReferenceTo(String fromEntity, Property prop,
-				boolean isContainer, boolean isMany, String toEntity) {
+		public ReferenceTo(String fromEntity, Property prop, boolean isContainer, boolean isMany, String toEntity) {
 			this.isContainer = isContainer;
 			if (isMany) {
-				qryStr = "SELECT ref FROM "
-						+ fromEntity
-						+ " as ref, "
-						+ toEntity
-						+ " as refTo WHERE refTo = :to and refTo in elements(ref."
-						+ prop.getName() + ")";
+				qryStr =
+						"SELECT ref FROM " + fromEntity + " as ref, " + toEntity +
+								" as refTo WHERE refTo = :to and refTo in elements(ref." + prop.getName() + ")";
 			} else {
-				qryStr = "SELECT ref FROM " + fromEntity
-						+ " as ref WHERE :to = ref." + prop.getName();
+				qryStr = "SELECT ref FROM " + fromEntity + " as ref WHERE :to = ref." + prop.getName();
 			}
 		}
 
@@ -1206,14 +1120,12 @@
 	}
 
 	/**
-	 * Return the list of mapping files. If the mapping file path property of
-	 * persistenceoptions was set then this is returned, otherwise the classpath
-	 * is searched for the mapping file.
+	 * Return the list of mapping files. If the mapping file path property of persistenceoptions was
+	 * set then this is returned, otherwise the classpath is searched for the mapping file.
 	 */
 	protected String[] getMappingFileList() {
 		if (getPersistenceOptions().getMappingFilePath() != null) {
-			log.debug("Using specified list of mapping files "
-					+ getPersistenceOptions().getMappingFilePath());
+			log.debug("Using specified list of mapping files " + getPersistenceOptions().getMappingFilePath());
 			return getPersistenceOptions().getMappingFilePath().split(",");
 		} else if (getPersistenceOptions().isUseMappingFile()) {
 			// register otherwise the getFileList will not work
@@ -1223,7 +1135,7 @@
 			return StoreUtil.getFileList(HbConstants.HBM_FILE_NAME, null);
 		} else {
 			throw new HbStoreException(
-					"This method may only be called if either the useMappingFile property or the MappingFilePath property has been set");
+				"This method may only be called if either the useMappingFile property or the MappingFilePath property has been set");
 		}
 	}
 
@@ -1254,8 +1166,7 @@
 		final Iterator<?> it = getClassMappings();
 		while (it.hasNext()) {
 			final PersistentClass pc = (PersistentClass) it.next();
-			if (pc.getEntityName() != null
-					&& pc.getEntityName().equals(entityName)) {
+			if (pc.getEntityName() != null && pc.getEntityName().equals(entityName)) {
 				return pc;
 			}
 		}
@@ -1277,10 +1188,9 @@
 		if (paModel == null) {
 			// happens in case a hbm file is used
 			// just create the pamodel with the default values
-			paModel = getExtensionManager().getExtension(
-					PersistenceMappingBuilder.class).buildMapping(
-					getEPackages(), getPersistenceOptions(),
-					getExtensionManager());
+			paModel =
+					getExtensionManager().getExtension(PersistenceMappingBuilder.class).buildMapping(getEPackages(),
+						getPersistenceOptions(), getExtensionManager());
 		}
 		return paModel;
 	}
@@ -1293,8 +1203,7 @@
 	}
 
 	/**
-	 * If the extensionManager is not yet set then the DefaultExtensionManager
-	 * is used.
+	 * If the extensionManager is not yet set then the DefaultExtensionManager is used.
 	 * 
 	 * @return the extensionManager
 	 */
@@ -1319,8 +1228,7 @@
 	 */
 	public EntityNameStrategy getEntityNameStrategy() {
 		if (entityNameStrategy == null) {
-			entityNameStrategy = getExtensionManager().getExtension(
-					EntityNameStrategy.class);
+			entityNameStrategy = getExtensionManager().getExtension(EntityNameStrategy.class);
 			entityNameStrategy.setPaModel(getPaModel());
 		}
 		return entityNameStrategy;