You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2014/03/16 10:06:23 UTC

[34/50] [abbrv] git commit: [OLINGO-96] Maven Archetype for OData2 JPA Processor

[OLINGO-96] Maven Archetype for OData2 JPA Processor

Signed-off-by: Chandan V A <ch...@sap.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/78b09859
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/78b09859
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/78b09859

Branch: refs/heads/Olingo-129_PocJpaDataStore
Commit: 78b098597344405706d0eea9a25e4cbaff6a1d69
Parents: e2c9537
Author: Chandan V A <ch...@sap.com>
Authored: Mon Feb 24 13:03:32 2014 +0530
Committer: Chandan V A <ch...@sap.com>
Committed: Mon Feb 24 13:03:32 2014 +0530

----------------------------------------------------------------------
 odata2-sample/cars-jpa-archetype/pom.xml        |  74 +++++++++++
 .../META-INF/maven/archetype-metadata.xml       |  40 ++++++
 .../main/resources/archetype-resources/pom.xml  |  92 +++++++++++++
 .../src/main/java/model/Address.java            |  82 ++++++++++++
 .../src/main/java/model/Car.java                | 128 +++++++++++++++++++
 .../src/main/java/model/Driver.java             | 115 +++++++++++++++++
 .../src/main/java/model/Key.java                |  96 ++++++++++++++
 .../src/main/java/model/Manufacturer.java       | 112 ++++++++++++++++
 .../java/service/ODataJPACarServiceFactory.java |  91 +++++++++++++
 .../src/main/resources/META-INF/persistence.xml |  39 ++++++
 .../src/main/webapp/WEB-INF/web.xml             |  42 ++++++
 .../src/main/webapp/index.html                  |  89 +++++++++++++
 odata2-sample/pom.xml                           |   9 +-
 13 files changed, 1004 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78b09859/odata2-sample/cars-jpa-archetype/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-jpa-archetype/pom.xml b/odata2-sample/cars-jpa-archetype/pom.xml
new file mode 100644
index 0000000..a370a9f
--- /dev/null
+++ b/odata2-sample/cars-jpa-archetype/pom.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+         or more contributor license agreements.  See the NOTICE file
+         distributed with this work for additional information
+         regarding copyright ownership.  The ASF licenses this file
+         to you under the Apache License, Version 2.0 (the
+         "License"); you may not use this file except in compliance
+         with the License.  You may obtain a copy of the License at
+  
+           http://www.apache.org/licenses/LICENSE-2.0
+  
+         Unless required by applicable law or agreed to in writing,
+         software distributed under the License is distributed on an
+         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+         KIND, either express or implied.  See the License for the
+         specific language governing permissions and limitations
+         under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+	<parent>
+        <groupId>org.apache.olingo</groupId>
+        <artifactId>olingo-odata2-sample-incubating</artifactId>
+        <version>1.2.0-SNAPSHOT</version>
+        <relativePath>..</relativePath>
+    </parent>
+	
+    <artifactId>olingo-odata2-sample-cars-jpa-archetype-incubating</artifactId>
+    <name>${project.artifactId}</name>
+    <packaging>maven-archetype</packaging>
+    <build>
+        <extensions>
+            <extension>
+                <groupId>org.apache.maven.archetype</groupId>
+                <artifactId>archetype-packaging</artifactId>
+                <version>2.2</version>
+            </extension>
+        </extensions>
+
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-archetype-plugin</artifactId>
+                    <version>2.2</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-archetype-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>integration-test</id>
+                        <goals>
+                            <goal>integration-test</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-eclipse-plugin</artifactId>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78b09859/odata2-sample/cars-jpa-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-jpa-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/odata2-sample/cars-jpa-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..c7a1d29
--- /dev/null
+++ b/odata2-sample/cars-jpa-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file 
+    distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under 
+    the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may 
+    obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to 
+    in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 
+    ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under 
+    the License. -->
+<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="olingo-odata2-sample-cars-service-incubating"
+    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/webapp</directory>
+      <includes>
+        <include>**/*.xml</include>
+        <include>**/*.html</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.xml</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.classpath</include>
+        <include>.project</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78b09859/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/pom.xml b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..e4b1d33
--- /dev/null
+++ b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,92 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+	license agreements. See the NOTICE file distributed with this work for additional 
+	information regarding copyright ownership. The ASF licenses this file to 
+	you under the Apache License, Version 2.0 (the "License"); you may not use 
+	this file except in compliance with the License. You may obtain a copy of 
+	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+	by applicable law or agreed to in writing, software distributed under the 
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+	OF ANY KIND, either express or implied. See the License for the specific 
+	language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>${groupId}</groupId>
+	<artifactId>${artifactId}</artifactId>
+	<packaging>war</packaging>
+	<version>${version}</version>
+	<name>${project.artifactId}</name>
+
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<version.cxf>2.7.6</version.cxf>
+		<version.olingo>1.2.0-SNAPSHOT</version.olingo>
+		<version.eclipselink>2.5.1</version.eclipselink>
+		<version.javax.persistence>2.0.5</version.javax.persistence>
+	</properties>
+
+	<dependencies>
+
+		<!-- OData Annotation Support -->
+		<dependency>
+			<groupId>org.apache.olingo</groupId>
+			<artifactId>olingo-odata2-api-annotation-incubating</artifactId>
+			<version>${version.olingo}</version>
+		</dependency>
+
+		<!--OData Core Support -->
+		<dependency>
+			<groupId>org.apache.olingo</groupId>
+			<artifactId>olingo-odata2-api-incubating</artifactId>
+			<version>${version.olingo}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.olingo</groupId>
+			<artifactId>olingo-odata2-core-incubating</artifactId>
+			<version>${version.olingo}</version>
+		</dependency>
+
+		<!--OData JPA Processor Support -->
+		<dependency>
+			<groupId>org.apache.olingo</groupId>
+			<artifactId>olingo-odata2-jpa-processor-api-incubating</artifactId>
+			<version>${version.olingo}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.olingo</groupId>
+			<artifactId>olingo-odata2-jpa-processor-core-incubating</artifactId>
+			<version>${version.olingo}</version>
+		</dependency>
+
+		<!-- JPA Support -->
+		<dependency>
+			<groupId>org.eclipse.persistence</groupId>
+			<artifactId>eclipselink</artifactId>
+			<version>${version.eclipselink}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.persistence</groupId>
+			<artifactId>javax.persistence</artifactId>
+			<version>${version.javax.persistence}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.hsqldb</groupId>
+			<artifactId>hsqldb</artifactId>
+			<version>1.8.0.10</version>
+		</dependency>
+
+		<!-- Web Support -->
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>servlet-api</artifactId>
+			<version>2.5</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.cxf</groupId>
+			<artifactId>cxf-rt-frontend-jaxrs</artifactId>
+			<version>${version.cxf}</version>
+		</dependency>
+
+	</dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78b09859/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Address.java
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Address.java b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Address.java
new file mode 100644
index 0000000..f4dd85f
--- /dev/null
+++ b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Address.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.model;
+
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+
+@Embeddable
+public class Address {
+
+	@Column(name = "STREET")
+	private String street;
+	@Column(name = "CITY")
+	private String city;
+	@Column(name = "ZIPCODE")
+	private String zipCode;
+	@Column(name = "COUNTRY")
+	private String country;
+
+	public Address() {
+
+	}
+
+	public Address(String street, String city, String zipcode, String country) {
+		this.street = street;
+		this.city = city;
+		this.zipCode = zipcode;
+		this.country = country;
+	}
+
+	public String getStreet() {
+		return street;
+	}
+
+	public void setStreet(String street) {
+		this.street = street;
+	}
+
+	public String getCity() {
+		return city;
+	}
+
+	public void setCity(String city) {
+		this.city = city;
+	}
+
+	public String getZipCode() {
+		return zipCode;
+	}
+
+	public void setZipCode(String zipCode) {
+		this.zipCode = zipCode;
+	}
+
+	public String getCountry() {
+		return country;
+	}
+
+	public void setCountry(String country) {
+		this.country = country;
+	}
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78b09859/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Car.java
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Car.java b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Car.java
new file mode 100644
index 0000000..11cad17
--- /dev/null
+++ b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Car.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.model;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity(name = "Car")
+public class Car {
+
+	@EmbeddedId
+	private Key key;
+
+	@Column
+	private String model;
+	@Column
+	private Double price;
+	@Column
+	private Integer modelYear;
+	@Temporal(TemporalType.DATE)
+	private Date updated;
+
+	public Car() {
+
+	}
+
+	public Car(Key key, String model, Double price, Integer modelYear,
+			Date updated, Manufacturer manufacturer, Driver driver) {
+		super();
+		this.key = key;
+		this.model = model;
+		this.price = price;
+		this.modelYear = modelYear;
+		this.updated = updated;
+		this.manufacturer = manufacturer;
+		this.driver = driver;
+	}
+
+	@ManyToOne
+	@JoinColumn(name = "MID", referencedColumnName = "ID")
+	private Manufacturer manufacturer;
+
+	@OneToOne
+	private Driver driver;
+
+	public Key getKey() {
+		return key;
+	}
+
+	public void setKey(Key id) {
+		this.key = id;
+	}
+
+	public String getModel() {
+		return model;
+	}
+
+	public void setModel(String model) {
+		this.model = model;
+	}
+
+	public Manufacturer getManufacturer() {
+		return manufacturer;
+	}
+
+	public void setManufacturer(Manufacturer manufacturer) {
+		this.manufacturer = manufacturer;
+	}
+
+	public double getPrice() {
+		return price;
+	}
+
+	public void setPrice(double price) {
+		this.price = price;
+	}
+
+	public int getModelYear() {
+		return modelYear;
+	}
+
+	public void setModelYear(int modelYear) {
+		this.modelYear = modelYear;
+	}
+
+	public Date getUpdated() {
+		return updated;
+	}
+
+	public void setUpdated(Date updated) {
+		this.updated = updated;
+	}
+
+	public Driver getDriver() {
+		return driver;
+	}
+
+	public void setDriver(Driver driver) {
+		this.driver = driver;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78b09859/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Driver.java
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Driver.java b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Driver.java
new file mode 100644
index 0000000..62fd6b9
--- /dev/null
+++ b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Driver.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.model;
+
+import java.util.Calendar;
+
+import javax.persistence.Column;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity(name = "Driver")
+public class Driver {
+
+	@Id
+	private Long id;
+
+	@Column
+	private String name;
+	@Column
+	private String lastname;
+	@Column
+	private String nickname;
+
+	@OneToOne(mappedBy = "driver", cascade = CascadeType.ALL)
+	private Car car;
+
+	@Temporal(TemporalType.DATE)
+	private Calendar birthday;
+
+	public Driver() {
+
+	}
+
+	public Driver(Long id, String name, String lastname, String nickname,
+			Car car, Calendar birthday) {
+		super();
+		this.id = id;
+		this.name = name;
+		this.lastname = lastname;
+		this.nickname = nickname;
+		this.car = car;
+		this.birthday = birthday;
+	}
+
+	public Long getId() {
+		return id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getLastname() {
+		return lastname;
+	}
+
+	public void setLastname(String lastname) {
+		this.lastname = lastname;
+	}
+
+	public String getNickname() {
+		return nickname;
+	}
+
+	public void setNickname(String nickname) {
+		this.nickname = nickname;
+	}
+
+	public Car getCar() {
+		return car;
+	}
+
+	public void setCar(Car car) {
+		this.car = car;
+	}
+
+	public Calendar getUpdated() {
+		return birthday;
+	}
+
+	public void setBirthday(Calendar birthday) {
+		this.birthday = birthday;
+	}
+
+	public Calendar getBirthday() {
+		return this.birthday;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78b09859/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Key.java
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Key.java b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Key.java
new file mode 100644
index 0000000..8b93c20
--- /dev/null
+++ b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Key.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.model;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+
+@Embeddable
+public class Key implements Serializable {
+
+	private static final long serialVersionUID = -623040896539742071L;
+
+	@Column(name = "ID")
+	private int id;
+
+	@Column(name = "IDL")
+	private long idL;
+
+	public Key() {
+
+	}
+
+	public Key(int id, long idL) {
+		super();
+		this.id = id;
+		this.idL = idL;
+	}
+
+	public int getId() {
+		return id;
+	}
+
+	public void setId(int id) {
+		this.id = id;
+	}
+
+	public long getIdL() {
+		return idL;
+	}
+
+	public void setIdL(long idL) {
+		this.idL = idL;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + (int) (id ^ (id >>> 32));
+		result = prime * result + (int) (idL ^ (idL >>> 32));
+		return result;
+	}
+
+	@Override
+	public boolean equals(final Object obj) {
+		if (this == obj) {
+			return true;
+		}
+		if (obj == null) {
+			return false;
+		}
+		if (getClass() != obj.getClass()) {
+			return false;
+		}
+		Key other = (Key) obj;
+		if (id != other.id) {
+			return false;
+		}
+		if (idL != other.idL) {
+			return false;
+		}
+		return true;
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78b09859/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Manufacturer.java
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Manufacturer.java b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Manufacturer.java
new file mode 100644
index 0000000..36d4865
--- /dev/null
+++ b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/model/Manufacturer.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.model;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/**
+ *
+ */
+
+@Entity(name = "Manufacturer")
+public class Manufacturer {
+
+	@Id
+	@Column(name = "ID")
+	private int id;
+
+	@Column
+	private String name;
+	@Temporal(TemporalType.DATE)
+	private Calendar founded;
+	@Embedded
+	private Address address;
+
+	public Manufacturer() {
+
+	}
+
+	public Manufacturer(int id, String name, Calendar founded, Address address,
+			List<Car> cars) {
+		super();
+		this.id = id;
+		this.name = name;
+		this.founded = founded;
+		this.address = address;
+		this.cars = cars;
+	}
+
+	@OneToMany(mappedBy = "manufacturer", cascade = CascadeType.ALL)
+	private List<Car> cars = new ArrayList<Car>();
+
+	public int getId() {
+		return id;
+	}
+
+	public void setId(int id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Calendar getFounded() {
+		return founded;
+	}
+
+	public void setFounded(Calendar updated) {
+		this.founded = updated;
+	}
+
+	public Address getAddress() {
+		return address;
+	}
+
+	public void setAddress(Address address) {
+		this.address = address;
+	}
+
+	public List<Car> getCars() {
+		return cars;
+	}
+
+	public void setCars(List<Car> cars) {
+		this.cars = cars;
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78b09859/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/service/ODataJPACarServiceFactory.java
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/service/ODataJPACarServiceFactory.java b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/service/ODataJPACarServiceFactory.java
new file mode 100644
index 0000000..bdd153c
--- /dev/null
+++ b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/java/service/ODataJPACarServiceFactory.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.service;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Persistence;
+
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPAServiceFactory;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+
+import ${package}.model.Address;
+import ${package}.model.Car;
+import ${package}.model.Driver;
+import ${package}.model.Key;
+import ${package}.model.Manufacturer;
+
+public class ODataJPACarServiceFactory extends ODataJPAServiceFactory {
+
+	private static final String PUNIT_NAME = "MyFormula";
+	private static final int PAGE_SIZE = 5;
+
+	/** Load Sample Data **/
+	static {
+
+		List<Car> cars = new ArrayList<Car>();
+		Calendar mfDate = Calendar.getInstance();
+		mfDate.set(2013, 02, 01);
+		Address address = new Address("S1", "C1", "Z1", "CN");
+
+		Manufacturer mf = new Manufacturer(1, "SuperCar", mfDate, address, cars);
+
+		Calendar bDate = Calendar.getInstance();
+		mfDate.set(1980, 02, 19);
+		Driver driver = new Driver(1L, "Speeder", "Super", "Bolt", null, bDate);
+
+		Key key = new Key(1, 2);
+		Calendar carDate = Calendar.getInstance();
+		carDate.set(2014, 02, 20);
+		Car car = new Car(key, "M1", 20000.0, 2014, carDate.getTime(), mf,
+				driver);
+		cars.add(car);
+		driver.setCar(car);
+
+		EntityManager em = Persistence.createEntityManagerFactory(PUNIT_NAME)
+				.createEntityManager();
+		em.getTransaction().begin();
+		em.persist(mf);
+		em.persist(driver);
+		em.persist(car);
+		em.getTransaction().commit();
+
+	}
+
+	@Override
+	public ODataJPAContext initializeODataJPAContext()
+			throws ODataJPARuntimeException {
+		ODataJPAContext oDataJPAContext = getODataJPAContext();
+		oDataJPAContext.setEntityManagerFactory(Persistence
+				.createEntityManagerFactory(PUNIT_NAME));
+		oDataJPAContext.setPersistenceUnitName(PUNIT_NAME);
+
+		oDataJPAContext.setPageSize(PAGE_SIZE);
+		setDetailErrors(true);
+
+		return oDataJPAContext;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78b09859/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..dd20900
--- /dev/null
+++ b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,39 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+	license agreements. See the NOTICE file distributed with this work for additional 
+	information regarding copyright ownership. The ASF licenses this file to 
+	you under the Apache License, Version 2.0 (the "License"); you may not use 
+	this file except in compliance with the License. You may obtain a copy of 
+	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+	by applicable law or agreed to in writing, software distributed under the 
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+	OF ANY KIND, either express or implied. See the License for the specific 
+	language governing permissions and limitations under the License. -->
+<persistence version="2.0"
+	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+	<persistence-unit name="MyFormula"
+		transaction-type="RESOURCE_LOCAL">
+		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+		<class>${package}.model.Driver</class>
+		<class>${package}.model.Car</class>
+		<class>${package}.model.Manufacturer</class>
+		<properties>
+			<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" />
+			<property name="javax.persistence.jdbc.url"
+				value="jdbc:hsqldb:mem:org.apache.olingo.jpa.sample" />
+			<property name="javax.persistence.jdbc.user" value="sa" />
+			<property name="javax.persistence.jdbc.password" value="" />
+			<property name="eclipselink.target-database"
+				value="org.eclipse.persistence.platform.database.HSQLPlatform" />
+			<property name="eclipselink.logging.level" value="ALL" />
+			<property name="eclipselink.orm.throw.exceptions" value="true" />
+			<property name="eclipselink.ddl-generation" value="create-tables" />
+			<property name="eclipselink.ddl-generation.output-mode"
+				value="database" />
+		</properties>
+	</persistence-unit>
+</persistence>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78b09859/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..908ecc0
--- /dev/null
+++ b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,42 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+	license agreements. See the NOTICE file distributed with this work for additional 
+	information regarding copyright ownership. The ASF licenses this file to 
+	you under the Apache License, Version 2.0 (the "License"); you may not use 
+	this file except in compliance with the License. You may obtain a copy of 
+	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+	by applicable law or agreed to in writing, software distributed under the 
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+	OF ANY KIND, either express or implied. See the License for the specific 
+	language governing permissions and limitations under the License. -->
+
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	id="WebApp_ID" version="2.5">
+	<display-name>OData - JPA Reference</display-name>
+	<welcome-file-list>
+		<welcome-file>index.html</welcome-file>
+	</welcome-file-list>
+
+	<servlet>
+		<servlet-name>CarServiceServlet</servlet-name>
+		<servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
+		<init-param>
+			<param-name>javax.ws.rs.Application</param-name>
+			<param-value>org.apache.olingo.odata2.core.rest.app.ODataApplication</param-value>
+		</init-param>
+		<init-param>
+			<param-name>org.apache.olingo.odata2.service.factory</param-name>
+			<param-value>${package}.service.ODataJPACarServiceFactory</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>CarServiceServlet</servlet-name>
+		<url-pattern>/MyFormula.svc/*</url-pattern>
+	</servlet-mapping>
+</web-app>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78b09859/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/index.html b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/index.html
new file mode 100644
index 0000000..40076bc
--- /dev/null
+++ b/odata2-sample/cars-jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/index.html
@@ -0,0 +1,89 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Apache Olingo - OData2 Library</title>
+<style type="text/css">
+body { font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;
+       color: blue; background-color: #ffffff; }
+a { color: blue; text-decoration: none; }
+a:focus { outline: thin dotted #4076cb; outline-offset: -1px; }
+a:hover, a:active { outline: 0; }
+a:hover { color: #404a7e; text-decoration: underline; }
+h1, h2, h3, h4, h5, h6 { margin: 9px 0; font-family: inherit; font-weight: bold;
+                         line-height: 1; color: blue; }
+h1 { font-size: 36px; line-height: 40px; }
+h2 { font-size: 30px; line-height: 40px; }
+h3 { font-size: 24px; line-height: 40px; }
+h4 { font-size: 18px; line-height: 20px; }
+h5 { font-size: 14px; line-height: 20px; }
+h6 { font-size: 12px; line-height: 20px; }
+.logo { float: right; }
+ul { padding: 0; margin: 0 0 9px 25px; }
+ul ul { margin-bottom: 0; }
+li { line-height: 18px; }
+hr { margin: 18px 0;
+     border: 0; border-top: 1px solid #cccccc; border-bottom: 1px solid #ffffff; }
+table { border-collapse: collapse; border-spacing: 10px; }
+th, td { border: 1px solid; padding: 20px; }
+.code { font-family: "Courier New", monospace; font-size: 13px; line-height: 18px; }
+</style>
+</head>
+<body>
+    <h1>Apache Olingo - OData2 Library</h1>
+    <hr />
+    <h2>Cars OData JPA Service</h2>
+    <table>
+        <tr>
+            <td valign="top">
+                <h3>Service Document and Metadata</h3>
+                <ul>
+                    <li><a href="MyFormula.svc?_wadl" target="_blank">wadl</a></li>
+                    <li><a href="MyFormula.svc/" target="_blank">service document</a></li>
+                    <li><a href="MyFormula.svc/$metadata" target="_blank">metadata</a></li>
+                </ul>
+                <h3>EntitySets</h3>
+                <ul>
+                    <li><a href="MyFormula.svc/Manufacturers" target="_blank">Manufacturers</a></li>
+                    <li><a href="MyFormula.svc/Manufacturers?$expand=CarDetails" target="_blank">Manufacturers?$expand=CarDetails</a></li>
+                    <li><a href="MyFormula.svc/Cars" target="_blank">Cars</a></li>
+                    <li><a href="MyFormula.svc/Cars?$expand=DriverDetails" target="_blank">Cars?$expand=DriverDetails</a></li>
+                    <li><a href="MyFormula.svc/Drivers" target="_blank">Drivers</a></li>
+                    <li><a href="MyFormula.svc/Drivers?$expand=CarDetails" target="_blank">Drivers/$expand=CarDetails</a></li>
+                    <li><a href="MyFormula.svc/Drivers/?$orderby=Lastname" target="_blank">Drivers?$orderby=Lastname</a></li>
+                </ul>
+                <h3>Entities</h3>
+                <ul>
+                    <li><a href="MyFormula.svc/Manufacturers(1)" target="_blank">Manufacturers(1)</a></li>
+                    <li><a href="MyFormula.svc/Manufacturers(1)/CarDetails" target="_blank">Manufacturers(1)/CarDetails</a></li>
+                    <li><a href="MyFormula.svc/Cars(Id=1,IdL=2)" target="_blank">Cars(Id=1,IdL=2)</a></li>
+                    <li><a href="MyFormula.svc/Cars(Id=1,IdL=2)/DriverDetails" target="_blank">Cars(Id=1,IdL=2)/DriverDetails</a></li>
+                    <li><a href="MyFormula.svc/Cars(Id=1,IdL=2)?$expand=ManufacturerDetails" target="_blank">Cars(Id=1,IdL=2)?$expand=ManufacturerDetails</a></li>
+                    <li><a href="MyFormula.svc/Drivers(1)" target="_blank">Drivers(1)</a></li>
+                    <li><a href="MyFormula.svc/Drivers(1)/CarDetails" target="_blank">Drivers(1)/CarDetails</a></li>
+                </ul>
+            </td>
+        </tr>
+    </table>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78b09859/odata2-sample/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/pom.xml b/odata2-sample/pom.xml
index 82a897c..a8432e0 100644
--- a/odata2-sample/pom.xml
+++ b/odata2-sample/pom.xml
@@ -5,9 +5,7 @@
     obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to 
     in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 
     ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under 
-    the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    the License. --><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>olingo-odata2-sample-incubating</artifactId>
@@ -24,5 +22,6 @@
     <modules>
         <module>cars-service-archetype</module>
         <module>cars-annotation-archetype</module>
-    </modules>
-</project>
+		<module>cars-jpa-archetype</module>
+  </modules>
+</project>
\ No newline at end of file