Initial web hookup and clojure scripting
diff --git a/jpars.script.clojure/pom.xml b/jpars.script.clojure/pom.xml
index ba9cb8a..0921084 100644
--- a/jpars.script.clojure/pom.xml
+++ b/jpars.script.clojure/pom.xml
@@ -5,33 +5,68 @@
 	<artifactId>jpars.script.clojure</artifactId>
 	<packaging>war</packaging>
 	<version>2.4.2-SNAPSHOT</version>
-	<name>jpars.script.clojure Maven Webapp</name>
-	<url>http://maven.apache.org</url>
+
+
+	<repositories>
+		<repository>
+			<id>Java.Net</id>
+			<url>http://download.java.net/maven/2/</url>
+		</repository>
+		<repository>
+			<id>EclipseLink</id>
+			<url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
+		</repository>
+	</repositories>
+	
 	<dependencies>
 		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<version>3.8.1</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>com.oracle.toplink</groupId>
-			<artifactId>toplink-dataservices-web</artifactId>
-			<version>12.1.2-0-0</version>
-		</dependency>
-		<dependency>
-			<groupId>com.oracle.toplink</groupId>
+			<groupId>org.eclipse.persistence</groupId>
 			<artifactId>eclipselink</artifactId>
-			<version>12.1.2-0-0</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>com.oracle.toplink</groupId>
-			<artifactId>javax.persistence</artifactId>
-			<version>12.1.2-0-0</version>
+			<version>2.4.2-SNAPSHOT</version>
+			<exclusions>
+				<exclusion>
+					<artifactId>commonj.sdo</artifactId>
+					<groupId>commonj.sdo</groupId>
+				</exclusion>
+			</exclusions>
 			<scope>provided</scope>
 		</dependency>
 
+		<!-- EclipseLink JPA-RS Web Fragment -->
+		<dependency>
+			<groupId>org.eclipse.persistence</groupId>
+			<artifactId>org.eclipse.persistence.jpars</artifactId>
+			<version>2.4.2-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.11</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.derby</groupId>
+			<artifactId>derby</artifactId>
+			<version>10.9.1.0</version>
+		</dependency>
+		
+		
+		<dependency>
+			<groupId>javax</groupId>
+			<artifactId>javaee-api</artifactId>
+			<version>6.0</version>
+			<scope>provided</scope>
+		</dependency>
+		
+		
+		<dependency>
+			<groupId>org.clojure</groupId>
+			<artifactId>clojure</artifactId>
+			<version>1.5.1</version>
+		</dependency>
 	</dependencies>
 	<build>
 		<finalName>jpars.script.clojure</finalName>
diff --git a/jpars.script.clojure/src/main/java/example/CreateDataService.java b/jpars.script.clojure/src/main/java/example/CreateDataService.java
new file mode 100644
index 0000000..dd414d5
--- /dev/null
+++ b/jpars.script.clojure/src/main/java/example/CreateDataService.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *     dclarke - initial
+ ******************************************************************************/
+package example;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.persistence.EntityManagerFactory;
+
+import org.eclipse.persistence.config.PersistenceUnitProperties;
+import org.eclipse.persistence.dynamic.DynamicClassLoader;
+import org.eclipse.persistence.dynamic.DynamicType;
+import org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl;
+import org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl;
+import org.eclipse.persistence.internal.jpa.deployment.SEPersistenceUnitInfo;
+import org.eclipse.persistence.internal.sessions.DatabaseSessionImpl;
+import org.eclipse.persistence.jpa.dynamic.JPADynamicHelper;
+import org.eclipse.persistence.jpa.dynamic.JPADynamicTypeBuilder;
+import org.eclipse.persistence.jpa.rs.PersistenceFactoryBase;
+import org.eclipse.persistence.jpa.rs.service.JPARSPersistenceContextFactoryProvider;
+import org.eclipse.persistence.logging.SessionLog;
+import org.eclipse.persistence.sessions.factories.SessionManager;
+import org.eclipse.persistence.tools.schemaframework.SchemaManager;
+
+public class CreateDataService {
+
+    public static void setup() {
+        SessionManager.getManager().destroyAllSessions();
+
+        // Create a dynamic class loader and create the types.
+        DynamicClassLoader dcl = new DynamicClassLoader(Thread.currentThread().getContextClassLoader());
+
+        Class<?> personClass = dcl.createDynamicClass("model.Person");
+        JPADynamicTypeBuilder person = new JPADynamicTypeBuilder(personClass, null, "D_PERSON");
+        person.setPrimaryKeyFields("P_ID");
+        person.addDirectMapping("id", int.class, "P_ID");
+        person.addDirectMapping("name", String.class, "NAME");
+        person.configureSequencing("PERSON_SEQ", "P_ID");
+
+        DynamicType[] types = new DynamicType[] { person.getType() };
+
+        // Create an entity manager factory.
+        EntityManagerFactory emf = createEntityManagerFactory(dcl, true);
+
+        // Create JPA Dynamic Helper (with the emf above) and after the types
+        // have been created and add the types through the helper.
+        JPADynamicHelper helper = new JPADynamicHelper(emf);
+        helper.addTypes(true, true, types);
+
+        // Create database and populate
+        new SchemaManager(helper.getSession()).replaceDefaultTables();
+
+    }
+
+    private static EntityManagerFactory createEntityManagerFactory(DynamicClassLoader dcl, boolean createTables) {
+        Map<String, Object> props = new HashMap<String, Object>();
+
+        // Ensure the persistence.xml provided data source are ignored for Java
+        // SE testing
+        props.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, "");
+        props.put(PersistenceUnitProperties.JTA_DATASOURCE, "");
+
+        if (createTables) {
+            props.put(PersistenceUnitProperties.DDL_GENERATION, PersistenceUnitProperties.DROP_AND_CREATE);
+            props.put(PersistenceUnitProperties.DDL_GENERATION_MODE, PersistenceUnitProperties.DDL_DATABASE_GENERATION);
+        }
+
+        // Configure the use of embedded derby for the tests allowing system
+        // properties of the same name to override
+        props.put(PersistenceUnitProperties.JDBC_DRIVER, "org.apache.derby.jdbc.EmbeddedDriver");
+        props.put(PersistenceUnitProperties.JDBC_URL, "jdbc:derby:target/derby/dynamic-api;create=true");
+        props.put(PersistenceUnitProperties.JDBC_USER, "app");
+        props.put(PersistenceUnitProperties.JDBC_PASSWORD, "app");
+        props.put(PersistenceUnitProperties.CLASSLOADER, dcl);
+        props.put(PersistenceUnitProperties.WEAVING, "static");
+        props.put(PersistenceUnitProperties.LOGGING_LEVEL, SessionLog.FINE_LABEL);
+
+        SEPersistenceUnitInfo info = new SEPersistenceUnitInfo();
+        info.setClassLoader(dcl);
+        info.setPersistenceUnitName("test");
+        Properties p = new Properties();
+        p.putAll(props);
+        info.setProperties(p);
+
+        EntityManagerSetupImpl setup = new EntityManagerSetupImpl("test", "test");
+        setup.predeploy(info, props);
+        DatabaseSessionImpl sessionImpl = setup.deploy(dcl, props);
+        EntityManagerFactoryImpl emf = new EntityManagerFactoryImpl(sessionImpl);
+
+        try {
+            Field field = JPARSPersistenceContextFactoryProvider.class.getDeclaredField("factory");
+            field.setAccessible(true);
+            Object object = field.get(JPARSPersistenceContextFactoryProvider.class);
+            System.out.println(">" + object);
+
+            PersistenceFactoryBase factory = (PersistenceFactoryBase) object;
+            factory.bootstrapPersistenceContext("test", emf, null, "v1.0", true);
+        } catch (NoSuchFieldException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (SecurityException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (IllegalArgumentException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        return emf;
+    }
+
+}
diff --git a/jpars.script.clojure/src/main/java/example/DataService.java b/jpars.script.clojure/src/main/java/example/DataService.java
new file mode 100644
index 0000000..d54634b
--- /dev/null
+++ b/jpars.script.clojure/src/main/java/example/DataService.java
@@ -0,0 +1,43 @@
+package example;
+
+import java.io.IOException;
+
+import clojure.lang.RT;
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *     dclarke - initial
+ ******************************************************************************/
+import clojure.lang.Var;
+
+public class DataService {
+
+    /**
+     * 
+     */
+    public static Object create() {
+        // Load the Clojure script -- as a side effect this initializes the
+        // runtime.
+        try {
+            RT.loadResourceScript("example/data-services.clj");
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        // Get a reference to the foo function.
+        Var ds = RT.var("toplink", "create");
+
+        // Call it!
+        Object result = ds.invoke("test");
+
+        return result;
+    }
+}
diff --git a/jpars.script.clojure/src/main/java/example/EmployeeDynamicMappings.java b/jpars.script.clojure/src/main/java/example/EmployeeDynamicMappings.java
deleted file mode 100644
index 6cb7203..0000000
--- a/jpars.script.clojure/src/main/java/example/EmployeeDynamicMappings.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 1198, 2013 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the 
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
- * which accompanies this distribution. 
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at 
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- *     dclarke - Dynamic Persistence INCUBATION - Enhancement 200045
- *               http://wiki.eclipse.org/EclipseLink/Development/JPA/Dynamic
- *     
- * This code is being developed under INCUBATION and is not currently included 
- * in the automated EclipseLink build. The API in this code may change, or 
- * may never be included in the product. Please provide feedback through mailing 
- * lists or the bug database.
- ******************************************************************************/
-package example;
-
-import org.eclipse.persistence.dynamic.DynamicClassLoader;
-import org.eclipse.persistence.dynamic.DynamicType;
-import org.eclipse.persistence.jpa.dynamic.JPADynamicTypeBuilder;
-import org.eclipse.persistence.mappings.OneToManyMapping;
-import org.eclipse.persistence.mappings.OneToOneMapping;
-
-/**
- * Example of creating mappings in API
- * 
- * @author dclarke
- */
-public class EmployeeDynamicMappings {
-
-    /**
-     * Configure using dynamic API.
-     */
-    private static void configureAddress(JPADynamicTypeBuilder address) {
-        address.setPrimaryKeyFields("ADDR_ID");
-
-        address.addDirectMapping("id", int.class, "ADDR_ID");
-        address.addDirectMapping("street", String.class, "STREET");
-        address.addDirectMapping("city", String.class, "CITY");
-        address.addDirectMapping("province", String.class, "PROV");
-        address.addDirectMapping("postalCode", String.class, "P_CODE");
-        address.addDirectMapping("country", String.class, "COUNTRY");
-
-        address.configureSequencing("ADDR_SEQ", "ADDR_ID");
-    }
-
-    /**
-     * Configure using dynamic API.
-     */
-    private static void configureEmployee(JPADynamicTypeBuilder employee, JPADynamicTypeBuilder address, JPADynamicTypeBuilder phone) {
-        employee.setPrimaryKeyFields("EMP_ID");
-
-        employee.addDirectMapping("id", int.class, "D_EMPLOYEE.EMP_ID");
-        employee.addDirectMapping("firstName", String.class, "D_EMPLOYEE.F_NAME");
-        employee.addDirectMapping("lastName", String.class, "D_EMPLOYEE.L_NAME");
-        employee.addDirectMapping("gender", String.class, "D_EMPLOYEE.GENDER");
-        employee.addDirectMapping("salary", int.class, "D_SALARY.SALARY");
-
-        OneToOneMapping addressMapping = employee.addOneToOneMapping("address", address.getType(), "ADDR_ID");
-        addressMapping.setCascadeAll(true);
-        addressMapping.setIsPrivateOwned(true);
-
-        employee.addOneToOneMapping("manager", employee.getType(), "MANAGER_ID");
-
-        OneToManyMapping phoneMapping = employee.addOneToManyMapping("phoneNumbers", phone.getType(), "OWNER_ID");
-        phoneMapping.setCascadeAll(true);
-        phoneMapping.setIsPrivateOwned(true);
-
-        employee.addOneToManyMapping("managedEmployees", employee.getType(), "MANAGER_ID");
-
-        employee.addDirectCollectionMapping("responsibilities", "D_RESPONS", "RESPON_DESC", String.class, "EMP_ID");
-
-        employee.configureSequencing("EMP_SEQ", "EMP_ID");
-    }
-
-    /**
-     * Configure using dynamic API.
-     */
-    private static void configurePhone(JPADynamicTypeBuilder phone, JPADynamicTypeBuilder employee) {
-        phone.setPrimaryKeyFields("PHONE_TYPE", "EMP_ID");
-
-        phone.addDirectMapping("type", String.class, "PHONE_TYPE");
-        phone.addDirectMapping("ownerId", int.class, "EMP_ID").readOnly();
-        phone.addDirectMapping("areaCode", String.class, "AREA_CODE");
-        phone.addDirectMapping("number", String.class, "PNUMBER");
-
-        phone.addOneToOneMapping("owner", employee.getType(), "EMP_ID");
-    }
-
-
-    /**
-     * Create the types using the dynamic API.
-     */
-    public static DynamicType[] createTypes(DynamicClassLoader dcl, String packageName) {
-        String packagePrefix = packageName.endsWith(".") ? packageName : packageName + ".";
-
-        Class<?> employeeClass = dcl.createDynamicClass(packagePrefix + "Employee");
-        Class<?> addressClass = dcl.createDynamicClass(packagePrefix + "Address");
-        Class<?> phoneClass = dcl.createDynamicClass(packagePrefix + "PhoneNumber");
-
-        JPADynamicTypeBuilder employee = new JPADynamicTypeBuilder(employeeClass, null, "D_EMPLOYEE", "D_SALARY");
-        JPADynamicTypeBuilder address = new JPADynamicTypeBuilder(addressClass, null, "D_ADDRESS");
-        JPADynamicTypeBuilder phone = new JPADynamicTypeBuilder(phoneClass, null, "D_PHONE");
-
-        configureAddress(address);
-        configureEmployee(employee, address, phone);
-        configurePhone(phone, employee);
-
-        DynamicType[] types = new DynamicType[] { employee.getType(), address.getType(), phone.getType() };
-        return types;
-    }
-}
diff --git a/jpars.script.clojure/src/main/java/example/PersistenceHelper.java b/jpars.script.clojure/src/main/java/example/PersistenceHelper.java
deleted file mode 100644
index f549b5b..0000000
--- a/jpars.script.clojure/src/main/java/example/PersistenceHelper.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the 
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
- * which accompanies this distribution. 
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at 
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- *  dclarke - example
- ******************************************************************************/
-package example;
-
-import static org.eclipse.persistence.jaxb.MarshallerProperties.MEDIA_TYPE;
-import static org.eclipse.persistence.jaxb.UnmarshallerProperties.JSON_INCLUDE_ROOT;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
-import org.eclipse.persistence.config.PersistenceUnitProperties;
-import org.eclipse.persistence.dynamic.DynamicClassLoader;
-import org.eclipse.persistence.internal.queries.ReportItem;
-import org.eclipse.persistence.jaxb.JAXBContextFactory;
-import org.eclipse.persistence.oxm.MediaType;
-import org.eclipse.persistence.queries.ConstructorReportItem;
-import org.eclipse.persistence.queries.DatabaseQuery;
-import org.eclipse.persistence.queries.ReportQuery;
-import org.eclipse.persistence.sessions.server.Server;
-
-/**
- * Simple helper responsible for creation of JPA and MOXy contexts.
- * 
- * @author dclarke
- */
-public class PersistenceHelper {
-    
-    public static final String EMPLOYEE_XML_PU = "employee-xml";
-
-    public static final String EMPLOYEE_API_PU = "employee-api";
-
-    public static EntityManagerFactory createEntityManagerFactory(DynamicClassLoader dcl, String persistenceUnit, boolean createTables) {
-        Map<String, Object> props = new HashMap<String, Object>();
-
-        // Ensure the persistence.xml provided data source are ignored for Java
-        // SE testing
-        props.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, "");
-        props.put(PersistenceUnitProperties.JTA_DATASOURCE, "");
-        
-        if (createTables) {
-            props.put(PersistenceUnitProperties.DDL_GENERATION, PersistenceUnitProperties.DROP_AND_CREATE);
-            props.put(PersistenceUnitProperties.DDL_GENERATION_MODE, PersistenceUnitProperties.DDL_DATABASE_GENERATION);
-        }
-
-        // Configure the use of embedded derby for the tests allowing system
-        // properties of the same name to override
-        props.put(PersistenceUnitProperties.JDBC_DRIVER, "org.apache.derby.jdbc.EmbeddedDriver");
-        props.put(PersistenceUnitProperties.JDBC_URL, "jdbc:derby:target/derby/mysports;create=true");
-        props.put(PersistenceUnitProperties.JDBC_USER, "app");
-        props.put(PersistenceUnitProperties.JDBC_PASSWORD, "app");
-        props.put(PersistenceUnitProperties.CLASSLOADER, dcl);
-        props.put(PersistenceUnitProperties.WEAVING, "static");
-        return Persistence.createEntityManagerFactory(persistenceUnit, props);
-    }
-
-    private static JAXBContext context;
-
-    public static JAXBContext getContext(EntityManager em) throws JAXBException {
-        if (context == null) {
-            Set<Class<?>> classes = new HashSet<Class<?>>();
-
-            Server serverSession = em.unwrap(Server.class);
-
-            for (List<DatabaseQuery> queryList : serverSession.getQueries().values()) {
-                for (DatabaseQuery query : queryList) {
-                    if (query.isReportQuery()) {
-                        ReportQuery rq = (ReportQuery) query;
-                        for (ReportItem item : rq.getItems()) {
-                            if (item.isConstructorItem()) {
-                                classes.add(((ConstructorReportItem) item).getResultType());
-                            }
-                        }
-                    }
-                }
-            }
-
-            context = JAXBContextFactory.createContext(classes.toArray(new Class[classes.size()]), null);
-        }
-        return context;
-    }
-
-    public static Marshaller createMarshaller(EntityManager em, MediaType mediaType) throws JAXBException {
-        Marshaller marshaller = getContext(em).createMarshaller();
-        marshaller.setProperty(MEDIA_TYPE, mediaType.getMediaType());
-        return marshaller;
-    }
-
-    public static Unmarshaller createUnmarshaller(EntityManager em, MediaType mediaType) throws JAXBException {
-        Unmarshaller unmarshaller = getContext(em).createUnmarshaller();
-        unmarshaller.setProperty(MEDIA_TYPE, mediaType.getMediaType());
-        unmarshaller.setProperty(JSON_INCLUDE_ROOT, false);
-        return unmarshaller;
-    }
-
-}
diff --git a/jpars.script.clojure/src/main/java/example/Queries.java b/jpars.script.clojure/src/main/java/example/Queries.java
deleted file mode 100644
index eb2e84d..0000000
--- a/jpars.script.clojure/src/main/java/example/Queries.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 1198, 2013 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the 
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
- * which accompanies this distribution. 
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at 
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- *     dclarke - Dynamic Persistence INCUBATION - Enhancement 200045
- *               http://wiki.eclipse.org/EclipseLink/Development/JPA/Dynamic
- *     
- * This code is being developed under INCUBATION and is not currently included 
- * in the automated EclipseLink build. The API in this code may change, or 
- * may never be included in the product. Please provide feedback through mailing 
- * lists or the bug database.
- ******************************************************************************/
-package example;
-
-import java.util.Collection;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-
-import org.eclipse.persistence.config.QueryHints;
-import org.eclipse.persistence.descriptors.ClassDescriptor;
-import org.eclipse.persistence.dynamic.DynamicEntity;
-import org.eclipse.persistence.dynamic.DynamicType;
-import org.eclipse.persistence.expressions.ExpressionBuilder;
-import org.eclipse.persistence.jpa.JpaHelper;
-import org.eclipse.persistence.oxm.MediaType;
-import org.eclipse.persistence.queries.ReadAllQuery;
-
-/**
- * Simple query examples for the XML mapped Employee domain model.
- * 
- * @author dclarke
- * @since EclipseLink - Dynamic Incubator (1.1.0-branch)
- */
-public class Queries {
-    
-    public DynamicEntity findEmployee(EntityManager em, DynamicType type, Object id) {
-        return (DynamicEntity) em.find(type.getJavaClass(), id);
-    }
-    
-    /**
-     * Simple example using dynamic JP QL to retrieve all Employee instances
-     * sorted by lastName and firstName.
-     */
-    @SuppressWarnings("unchecked")
-    public List<DynamicEntity> readAllEmployeesUsing(EntityManager em) {
-        return em.createQuery("SELECT e FROM Employee e ORDER BY e.id ASC").getResultList();
-    }
-
-    @SuppressWarnings("unchecked")
-    public List<DynamicEntity> joinFetchEmployeeWithAddress(EntityManager em) {
-        return em.createQuery("SELECT e FROM Employee e JOIN FETCH e.address ORDER BY e.lastName ASC, e.firstName ASC").getResultList();
-    }
-
-    @SuppressWarnings("unchecked")
-    public List<DynamicEntity> joinFetchHint(EntityManager em) {
-        Query query = em.createQuery("SELECT e FROM Employee e WHERE e.manager.address.city = 'Ottawa' ORDER BY e.lastName ASC, e.firstName ASC");
-        query.setHint(QueryHints.FETCH, "e.address");
-        query.setHint(QueryHints.FETCH, "e.manager");
-        query.setHint(QueryHints.FETCH, "e.manager.address");
-        query.setHint(QueryHints.BATCH, "e.manager.phoneNumbers");
-        List<DynamicEntity> emps = query.getResultList();
-
-        for (DynamicEntity emp : emps) {
-            emp.<DynamicEntity>get("manager").<Collection<DynamicEntity>>get("phoneNumbers").size();
-        }
-
-        return emps;
-    }
-
-    public int minimumEmployeeId(EntityManager em) {
-        return ((Number) em.createQuery("SELECT MIN(e.id) FROM Employee e").getSingleResult()).intValue();
-    }
-
-    public DynamicEntity minimumEmployee(EntityManager em) {
-        Query q = em.createQuery("SELECT e FROM Employee e WHERE e.id in (SELECT MIN(ee.id) FROM Employee ee)");
-
-        return (DynamicEntity) q.getSingleResult();
-    }
-
-    @SuppressWarnings("unchecked")
-    public List<DynamicEntity> findEmployeesUsingGenderIn(EntityManager em) {
-        return em.createQuery("SELECT e FROM Employee e WHERE e.gender IN (:GENDER1, :GENDER2)").setParameter("GENDER1", "Male").setParameter("GENDER2", "Female").getResultList();
-    }
-
-    @SuppressWarnings("unchecked")
-    public List<DynamicEntity> findUsingNativeReadAllQuery(EntityManager em) {
-        ClassDescriptor descriptor = JpaHelper.getEntityManager(em).getServerSession().getDescriptorForAlias("Employee");
-        ReadAllQuery raq = new ReadAllQuery(descriptor.getJavaClass());
-        ExpressionBuilder eb = raq.getExpressionBuilder();
-        raq.setSelectionCriteria(eb.get("gender").equal("Male"));
-
-        Query query = JpaHelper.createQuery(raq, em);
-
-        return query.getResultList();
-    }
-
-    public DynamicEntity minEmployeeWithAddressAndPhones(EntityManager em) {
-        return (DynamicEntity) em.createQuery("SELECT e FROM Employee e JOIN FETCH e.address WHERE e.id IN (SELECT MIN(p.id) FROM PhoneNumber p)").getSingleResult();
-    }
-    
-    public List<?> findEmployeeSummaries(EntityManager em) throws JAXBException {
-        List<?> results = em.createNamedQuery("Employee.findSummary").getResultList();
-        Marshaller marshaller = PersistenceHelper.createMarshaller(em, MediaType.APPLICATION_JSON);
-        
-        for (Object result: results) {
-            marshaller.marshal(result, System.out);
-        }
-        
-        return results;
-    }
-}
diff --git a/jpars.script.clojure/src/main/java/example/Samples.java b/jpars.script.clojure/src/main/java/example/Samples.java
deleted file mode 100644
index 44e352d..0000000
--- a/jpars.script.clojure/src/main/java/example/Samples.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 1198, 2013 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the 
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
- * which accompanies this distribution. 
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at 
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- *     dclarke - Dynamic Persistence INCUBATION - Enhancement 200045
- *               http://wiki.eclipse.org/EclipseLink/Development/JPA/Dynamic
- *     
- * This code is being developed under INCUBATION and is not currently included 
- * in the automated EclipseLink build. The API in this code may change, or 
- * may never be included in the product. Please provide feedback through mailing 
- * lists or the bug database.
- ******************************************************************************/
-package example;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Query;
-
-import junit.framework.Assert;
-
-import org.eclipse.persistence.descriptors.ClassDescriptor;
-import org.eclipse.persistence.dynamic.DynamicEntity;
-import org.eclipse.persistence.expressions.ExpressionBuilder;
-import org.eclipse.persistence.jpa.JpaHelper;
-import org.eclipse.persistence.queries.DeleteAllQuery;
-import org.eclipse.persistence.queries.ReportQuery;
-
-/**
- * 
- * @author dclarke
- * @since EclipseLink - Dynamic Incubator (1.1.0-branch)
- */
-public class Samples {
-    private EntityManagerFactory emf;
-    public DynamicEntity[] employees;
-
-    public Samples(EntityManagerFactory emf) {
-        this.emf = emf;
-
-        this.employees = new DynamicEntity[] { basicEmployeeExample1(), basicEmployeeExample2(), basicEmployeeExample3(), basicEmployeeExample4(), basicEmployeeExample5(), basicEmployeeExample6(), basicEmployeeExample7(), basicEmployeeExample8(), basicEmployeeExample9(), basicEmployeeExample10(), basicEmployeeExample11(), basicEmployeeExample12() };
-
-        // Setup management hierarchy
-        addManagedEmployees(0, new int[] { 2, 3, 4 });
-        addManagedEmployees(1, new int[] { 5, 0 });
-        addManagedEmployees(2, new int[] {});
-        addManagedEmployees(3, new int[] {});
-        addManagedEmployees(4, new int[] {});
-        addManagedEmployees(5, new int[] {});
-        addManagedEmployees(6, new int[] {});
-        addManagedEmployees(7, new int[] {});
-        addManagedEmployees(8, new int[] {});
-        addManagedEmployees(9, new int[] { 7, 8, 10, 11 });
-        addManagedEmployees(10, new int[] { 6 });
-        addManagedEmployees(11, new int[] { 1 });
-    }
-
-    private DynamicEntity newInstance(String entityAlias) {
-        ClassDescriptor descriptor = JpaHelper.getServerSession(this.emf).getDescriptorForAlias(entityAlias);
-        return (DynamicEntity) descriptor.getInstantiationPolicy().buildNewInstance();
-    }
-
-    private Class<?> getDynamicClass(String entityAlias) {
-        ClassDescriptor descriptor = JpaHelper.getServerSession(this.emf).getDescriptorForAlias(entityAlias);
-        return descriptor.getJavaClass();
-    }
-
-    private DynamicEntity addPhoneNumber(DynamicEntity employee, String type, String areaCode, String number) {
-        DynamicEntity phone = newInstance("PhoneNumber");
-        phone.set("type", type);
-        phone.set("areaCode", areaCode);
-        phone.set("number", number);
-        phone.set("owner", employee);
-        employee.<Collection<DynamicEntity>> get("phoneNumbers").add(phone);
-        return phone;
-    }
-
-    public DynamicEntity basicEmployeeExample1() {
-        DynamicEntity employee = newInstance("Employee");
-
-        employee.set("firstName", "Bob");
-        employee.set("lastName", "Smith");
-        employee.set("gender", "Male");
-        employee.set("salary", 35000);
-
-        DynamicEntity address = newInstance("Address");
-        address.set("city", "Toronto");
-        address.set("postalCode", "L5J2B5");
-        address.set("province", "ONT");
-        address.set("street", "1450 Acme Cr., Suite 4");
-        address.set("country", "Canada");
-        employee.set("address", address);
-
-        employee.<Collection<String>> get("responsibilities").add("Water the office plants.");
-        employee.<Collection<String>> get("responsibilities").add("Maintain the kitchen facilities.");
-        addPhoneNumber(employee, "Work", "613", "5558812");
-
-        return employee;
-    }
-
-    public DynamicEntity basicEmployeeExample10() {
-        DynamicEntity employee = newInstance("Employee");
-
-        employee.set("firstName", "Jill");
-        employee.set("lastName", "May");
-        employee.set("gender", "Female");
-
-        DynamicEntity address = newInstance("Address");
-        address.set("city", "Calgary");
-        address.set("postalCode", "J5J2B5");
-        address.set("province", "AB");
-        address.set("street", "1111 Mooseland Rd.");
-        address.set("country", "Canada");
-        employee.set("address", address);
-
-        employee.set("salary", 56232);
-        addPhoneNumber(employee, "Work", "613", "5558812");
-        addPhoneNumber(employee, "Work Fax", "613", "5555943");
-
-        return employee;
-    }
-
-    public DynamicEntity basicEmployeeExample11() {
-        DynamicEntity employee = newInstance("Employee");
-
-        employee.set("firstName", "Sarah-Lou");
-        employee.set("lastName", "Smitty");
-        employee.set("gender", "Female");
-
-        DynamicEntity address = newInstance("Address");
-        address.set("city", "Arnprior");
-        address.set("postalCode", "W1A2B5");
-        address.set("province", "ONT");
-        address.set("street", "1 Hawthorne Drive");
-        address.set("country", "Canada");
-        employee.set("address", address);
-
-        employee.set("salary", 75000);
-        addPhoneNumber(employee, "Work Fax", "613", "5555943");
-        addPhoneNumber(employee, "Home", "613", "5551234");
-        addPhoneNumber(employee, "Cellular", "416", "5551111");
-
-        return employee;
-    }
-
-    public DynamicEntity basicEmployeeExample12() {
-        DynamicEntity employee = newInstance("Employee");
-
-        employee.set("firstName", "Jim-Bob");
-        employee.set("lastName", "Jefferson");
-        employee.set("gender", "Male");
-
-        DynamicEntity address = newInstance("Address");
-        address.set("city", "Yellowknife");
-        address.set("postalCode", "Y5J2N5");
-        address.set("province", "YK");
-        address.set("street", "1112 Gold Rush Rd.");
-        address.set("country", "Canada");
-        employee.set("address", address);
-
-        employee.set("salary", 50000);
-        addPhoneNumber(employee, "Home", "613", "5551234");
-        addPhoneNumber(employee, "Cellular", "416", "5551111");
-
-        return employee;
-    }
-
-    public DynamicEntity basicEmployeeExample2() {
-        DynamicEntity employee = newInstance("Employee");
-
-        employee.set("firstName", "John");
-        employee.set("lastName", "Way");
-        employee.set("gender", "Male");
-        employee.set("salary", 53000);
-
-        DynamicEntity address = newInstance("Address");
-        address.set("city", "Ottawa");
-        address.set("postalCode", "K5J2B5");
-        address.set("province", "ONT");
-        address.set("street", "12 Merivale Rd., Suite 5");
-        address.set("country", "Canada");
-        employee.set("address", address);
-
-        employee.<Collection<String>> get("responsibilities").add("Hire people when more people are required.");
-        employee.<Collection<String>> get("responsibilities").add("Lay off employees when less people are required.");
-        addPhoneNumber(employee, "Work", "613", "5558812");
-        addPhoneNumber(employee, "ISDN", "905", "5553691");
-
-        return employee;
-    }
-
-    public DynamicEntity basicEmployeeExample3() {
-        DynamicEntity employee = newInstance("Employee");
-
-        employee.set("firstName", "Charles");
-        employee.set("lastName", "Chanley");
-        employee.set("gender", "Male");
-        employee.set("salary", 43000);
-
-        DynamicEntity address = newInstance("Address");
-        address.set("city", "Montreal");
-        address.set("postalCode", "Q2S5Z5");
-        address.set("province", "QUE");
-        address.set("street", "1 Canadien Place");
-        address.set("country", "Canada");
-        employee.set("address", address);
-
-        employee.<Collection<String>> get("responsibilities").add("Perform code reviews as required.");
-
-        addPhoneNumber(employee, "Pager", "976", "5556666");
-        addPhoneNumber(employee, "ISDN", "905", "5553691");
-
-        return employee;
-    }
-
-    public DynamicEntity basicEmployeeExample4() {
-        DynamicEntity employee = newInstance("Employee");
-
-        employee.set("firstName", "Emanual");
-        employee.set("lastName", "Smith");
-        employee.set("gender", "Male");
-        employee.set("salary", 49631);
-
-        DynamicEntity address = newInstance("Address");
-        address.set("city", "Vancouver");
-        address.set("postalCode", "N5J2N5");
-        address.set("province", "BC");
-        address.set("street", "20 Mountain Blvd., Floor 53, Suite 6");
-        address.set("country", "Canada");
-        employee.set("address", address);
-
-        employee.<Collection<String>> get("responsibilities").add("Have to fix the Database problem.");
-        addPhoneNumber(employee, "Work Fax", "613", "5555943");
-        addPhoneNumber(employee, "Cellular", "416", "5551111");
-        addPhoneNumber(employee, "Pager", "976", "5556666");
-        addPhoneNumber(employee, "ISDN", "905", "5553691");
-
-        return employee;
-    }
-
-    public DynamicEntity basicEmployeeExample5() {
-        DynamicEntity employee = newInstance("Employee");
-
-        employee.set("firstName", "Sarah");
-        employee.set("lastName", "Way");
-        employee.set("gender", "Female");
-        employee.set("salary", 87000);
-
-        DynamicEntity address = newInstance("Address");
-        address.set("city", "Prince Rupert");
-        address.set("postalCode", "K3K5D5");
-        address.set("province", "BC");
-        address.set("street", "3254 Parkway Place");
-        address.set("country", "Canada");
-        employee.set("address", address);
-
-        employee.<Collection<String>> get("responsibilities").add("Write code documentation.");
-        addPhoneNumber(employee, "Work", "613", "5558812");
-        addPhoneNumber(employee, "ISDN", "905", "5553691");
-        addPhoneNumber(employee, "Home", "613", "5551234");
-
-        return employee;
-    }
-
-    public DynamicEntity basicEmployeeExample6() {
-        DynamicEntity employee = newInstance("Employee");
-
-        employee.set("firstName", "Marcus");
-        employee.set("lastName", "Saunders");
-        employee.set("gender", "Male");
-        employee.set("salary", 54300);
-
-        DynamicEntity address = newInstance("Address");
-        address.set("city", "Perth");
-        address.set("postalCode", "Y3Q2N9");
-        address.set("province", "ONT");
-        address.set("street", "234 Caledonia Lane");
-        address.set("country", "Canada");
-        employee.set("address", address);
-
-        employee.<Collection<String>> get("responsibilities").add("Write user specifications.");
-        addPhoneNumber(employee, "ISDN", "905", "5553691");
-        addPhoneNumber(employee, "Work", "613", "5558812");
-
-        return employee;
-    }
-
-    public DynamicEntity basicEmployeeExample7() {
-        DynamicEntity employee = newInstance("Employee");
-
-        employee.set("firstName", "Nancy");
-        employee.set("lastName", "White");
-        employee.set("gender", "Female");
-        employee.set("salary", 31000);
-
-        DynamicEntity address = newInstance("Address");
-        address.set("city", "Metcalfe");
-        address.set("postalCode", "Y4F7V6");
-        address.set("province", "ONT");
-        address.set("street", "2 Anderson Rd.");
-        address.set("country", "Canada");
-        employee.set("address", address);
-
-        addPhoneNumber(employee, "Home", "613", "5551234");
-
-        return employee;
-    }
-
-    public DynamicEntity basicEmployeeExample8() {
-        DynamicEntity employee = newInstance("Employee");
-
-        employee.set("firstName", "Fred");
-        employee.set("lastName", "Jones");
-        employee.set("gender", "Male");
-        employee.set("salary", 500000);
-
-        DynamicEntity address = newInstance("Address");
-        address.set("city", "Victoria");
-        address.set("postalCode", "Z5J2N5");
-        address.set("province", "BC");
-        address.set("street", "382 Hyde Park Blvd.");
-        address.set("country", "Canada");
-        employee.set("address", address);
-
-        addPhoneNumber(employee, "Cellular", "416", "5551111");
-        addPhoneNumber(employee, "ISDN", "905", "5553691");
-
-        return employee;
-    }
-
-    public DynamicEntity basicEmployeeExample9() {
-        DynamicEntity employee = newInstance("Employee");
-
-        employee.set("firstName", "Betty");
-        employee.set("lastName", "Jones");
-        employee.set("gender", "Female");
-        employee.set("salary", 500001);
-
-        DynamicEntity address = newInstance("Address");
-        address.set("city", "Smith Falls");
-        address.set("postalCode", "C6C6C6");
-        address.set("province", "ONT");
-        address.set("street", "89 Chocolate Drive");
-        address.set("country", "Canada");
-        employee.set("address", address);
-
-        addPhoneNumber(employee, "Work", "613", "5558812");
-        addPhoneNumber(employee, "ISDN", "905", "5553691");
-
-        return employee;
-    }
-
-    private void addManagedEmployees(int managerIndex, int[] employeeIndeces) {
-        DynamicEntity manager = this.employees[managerIndex];
-
-        if (manager.<Collection<DynamicEntity>> get("managedEmployees").isEmpty()) {
-            for (int index = 0; index < employeeIndeces.length; index++) {
-                manager.<Collection<DynamicEntity>> get("managedEmployees").add(this.employees[employeeIndeces[index]]);
-            }
-        }
-    }
-
-    /**
-     * Register all of the population in the provided EntityManager to be
-     * persisted This method should only be called from within a test case. It
-     * asserts that the provided EntityManager is in a transaction and that the
-     * database tables are empty.
-     */
-    public void persistAll(EntityManager em) {
-        Assert.assertTrue("EntityManager not in Transaction", em.getTransaction().isActive());
-
-        // Verify that the database tables are empty
-        assertCount(em, "Employee", 0);
-        assertCount(em, "Address", 0);
-        assertCount(em, "PhoneNumber", 0);
-
-        for (int index = 0; index < this.employees.length; index++) {
-            em.persist(this.employees[index]);
-        }
-
-        em.flush();
-        verifyCounts(em);
-    }
-
-    public void verifyCounts(EntityManager em) {
-        assertCount(em, "Employee", this.employees.length);
-        assertCount(em, "Address", this.employees.length);
-    }
-
-    /**
-     * Verify that the provided entity type has no rows in the database using a
-     * native ReportQuery.
-     * 
-     * @param entityClass
-     * @param count
-     */
-    public void assertCount(EntityManager em, String entityAlias, int count) {
-        Class<?> entityClass = getDynamicClass(entityAlias);
-        ReportQuery query = new ReportQuery(entityClass, new ExpressionBuilder());
-        query.addCount();
-        query.setShouldReturnSingleValue(true);
-
-        int dbCount = ((Number) JpaHelper.getEntityManager(em).getUnitOfWork().executeQuery(query)).intValue();
-        Assert.assertEquals("Incorrect quantity found of " + entityClass, count, dbCount);
-    }
-
-    /**
-     * Verify that the provided list of Employee instances matches the sample
-     * population.
-     * 
-     * @param employees
-     */
-    public void assertSame(List<DynamicEntity> dbEmps) {
-        Assert.assertEquals("Incorrect quantity of employees", this.employees.length, dbEmps.size());
-        Collections.sort(dbEmps, new DynamicEntityComparator());
-
-        List<DynamicEntity> sampleEmps = new ArrayList<DynamicEntity>();
-        for (int index = 0; index < this.employees.length; index++) {
-            sampleEmps.add(this.employees[index]);
-        }
-        Collections.sort(sampleEmps, new DynamicEntityComparator());
-
-        for (int index = 0; index < this.employees.length; index++) {
-            DynamicEntity emp = sampleEmps.get(index);
-            DynamicEntity dbEmp = dbEmps.get(index);
-
-            Assert.assertEquals("First name does not match on employees[" + index + "]", emp.<String> get("firstName"), dbEmp.<String> get("firstName"));
-            Assert.assertEquals("Last name does not match on employees[" + index + "]", emp.<String> get("lastName"), dbEmp.<String> get("lastName"));
-            Assert.assertEquals("Salary does not match on employees[" + index + "]", emp.<Integer> get("salary"), dbEmp.<Integer> get("salary"));
-        }
-    }
-
-    /**
-     * Simple comparator used to order the employees for use within assertSame
-     */
-    class DynamicEntityComparator implements Comparator<DynamicEntity> {
-
-        public int compare(DynamicEntity emp1, DynamicEntity emp2) {
-            return emp1.<Integer> get("id") - emp2.<Integer> get("id");
-        }
-
-    }
-
-    /**
-     * Extract the id's from the sample Employee instances.
-     * 
-     * @param em
-     * @return
-     */
-    public int[] getEmployeeIds(EntityManager em) {
-        int[] ids = new int[this.employees.length];
-
-        for (int index = 0; index < this.employees.length; index++) {
-            ids[index] = this.employees[index].<Integer> get("id");
-        }
-
-        return ids;
-    }
-
-    /**
-     * Reset the database so that only the sample population exists.
-     * 
-     * @param em
-     */
-    public void resetDatabase(EntityManager em) {
-        em.getTransaction().begin();
-
-        DeleteAllQuery deleteEmpsQuery = new DeleteAllQuery(getDynamicClass("Employee"));
-        ExpressionBuilder eb = deleteEmpsQuery.getExpressionBuilder();
-        deleteEmpsQuery.setSelectionCriteria(eb.get("id").notIn(getEmployeeIds(em)));
-        deleteEmpsQuery.setFlushOnExecute(true);
-
-        JpaHelper.getEntityManager(em).getUnitOfWork().executeQuery(deleteEmpsQuery);
-
-        em.getTransaction().commit();
-    }
-
-    public void resetSalary(EntityManager em) {
-        boolean startedTX = !em.getTransaction().isActive();
-
-        if (startedTX) {
-            em.getTransaction().begin();
-        }
-
-        for (int index = 0; index < this.employees.length; index++) {
-            DynamicEntity emp = this.employees[index];
-            Query query = em.createQuery("SELECT e FROM Employee e WHERE e.firstName = :FNAME AND e.lastName = :LNAME");
-            query.setParameter("FNAME", emp.<String> get("firstName"));
-            query.setParameter("LNAME", emp.<String> get("lastName"));
-
-            DynamicEntity dbEmp = (DynamicEntity) query.getSingleResult();
-            dbEmp.set("salary", this.employees[index].<Integer> get("salary"));
-        }
-
-        if (startedTX) {
-            em.getTransaction().commit();
-        }
-    }
-}
diff --git a/jpars.script.clojure/src/main/java/example/Transactions.java b/jpars.script.clojure/src/main/java/example/Transactions.java
deleted file mode 100644
index 8154258..0000000
--- a/jpars.script.clojure/src/main/java/example/Transactions.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package example;
-
-/*******************************************************************************
- * Copyright (c) 1198, 2013 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the 
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
- * which accompanies this distribution. 
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at 
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- *     dclarke - Dynamic Persistence INCUBATION - Enhancement 200045
- *               http://wiki.eclipse.org/EclipseLink/Development/JPA/Dynamic
- *     
- * This code is being developed under INCUBATION and is not currently included 
- * in the automated EclipseLink build. The API in this code may change, or 
- * may never be included in the product. Please provide feedback through mailing 
- * lists or the bug database.
- ******************************************************************************/
-
-import java.util.Collection;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.FlushModeType;
-
-import org.eclipse.persistence.config.PessimisticLock;
-import org.eclipse.persistence.config.QueryHints;
-import org.eclipse.persistence.dynamic.DynamicEntity;
-import org.eclipse.persistence.dynamic.DynamicHelper;
-import org.eclipse.persistence.dynamic.DynamicType;
-import org.eclipse.persistence.jpa.dynamic.JPADynamicHelper;
-
-/**
- * 
- * @author dclarke
- * @since EclipseLink - Dynamic Incubator (1.1.0-branch)
- */
-public class Transactions {
-
-    /**
-     * New entities with new related related entities can be persisted using
-     * <code>EntityManager.persist(newEntity)</code>. The cascade setting on the
-     * mappings determine how the related entities are handled. In this case
-     * Employee has its relationship to Address and PhoneNumber configured with
-     * cascade-all so the associated new entities will also be persisted.
-     */
-    public DynamicEntity createUsingPersist(EntityManager em) {
-        DynamicHelper helper = new JPADynamicHelper(em);
-
-        DynamicType empType = helper.getType("Employee");
-        DynamicType addrType = helper.getType("Address");
-        DynamicType phoneType = helper.getType("PhoneNumber");
-
-        DynamicEntity emp = (DynamicEntity) empType.newDynamicEntity();
-        emp.set("firstName", "Sample");
-        emp.set("lastName", "Employee");
-        emp.set("gender", "Male");
-        emp.set("salary", 123456);
-
-        DynamicEntity address = (DynamicEntity) addrType.newDynamicEntity();
-        emp.set("address", address);
-
-        DynamicEntity phone = (DynamicEntity) phoneType.newDynamicEntity();
-        phone.set("type", "Mobile");
-        phone.set("areaCode", "613");
-        phone.set("number", "555-1212");
-        phone.set("owner", emp);
-        emp.<Collection<DynamicEntity>> get("phoneNumbers").add(phone);
-
-        em.getTransaction().begin();
-        em.persist(emp);
-        em.getTransaction().commit();
-
-        return emp;
-    }
-
-    /**
-	 * 
-	 */
-    public DynamicEntity createUsingMerge(EntityManager em) {
-        JPADynamicHelper helper = new JPADynamicHelper(em);
-
-        DynamicEntity emp = helper.getType("Employee").newDynamicEntity();
-        emp.set("firstName", "Sample");
-        emp.set("lastName", "Employee");
-        emp.set("gender", "Male");
-        emp.set("salary", 123456);
-
-        DynamicEntity address = helper.getType("Address").newDynamicEntity();
-        emp.set("address", address);
-
-        DynamicEntity phone = helper.getType("PhoneNumber").newDynamicEntity();
-        phone.set("type", "Mobile");
-        phone.set("areaCode", "613");
-        phone.set("number", "555-1212");
-        phone.set("owner", emp);
-        emp.<Collection<DynamicEntity>> get("phoneNumbers").add(phone);
-
-        em.getTransaction().begin();
-        // When merging the managed instance is returned from the call.
-        // Further usage within the transaction must be done with this managed
-        // entity.
-        emp = (DynamicEntity) em.merge(emp);
-        em.getTransaction().commit();
-
-        return emp;
-    }
-
-    /**
-     * 
-     * @param em
-     * @return
-     */
-    public DynamicEntity createWithRelationshipsToExistingEntities(EntityManager em) {
-        return null;
-    }
-
-    /**
-     * 
-     * @param em
-     */
-    public DynamicEntity deleteEntity(EntityManager em) {
-        return null;
-    }
-
-    /**
-     * Example of in-memory query against the transactional state without
-     * flushing it to the database.
-     * 
-     * @param em
-     */
-    public void queriesOnTransactionalState(EntityManager em) {
-        em.setFlushMode(FlushModeType.COMMIT);
-
-    }
-
-    /**
-     * 
-     * @param em
-     * @throws Exception
-     */
-    public void pessimisticLocking(EntityManager em) throws Exception {
-
-        // Find the Employee with the minimum ID
-        int minId = new Queries().minimumEmployeeId(em);
-
-        em.getTransaction().begin();
-
-        // Lock Employee using query with hint
-        DynamicEntity emp = (DynamicEntity) em.createQuery("SELECT e FROM Employee e WHERE e.id = :ID").setParameter("ID", minId).setHint(QueryHints.PESSIMISTIC_LOCK, PessimisticLock.Lock).getSingleResult();
-
-        emp.set("salary", emp.<Integer> get("salary") - 1);
-
-        em.flush();
-    }
-
-    /**
-     * This example illustrates the use of a query returning an entity and data
-     * from a related entity within a transaction. The returned entities are
-     * managed and thus any changes are reflected in the database upon flush.
-     * 
-     * @param em
-     * @throws Exception
-     */
-    @SuppressWarnings("unchecked")
-    public void updateEmployeeWithCity(EntityManager em) throws Exception {
-        em.getTransaction().begin();
-
-        List<Object[]> emps = em.createQuery("SELECT e, e.address.city FROM Employee e").getResultList();
-        DynamicEntity emp = (DynamicEntity) emps.get(0)[0];
-        emp.set("salary", emp.<Integer> get("salary") + 1);
-
-        em.flush();
-
-        em.getTransaction().rollback();
-    }
-
-}
diff --git a/jpars.script.clojure/src/main/java/example/data-services.clj b/jpars.script.clojure/src/main/java/example/data-services.clj
new file mode 100644
index 0000000..a4419bd
--- /dev/null
+++ b/jpars.script.clojure/src/main/java/example/data-services.clj
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *     dclarke - initial
+ ******************************************************************************/
+; data-services.clj
+(ns toplink)
+ 
+(defn create [name]
+  (str "Create: " name)
+)
+
+(defn addType [service name]
+)
\ No newline at end of file
diff --git a/jpars.script.clojure/src/main/java/example/example.clj b/jpars.script.clojure/src/main/java/example/example.clj
new file mode 100644
index 0000000..f0c93b5
--- /dev/null
+++ b/jpars.script.clojure/src/main/java/example/example.clj
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *     dclarke - initial
+ ******************************************************************************/
+; example.clj
+(ns example)
+ 
+(defn createService []
+  (str "Create: " name)
+)
+
diff --git a/jpars.script.clojure/src/main/webapp/index.jsp b/jpars.script.clojure/src/main/webapp/index.jsp
index 9ad4c73..6740b66 100644
--- a/jpars.script.clojure/src/main/webapp/index.jsp
+++ b/jpars.script.clojure/src/main/webapp/index.jsp
@@ -1,6 +1,6 @@
 <html>
 <body>
 <h2>EclipseLink JPA-RS: Clojure Scripting</h2>
-<%  %>
+<h3><%=example.DataService.create()%></h3>
 </body>
 </html>
diff --git a/jpars.script.clojure/src/test/java/test/TestDataService.java b/jpars.script.clojure/src/test/java/test/TestDataService.java
new file mode 100644
index 0000000..e8bc48f
--- /dev/null
+++ b/jpars.script.clojure/src/test/java/test/TestDataService.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
+ * which accompanies this distribution. 
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at 
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *     dclarke - initial
+ ******************************************************************************/
+package test;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import example.DataService;
+
+public class TestDataService {
+
+   @Test
+   public void create() throws IOException {
+       Object result = DataService.create();
+       System.out.println(result);
+   }
+}