Repository: olingo-odata2
Updated Branches:
  refs/heads/master 751e316da -> 7aac7976b


[OLINGO-605] Optional xml adapter for properties


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

Branch: refs/heads/master
Commit: 7aac7976b3d576f3f24c8c0f4d75e0c7b1e96f95
Parents: 751e316
Author: mibo <[email protected]>
Authored: Mon Oct 2 15:25:51 2017 +0200
Committer: mibo <[email protected]>
Committed: Mon Oct 2 15:32:45 2017 +0200

----------------------------------------------------------------------
 .../api/jpql/JPQLSelectContextView.java         |  11 +-
 .../processor/core/access/data/JPAEntity.java   |  16 +
 .../core/access/model/JPATypeConverter.java     | 173 ++++++++++
 .../core/access/model/JPATypeConvertor.java     | 137 --------
 .../core/model/JPAEdmFunctionImport.java        |   6 +-
 .../processor/core/model/JPAEdmProperty.java    |   4 +-
 .../core/access/data/JPAEntityTest.java         |  23 ++
 .../core/access/model/JPATypeConverterTest.java | 332 +++++++++++++++++++
 .../core/access/model/JPATypeConvertorTest.java | 301 -----------------
 .../core/jpql/JPQLJoinStatementBuilderTest.java |   2 +-
 .../processor/core/mock/data/EdmMockUtilV2.java |  13 +
 .../data/EntityWithXmlAdapterOnProperty.java    |  16 +
 .../processor/core/mock/data/JPATypeMock.java   |  16 +-
 .../core/mock/data/ODataEntryMockUtil.java      |   2 +
 .../processor/core/mock/data/XmlAdapter.java    |  16 +
 15 files changed, 622 insertions(+), 446 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/jpql/JPQLSelectContextView.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/jpql/JPQLSelectContextView.java
 
b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/jpql/JPQLSelectContextView.java
index fc41411..2fcc897 100644
--- 
a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/jpql/JPQLSelectContextView.java
+++ 
b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/jpql/JPQLSelectContextView.java
@@ -41,7 +41,16 @@ public interface JPQLSelectContextView extends 
JPQLContextView {
   /**
    * The method returns an JPQL ORDERBY clause. The ORDERBY clause
    * is built from $orderby OData system query option. The hash map contains
-   * @return an order by expression (JPA Property Name,Sort Order)
+   * <ol>
+   * <li>Key - JPA Entity Property name to be ordered</li>
+   * <li>Value - Sort Order in JPQL (desc,asc)</li>
+   * </ol>
+   * in the order based on the expression specified
+   * (accessible with <code>Map.entrySet(..)</code>).
+   * 
+   * https://issues.apache.org/jira/browse/OLINGO-606
+   * 
+   * @return an ordered map of (JPA Property Name,Sort Order)
    */
   public String getOrderByCollection();
 

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
 
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
index d3fd2da..d278e4c 100644
--- 
a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
+++ 
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
@@ -33,6 +33,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.edm.EdmEntityType;
 import org.apache.olingo.odata2.api.edm.EdmException;
@@ -505,6 +508,19 @@ public class JPAEntity {
           Enum e = entityPropertyValue != null ?
               Enum.valueOf((Class<Enum>) parameterType, (String) 
entityPropertyValue) : null;
           method.invoke(entity, e);
+        } else {
+          String setterName = method.getName();
+         String getterName = setterName.replace("set", "get");
+         try {
+            Method getMethod = entity.getClass().getDeclaredMethod(getterName);
+            if(getMethod.isAnnotationPresent(XmlJavaTypeAdapter.class)) {
+              XmlAdapter xmlAdapter = 
getMethod.getAnnotation(XmlJavaTypeAdapter.class)
+                  .value().newInstance();
+              method.invoke(entity, xmlAdapter.unmarshal(entityPropertyValue));
+            }
+          } catch (Exception e) {
+            throw 
ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL, e);
+         }
         }
       } else if (parameterType.equals(Blob.class)) {
         if (onJPAWriteContent == null) {

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConverter.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConverter.java
 
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConverter.java
new file mode 100644
index 0000000..ec3b493
--- /dev/null
+++ 
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConverter.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * 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.
+ 
******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.core.access.model;
+
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.math.BigDecimal;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.UUID;
+
+import javax.persistence.Lob;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.metamodel.Attribute;
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
+import 
org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
+
+/**
+ * This class holds utility methods for Type conversions between JPA and OData 
Types.
+ * 
+ * 
+ * 
+ */
+public class JPATypeConverter {
+
+  /**
+   * This utility method converts a given jpa Type to equivalent
+   * EdmSimpleTypeKind for maintaining compatibility between Java and OData
+   * Types.
+   * 
+   * @param jpaType
+   * The JPA Type input.
+   * @return The corresponding EdmSimpleTypeKind.
+   * @throws ODataJPAModelException
+   * @throws 
org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException
+   * 
+   * @see EdmSimpleTypeKind
+   */
+
+  public static EdmSimpleTypeKind
+      convertToEdmSimpleType(final Class<?> jpaType, final Attribute<?, ?> 
currentAttribute)
+          throws ODataJPAModelException {
+    if (jpaType.equals(String.class) || jpaType.equals(Character.class) || 
jpaType.equals(char.class)
+        || jpaType.equals(char[].class) ||
+        jpaType.equals(Character[].class)) {
+      return EdmSimpleTypeKind.String;
+    } else if (jpaType.equals(Long.class) || jpaType.equals(long.class)) {
+      return EdmSimpleTypeKind.Int64;
+    } else if (jpaType.equals(Short.class) || jpaType.equals(short.class)) {
+      return EdmSimpleTypeKind.Int16;
+    } else if (jpaType.equals(Integer.class) || jpaType.equals(int.class)) {
+      return EdmSimpleTypeKind.Int32;
+    } else if (jpaType.equals(Double.class) || jpaType.equals(double.class)) {
+      return EdmSimpleTypeKind.Double;
+    } else if (jpaType.equals(Float.class) || jpaType.equals(float.class)) {
+      return EdmSimpleTypeKind.Single;
+    } else if (jpaType.equals(BigDecimal.class)) {
+      return EdmSimpleTypeKind.Decimal;
+    } else if (jpaType.equals(byte[].class)) {
+      return EdmSimpleTypeKind.Binary;
+    } else if (jpaType.equals(Byte.class) || jpaType.equals(byte.class)) {
+      return EdmSimpleTypeKind.Byte;
+    } else if (jpaType.equals(Boolean.class) || jpaType.equals(boolean.class)) 
{
+      return EdmSimpleTypeKind.Boolean;
+    } else if (jpaType.equals(java.sql.Time.class)) {
+      return EdmSimpleTypeKind.Time;
+    } else if (jpaType.equals(Date.class) || jpaType.equals(Calendar.class) ||
+        jpaType.equals(Timestamp.class) || 
jpaType.equals(java.util.Date.class)) {
+      try {
+        if ((currentAttribute != null)
+            && (determineTemporalType(currentAttribute)
+              == TemporalType.TIME)) {
+          return EdmSimpleTypeKind.Time;
+        } else {
+          return EdmSimpleTypeKind.DateTime;
+        }
+      } catch (SecurityException e) {
+        throw 
ODataJPAModelException.throwException(ODataJPAModelException.GENERAL.addContent(e.getMessage()),
 e);
+      }
+    } else if (jpaType.equals(UUID.class)) {
+      return EdmSimpleTypeKind.Guid;
+    } else if (jpaType.equals(Byte[].class)) {
+      return EdmSimpleTypeKind.Binary;
+    } else if (jpaType.equals(Blob.class) && isBlob(currentAttribute)) {
+      return EdmSimpleTypeKind.Binary;
+    } else if (jpaType.equals(Clob.class) && isBlob(currentAttribute)) {
+      return EdmSimpleTypeKind.String;
+    } else if (jpaType.isEnum()) {
+      return EdmSimpleTypeKind.String;
+    } else {
+        // https://issues.apache.org/jira/browse/OLINGO-605
+       // if we cannot find a generic JPA type we try to use the 
XmlJavaTypeAdapter
+       // to find a property that we can serialize
+       if(currentAttribute == null) {
+               throw 
ODataJPAModelException.throwException(ODataJPAModelException.TYPE_NOT_SUPPORTED
+                               .addContent(jpaType.toString()), null);
+       }
+           String propertyName = currentAttribute.getName();
+           if(propertyName == null) {
+               throw 
ODataJPAModelException.throwException(ODataJPAModelException.TYPE_NOT_SUPPORTED
+                               .addContent(jpaType.toString()), null);
+           }
+           String getterName = "get"+propertyName.substring(0, 
1).toUpperCase() + propertyName.substring(1);
+           try {
+        Method method = 
currentAttribute.getDeclaringType().getJavaType().getMethod(getterName);
+        XmlJavaTypeAdapter xmlAdapterAnnotation = 
method.getAnnotation(XmlJavaTypeAdapter.class);
+        if(xmlAdapterAnnotation == null) {
+          throw 
ODataJPAModelException.throwException(ODataJPAModelException.TYPE_NOT_SUPPORTED
+                  .addContent(jpaType.toString()), null);
+                       }
+                       @SuppressWarnings("unchecked")
+                       Class<XmlAdapter<?,?>> xmlAdapterClass = 
(Class<XmlAdapter<?, ?>>) xmlAdapterAnnotation.value();
+                       
+                       ParameterizedType genericSuperClass =
+          (ParameterizedType) xmlAdapterClass.getGenericSuperclass();
+                       Class<?> converterTargetType = (Class<?>) 
genericSuperClass.getActualTypeArguments()[0];
+                       return convertToEdmSimpleType(converterTargetType, 
currentAttribute);
+               } catch (NoSuchMethodException e) {
+                       throw ODataJPAModelException.throwException(
+                           
ODataJPAModelException.GENERAL.addContent(e.getMessage()), e);
+               } catch (SecurityException e) {
+                       throw ODataJPAModelException.throwException(
+                           
ODataJPAModelException.GENERAL.addContent(e.getMessage()), e);
+               }
+    }
+  }
+
+  private static boolean isBlob(final Attribute<?, ?> currentAttribute) {
+    if (currentAttribute != null) {
+      AnnotatedElement annotatedElement = (AnnotatedElement) 
currentAttribute.getJavaMember();
+      if (annotatedElement != null && 
annotatedElement.getAnnotation(Lob.class) != null) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  private static TemporalType determineTemporalType(final Attribute<?, ?> 
currentAttribute)
+      throws ODataJPAModelException {
+    if (currentAttribute != null) {
+      AnnotatedElement annotatedElement = (AnnotatedElement) 
currentAttribute.getJavaMember();
+      if (annotatedElement != null && 
annotatedElement.getAnnotation(Temporal.class) != null) {
+        return annotatedElement.getAnnotation(Temporal.class).value();
+      }
+    }
+    return null;
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertor.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertor.java
 
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertor.java
deleted file mode 100644
index af8508f..0000000
--- 
a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertor.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * 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.
- 
******************************************************************************/
-package org.apache.olingo.odata2.jpa.processor.core.access.model;
-
-import java.lang.reflect.AnnotatedElement;
-import java.math.BigDecimal;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Date;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.UUID;
-
-import javax.persistence.Lob;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.metamodel.Attribute;
-
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import 
org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
-
-/**
- * This class holds utility methods for Type conversions between JPA and OData 
Types.
- * 
- * 
- * 
- */
-public class JPATypeConvertor {
-
-  /**
-   * This utility method converts a given jpa Type to equivalent
-   * EdmSimpleTypeKind for maintaining compatibility between Java and OData
-   * Types.
-   * 
-   * @param jpaType
-   * The JPA Type input.
-   * @return The corresponding EdmSimpleTypeKind.
-   * @throws ODataJPAModelException
-   * @throws 
org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException
-   * 
-   * @see EdmSimpleTypeKind
-   */
-
-  public static EdmSimpleTypeKind
-      convertToEdmSimpleType(final Class<?> jpaType, final Attribute<?, ?> 
currentAttribute)
-          throws ODataJPAModelException {
-    if (jpaType.equals(String.class) || jpaType.equals(Character.class) || 
jpaType.equals(char.class)
-        || jpaType.equals(char[].class) ||
-        jpaType.equals(Character[].class)) {
-      return EdmSimpleTypeKind.String;
-    } else if (jpaType.equals(Long.class) || jpaType.equals(long.class)) {
-      return EdmSimpleTypeKind.Int64;
-    } else if (jpaType.equals(Short.class) || jpaType.equals(short.class)) {
-      return EdmSimpleTypeKind.Int16;
-    } else if (jpaType.equals(Integer.class) || jpaType.equals(int.class)) {
-      return EdmSimpleTypeKind.Int32;
-    } else if (jpaType.equals(Double.class) || jpaType.equals(double.class)) {
-      return EdmSimpleTypeKind.Double;
-    } else if (jpaType.equals(Float.class) || jpaType.equals(float.class)) {
-      return EdmSimpleTypeKind.Single;
-    } else if (jpaType.equals(BigDecimal.class)) {
-      return EdmSimpleTypeKind.Decimal;
-    } else if (jpaType.equals(byte[].class)) {
-      return EdmSimpleTypeKind.Binary;
-    } else if (jpaType.equals(Byte.class) || jpaType.equals(byte.class)) {
-      return EdmSimpleTypeKind.Byte;
-    } else if (jpaType.equals(Boolean.class) || jpaType.equals(boolean.class)) 
{
-      return EdmSimpleTypeKind.Boolean;
-    } else if (jpaType.equals(java.sql.Time.class)) {
-      return EdmSimpleTypeKind.Time;
-    } else if (jpaType.equals(Date.class) || jpaType.equals(Calendar.class) ||
-        jpaType.equals(Timestamp.class) || 
jpaType.equals(java.util.Date.class)) {
-      try {
-        if ((currentAttribute != null)
-            && (determineTemporalType(currentAttribute)
-              == TemporalType.TIME)) {
-          return EdmSimpleTypeKind.Time;
-        } else {
-          return EdmSimpleTypeKind.DateTime;
-        }
-      } catch (SecurityException e) {
-        throw 
ODataJPAModelException.throwException(ODataJPAModelException.GENERAL.addContent(e.getMessage()),
 e);
-      }
-    } else if (jpaType.equals(UUID.class)) {
-      return EdmSimpleTypeKind.Guid;
-    } else if (jpaType.equals(Byte[].class)) {
-      return EdmSimpleTypeKind.Binary;
-    } else if (jpaType.equals(Blob.class) && isBlob(currentAttribute)) {
-      return EdmSimpleTypeKind.Binary;
-    } else if (jpaType.equals(Clob.class) && isBlob(currentAttribute)) {
-      return EdmSimpleTypeKind.String;
-    } else if (jpaType.isEnum()) {
-      return EdmSimpleTypeKind.String;
-    }
-
-    throw 
ODataJPAModelException.throwException(ODataJPAModelException.TYPE_NOT_SUPPORTED
-        .addContent(jpaType.toString()), null);
-  }
-
-  private static boolean isBlob(final Attribute<?, ?> currentAttribute) {
-    if (currentAttribute != null) {
-      AnnotatedElement annotatedElement = (AnnotatedElement) 
currentAttribute.getJavaMember();
-      if (annotatedElement != null && 
annotatedElement.getAnnotation(Lob.class) != null) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  private static TemporalType determineTemporalType(final Attribute<?, ?> 
currentAttribute)
-      throws ODataJPAModelException {
-    if (currentAttribute != null) {
-      AnnotatedElement annotatedElement = (AnnotatedElement) 
currentAttribute.getJavaMember();
-      if (annotatedElement != null && 
annotatedElement.getAnnotation(Temporal.class) != null) {
-        return annotatedElement.getAnnotation(Temporal.class).value();
-      }
-    }
-    return null;
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImport.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImport.java
 
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImport.java
index 60baa9d..e041c28 100644
--- 
a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImport.java
+++ 
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImport.java
@@ -46,7 +46,7 @@ import 
org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmFunctionImportView
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmSchemaView;
 import 
org.apache.olingo.odata2.jpa.processor.core.access.model.JPAEdmNameBuilder;
-import 
org.apache.olingo.odata2.jpa.processor.core.access.model.JPATypeConvertor;
+import 
org.apache.olingo.odata2.jpa.processor.core.access.model.JPATypeConverter;
 
 public class JPAEdmFunctionImport extends JPAEdmBaseViewImpl implements 
JPAEdmFunctionImportView {
 
@@ -193,7 +193,7 @@ public class JPAEdmFunctionImport extends 
JPAEdmBaseViewImpl implements JPAEdmFu
               functionImportParameter.setName(annotation.name());
             }
 
-            
functionImportParameter.setType(JPATypeConvertor.convertToEdmSimpleType(parameterType,
 null));
+            
functionImportParameter.setType(JPATypeConverter.convertToEdmSimpleType(parameterType,
 null));
 
             Facets facets = new Facets();
             if (annotation.facets().maxLength() > 0) {
@@ -268,7 +268,7 @@ public class JPAEdmFunctionImport extends 
JPAEdmBaseViewImpl implements JPAEdmFu
           functionReturnType.setTypeName(JPAEdmNameBuilder.build(schemaView, 
edmEntityType.getName()));
           break;
         case SIMPLE:
-          EdmSimpleTypeKind edmSimpleTypeKind = 
JPATypeConvertor.convertToEdmSimpleType(methodReturnType, null);
+          EdmSimpleTypeKind edmSimpleTypeKind = 
JPATypeConverter.convertToEdmSimpleType(methodReturnType, null);
           
functionReturnType.setTypeName(edmSimpleTypeKind.getFullQualifiedName());
 
           break;

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
 
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
index 360ee5b..f65cb01 100644
--- 
a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
+++ 
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
@@ -57,7 +57,7 @@ import 
org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmPropertyView;
 import 
org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmReferentialConstraintView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmSchemaView;
 import 
org.apache.olingo.odata2.jpa.processor.core.access.model.JPAEdmNameBuilder;
-import 
org.apache.olingo.odata2.jpa.processor.core.access.model.JPATypeConvertor;
+import 
org.apache.olingo.odata2.jpa.processor.core.access.model.JPATypeConverter;
 
 public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
     JPAEdmPropertyView, JPAEdmComplexPropertyView {
@@ -332,7 +332,7 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl 
implements
 
       boolean isForeignKey = joinColumn != null;
       JPAEdmNameBuilder.build(JPAEdmProperty.this, isBuildModeComplexType, 
skipDefaultNaming, isForeignKey);
-      EdmSimpleTypeKind simpleTypeKind = JPATypeConvertor
+      EdmSimpleTypeKind simpleTypeKind = JPATypeConverter
           .convertToEdmSimpleType(jpaAttribute
               .getJavaType(), jpaAttribute);
       simpleProperty.setType(simpleTypeKind);

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
index a642235..1b05fcb 100644
--- 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
+++ 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
@@ -37,6 +37,7 @@ import 
org.apache.olingo.odata2.jpa.processor.core.mock.ODataContextMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.PathInfoMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.EdmMockUtilV2;
+import 
org.apache.olingo.odata2.jpa.processor.core.mock.data.EntityWithXmlAdapterOnProperty;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock;
 import 
org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock.JPARelatedTypeMock;
 import 
org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock.JPATypeEmbeddableMock;
@@ -111,6 +112,28 @@ public class JPAEntityTest {
   }
 
   @Test
+  public void testCreateODataEntryWithXmlAdapter() {
+    try {
+      EdmEntitySet edmEntitySet = 
EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, 
mockODataJPAContext());
+      
jpaEntity.create(ODataEntryMockUtil.mockODataEntry(JPATypeMock.ENTITY_NAME));
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
+    assertEquals(jpaTypeMock.getPropertyWithXmlAdapter().getClass(), 
EntityWithXmlAdapterOnProperty.class);
+  }
+
+  @Test
   public void testCreateODataEntryWithInline() {
     try {
       EdmEntitySet edmEntitySet = 
EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConverterTest.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConverterTest.java
 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConverterTest.java
new file mode 100644
index 0000000..52b9212
--- /dev/null
+++ 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConverterTest.java
@@ -0,0 +1,332 @@
+/*******************************************************************************
+ * 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.
+ 
******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.core.access.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.math.BigDecimal;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Lob;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.metamodel.ManagedType;
+
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
+import 
org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
+import 
org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import 
org.apache.olingo.odata2.jpa.processor.core.mock.data.EntityWithXmlAdapterOnProperty;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
+import 
org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAJavaMemberMock;
+import org.easymock.EasyMock;
+import org.junit.Test;
+
+public class JPATypeConverterTest {
+
+  private static String testCase = "datetime";
+
+  private EdmSimpleTypeKind edmSimpleKindTypeString;
+  private EdmSimpleTypeKind edmSimpleKindTypeCharacter;
+  private EdmSimpleTypeKind edmSimpleKindTypeByteArr;
+  private EdmSimpleTypeKind edmSimpleKindTypeLong;
+  private EdmSimpleTypeKind edmSimpleKindTypeShort;
+  private EdmSimpleTypeKind edmSimpleKindTypeInteger;
+  private EdmSimpleTypeKind edmSimpleKindTypeDouble;
+  private EdmSimpleTypeKind edmSimpleKindTypeFloat;
+  private EdmSimpleTypeKind edmSimpleKindTypeBigDecimal;
+  private EdmSimpleTypeKind edmSimpleKindTypeByte;
+  private EdmSimpleTypeKind edmSimpleKindTypeBoolean;
+  private EdmSimpleTypeKind edmSimpleKindTypeUUID;
+  private EdmSimpleTypeKind edmSimpleKindTypeStringFromEnum;
+
+  enum SomeEnum {TEST}
+
+  @Test
+  public void testConvertToEdmSimpleType() {
+    String str = "entity";
+    byte[] byteArr = new byte[3];
+    Long longObj = new Long(0);
+    Short shortObj = new Short((short) 0);
+    Integer integerObj = new Integer(0);
+    Double doubleObj = new Double(0);
+    Float floatObj = new Float(0);
+    BigDecimal bigDecimalObj = new BigDecimal(0);
+    Byte byteObj = new Byte((byte) 0);
+    Boolean booleanObj = Boolean.TRUE;
+    UUID uUID = new UUID(0, 0);
+    SomeEnum someEnum = SomeEnum.TEST;
+    Character charObj = new Character('c');
+
+    try {
+      edmSimpleKindTypeString = 
JPATypeConverter.convertToEdmSimpleType(str.getClass(), null);
+      edmSimpleKindTypeByteArr = 
JPATypeConverter.convertToEdmSimpleType(byteArr.getClass(), null);
+      edmSimpleKindTypeLong = 
JPATypeConverter.convertToEdmSimpleType(longObj.getClass(), null);
+      edmSimpleKindTypeShort = 
JPATypeConverter.convertToEdmSimpleType(shortObj.getClass(), null);
+      edmSimpleKindTypeInteger = 
JPATypeConverter.convertToEdmSimpleType(integerObj.getClass(), null);
+      edmSimpleKindTypeDouble = 
JPATypeConverter.convertToEdmSimpleType(doubleObj.getClass(), null);
+      edmSimpleKindTypeFloat = 
JPATypeConverter.convertToEdmSimpleType(floatObj.getClass(), null);
+      edmSimpleKindTypeBigDecimal = 
JPATypeConverter.convertToEdmSimpleType(bigDecimalObj.getClass(), null);
+      edmSimpleKindTypeByte = 
JPATypeConverter.convertToEdmSimpleType(byteObj.getClass(), null);
+      edmSimpleKindTypeBoolean = 
JPATypeConverter.convertToEdmSimpleType(booleanObj.getClass(), null);
+      edmSimpleKindTypeStringFromEnum = 
JPATypeConverter.convertToEdmSimpleType(someEnum.getClass(), null);
+      edmSimpleKindTypeCharacter = 
JPATypeConverter.convertToEdmSimpleType(charObj.getClass(), null);
+      edmSimpleKindTypeUUID = 
JPATypeConverter.convertToEdmSimpleType(uUID.getClass(), null);
+    } catch (ODataJPAModelException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+    assertEquals(EdmSimpleTypeKind.String, edmSimpleKindTypeString);
+    assertEquals(EdmSimpleTypeKind.Binary, edmSimpleKindTypeByteArr);
+    assertEquals(EdmSimpleTypeKind.Int64, edmSimpleKindTypeLong);
+    assertEquals(EdmSimpleTypeKind.Int16, edmSimpleKindTypeShort);
+    assertEquals(EdmSimpleTypeKind.Int32, edmSimpleKindTypeInteger);
+    assertEquals(EdmSimpleTypeKind.Double, edmSimpleKindTypeDouble);
+    assertEquals(EdmSimpleTypeKind.Single, edmSimpleKindTypeFloat);
+    assertEquals(EdmSimpleTypeKind.Decimal, edmSimpleKindTypeBigDecimal);
+    assertEquals(EdmSimpleTypeKind.Byte, edmSimpleKindTypeByte);
+    assertEquals(EdmSimpleTypeKind.Boolean, edmSimpleKindTypeBoolean);
+    assertEquals(EdmSimpleTypeKind.String, edmSimpleKindTypeCharacter);
+    assertEquals(EdmSimpleTypeKind.Guid, edmSimpleKindTypeUUID);
+    assertEquals(EdmSimpleTypeKind.String, edmSimpleKindTypeStringFromEnum);
+  }
+
+  @Test
+  public void testConvertTypeCharacter() {
+    try {
+      assertEquals(EdmSimpleTypeKind.String, 
JPATypeConverter.convertToEdmSimpleType(Character[].class, null));
+      assertEquals(EdmSimpleTypeKind.String, 
JPATypeConverter.convertToEdmSimpleType(char[].class, null));
+      assertEquals(EdmSimpleTypeKind.String, 
JPATypeConverter.convertToEdmSimpleType(char.class, null));
+    } catch (ODataJPAModelException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testConvertTypeNumbers() {
+    try {
+      assertEquals(EdmSimpleTypeKind.Int64, 
JPATypeConverter.convertToEdmSimpleType(long.class, null));
+      assertEquals(EdmSimpleTypeKind.Int16, 
JPATypeConverter.convertToEdmSimpleType(short.class, null));
+      assertEquals(EdmSimpleTypeKind.Int32, 
JPATypeConverter.convertToEdmSimpleType(int.class, null));
+      assertEquals(EdmSimpleTypeKind.Double, 
JPATypeConverter.convertToEdmSimpleType(double.class, null));
+      assertEquals(EdmSimpleTypeKind.Single, 
JPATypeConverter.convertToEdmSimpleType(float.class, null));
+      assertEquals(EdmSimpleTypeKind.Byte, 
JPATypeConverter.convertToEdmSimpleType(byte.class, null));
+      assertEquals(EdmSimpleTypeKind.Boolean, 
JPATypeConverter.convertToEdmSimpleType(boolean.class, null));
+    } catch (ODataJPAModelException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testConvertTypeByteArray() {
+    try {
+      assertEquals(EdmSimpleTypeKind.Binary, 
JPATypeConverter.convertToEdmSimpleType(Byte[].class, null));
+    } catch (ODataJPAModelException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testConvertTypeBlob() {
+    testCase = "lob";
+    try {
+      assertEquals(EdmSimpleTypeKind.Binary, 
JPATypeConverter.convertToEdmSimpleType(Blob.class,
+          new JPASimpleAttribute()));
+    } catch (ODataJPAModelException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testConvertTypeClob() {
+    testCase = "lob";
+    try {
+      assertEquals(EdmSimpleTypeKind.String, 
JPATypeConverter.convertToEdmSimpleType(Clob.class,
+          new JPASimpleAttribute()));
+    } catch (ODataJPAModelException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testConvertTypeBLobNegative() {
+    try {
+      JPATypeConverter.convertToEdmSimpleType(Blob.class, null);
+    } catch (ODataJPAModelException e) {
+      assertTrue(true);
+      return;
+    }
+    fail("ExceptionExpected");
+  }
+
+  @Test
+  public void testConvertTypeClobNegative() {
+    try {
+      JPATypeConverter.convertToEdmSimpleType(Clob.class, null);
+    } catch (ODataJPAModelException e) {
+      assertTrue(true);
+      return;
+    }
+    fail("ExceptionExpected");
+  }
+
+  @Test
+  public void testConvertTypeCalendar() {
+    try {
+      assertEquals(EdmSimpleTypeKind.DateTime, 
JPATypeConverter.convertToEdmSimpleType(Calendar.class, null));
+      assertEquals(EdmSimpleTypeKind.Time, 
JPATypeConverter.convertToEdmSimpleType(Time.class, null));
+      assertEquals(EdmSimpleTypeKind.DateTime, 
JPATypeConverter.convertToEdmSimpleType(Date.class, null));
+      assertEquals(EdmSimpleTypeKind.DateTime, 
JPATypeConverter.convertToEdmSimpleType(Timestamp.class, null));
+      assertEquals(EdmSimpleTypeKind.DateTime, 
JPATypeConverter.convertToEdmSimpleType(java.sql.Date.class, null));
+    } catch (ODataJPAModelException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+      ;
+    }
+  }
+
+  @Test
+  public void testConvertTypeTemporal() {
+    testCase = "datetime";
+    try {
+      EdmSimpleTypeKind edmDateType = 
JPATypeConverter.convertToEdmSimpleType(Calendar.class, new 
JPASimpleAttribute());
+      assertEquals(EdmSimpleTypeKind.DateTime, edmDateType);
+    } catch (ODataJPAModelException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testConvertTypeTemporalTime() {
+    testCase = "time";
+    try {
+      EdmSimpleTypeKind edmTimeType = 
JPATypeConverter.convertToEdmSimpleType(Calendar.class, new 
JPASimpleAttribute());
+      assertEquals(EdmSimpleTypeKind.Time, edmTimeType);
+    } catch (ODataJPAModelException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testConvertTypeTemporalNull() {
+    testCase = "temporalnull";
+    try {
+      EdmSimpleTypeKind edmDateType = 
JPATypeConverter.convertToEdmSimpleType(Calendar.class, new 
JPASimpleAttribute());
+      assertEquals(EdmSimpleTypeKind.DateTime, edmDateType);
+    } catch (ODataJPAModelException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testConvertTypeTemporalNull2() {
+    testCase = "temporalnull2";
+    try {
+      EdmSimpleTypeKind edmDateType =
+                 JPATypeConverter.convertToEdmSimpleType(Calendar.class,new 
JPASimpleAttribute());
+      assertEquals(EdmSimpleTypeKind.DateTime, edmDateType);
+    } catch (ODataJPAModelException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+  
+  @Test
+  public void testConvertPropertyWithXmlAdapter() {
+         try {
+                EdmSimpleTypeKind edmDateType =
+                                JPATypeConverter
+                                
.convertToEdmSimpleType(EntityWithXmlAdapterOnProperty.class,
+                                                new 
JPAAttributeWithXmlAdapterType());
+                assertEquals(EdmSimpleTypeKind.String, edmDateType);
+       } catch (ODataJPAModelException e) {
+               fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + 
e.getMessage() +
+                               ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+       }
+  }
+
+  private static class JPASimpleAttribute extends JPAAttributeMock<Object, 
String> {
+
+    @Override
+    public Member getJavaMember() {
+      if (testCase.equals("temporalNull2")) {
+        return null;
+      }
+      return new JPAJavaMember();
+    }
+  }
+
+  private static class JPAJavaMember extends JPAJavaMemberMock {
+
+    private Temporal temporal = null;
+    private Lob lob = null;
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <T extends Annotation> T getAnnotation(final Class<T> 
annotationClass) {
+
+      if (testCase.equals("temporalnull")) {
+        return null;
+      }
+
+      if (annotationClass.equals(Temporal.class)) {
+        if (temporal == null) {
+          temporal = EasyMock.createMock(Temporal.class);
+          if (testCase.equals("datetime")) {
+            
EasyMock.expect(temporal.value()).andReturn(TemporalType.TIMESTAMP).anyTimes();
+            EasyMock.replay(temporal);
+          } else if (testCase.equals("time")) {
+            
EasyMock.expect(temporal.value()).andReturn(TemporalType.TIME).anyTimes();
+            EasyMock.replay(temporal);
+          }
+        }
+        return (T) temporal;
+      } else if (annotationClass.equals(Lob.class)) {
+        if (testCase.equals("lob")) {
+          lob = EasyMock.createMock(Lob.class);
+          EasyMock.replay(lob);
+        }
+        return (T) lob;
+      }
+      return null;
+
+    }
+  }
+  
+  private static class JPAAttributeWithXmlAdapterType extends 
JPAAttributeMock<EntityWithXmlAdapterOnProperty, String> {
+         @Override
+         public String getName() {
+                 return "self";
+         }
+         
+         public ManagedType<EntityWithXmlAdapterOnProperty> getDeclaringType() 
{
+               ManagedType<EntityWithXmlAdapterOnProperty> mock = 
EasyMock.createMock(ManagedType.class);
+               
EasyMock.expect(mock.getJavaType()).andStubReturn(EntityWithXmlAdapterOnProperty.class);
+               EasyMock.replay(mock);
+               return mock;
+         }
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java
 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java
deleted file mode 100644
index 91639c4..0000000
--- 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*******************************************************************************
- * 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.
- 
******************************************************************************/
-package org.apache.olingo.odata2.jpa.processor.core.access.model;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Member;
-import java.math.BigDecimal;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Lob;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import 
org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
-import 
org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
-import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
-import 
org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAJavaMemberMock;
-import org.easymock.EasyMock;
-import org.junit.Test;
-
-public class JPATypeConvertorTest {
-
-  private static String testCase = "datetime";
-
-  private EdmSimpleTypeKind edmSimpleKindTypeString;
-  private EdmSimpleTypeKind edmSimpleKindTypeCharacter;
-  private EdmSimpleTypeKind edmSimpleKindTypeByteArr;
-  private EdmSimpleTypeKind edmSimpleKindTypeLong;
-  private EdmSimpleTypeKind edmSimpleKindTypeShort;
-  private EdmSimpleTypeKind edmSimpleKindTypeInteger;
-  private EdmSimpleTypeKind edmSimpleKindTypeDouble;
-  private EdmSimpleTypeKind edmSimpleKindTypeFloat;
-  private EdmSimpleTypeKind edmSimpleKindTypeBigDecimal;
-  private EdmSimpleTypeKind edmSimpleKindTypeByte;
-  private EdmSimpleTypeKind edmSimpleKindTypeBoolean;
-  private EdmSimpleTypeKind edmSimpleKindTypeUUID;
-  private EdmSimpleTypeKind edmSimpleKindTypeStringFromEnum;
-
-  enum SomeEnum {TEST}
-
-  @Test
-  public void testConvertToEdmSimpleType() {
-    String str = "entity";
-    byte[] byteArr = new byte[3];
-    Long longObj = new Long(0);
-    Short shortObj = new Short((short) 0);
-    Integer integerObj = new Integer(0);
-    Double doubleObj = new Double(0);
-    Float floatObj = new Float(0);
-    BigDecimal bigDecimalObj = new BigDecimal(0);
-    Byte byteObj = new Byte((byte) 0);
-    Boolean booleanObj = Boolean.TRUE;
-    UUID uUID = new UUID(0, 0);
-    SomeEnum someEnum = SomeEnum.TEST;
-    Character charObj = new Character('c');
-
-    try {
-      edmSimpleKindTypeString = 
JPATypeConvertor.convertToEdmSimpleType(str.getClass(), null);
-      edmSimpleKindTypeByteArr = 
JPATypeConvertor.convertToEdmSimpleType(byteArr.getClass(), null);
-      edmSimpleKindTypeLong = 
JPATypeConvertor.convertToEdmSimpleType(longObj.getClass(), null);
-      edmSimpleKindTypeShort = 
JPATypeConvertor.convertToEdmSimpleType(shortObj.getClass(), null);
-      edmSimpleKindTypeInteger = 
JPATypeConvertor.convertToEdmSimpleType(integerObj.getClass(), null);
-      edmSimpleKindTypeDouble = 
JPATypeConvertor.convertToEdmSimpleType(doubleObj.getClass(), null);
-      edmSimpleKindTypeFloat = 
JPATypeConvertor.convertToEdmSimpleType(floatObj.getClass(), null);
-      edmSimpleKindTypeBigDecimal = 
JPATypeConvertor.convertToEdmSimpleType(bigDecimalObj.getClass(), null);
-      edmSimpleKindTypeByte = 
JPATypeConvertor.convertToEdmSimpleType(byteObj.getClass(), null);
-      edmSimpleKindTypeBoolean = 
JPATypeConvertor.convertToEdmSimpleType(booleanObj.getClass(), null);
-      edmSimpleKindTypeStringFromEnum = 
JPATypeConvertor.convertToEdmSimpleType(someEnum.getClass(), null);
-      edmSimpleKindTypeCharacter = 
JPATypeConvertor.convertToEdmSimpleType(charObj.getClass(), null);
-      edmSimpleKindTypeUUID = 
JPATypeConvertor.convertToEdmSimpleType(uUID.getClass(), null);
-    } catch (ODataJPAModelException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-
-    assertEquals(EdmSimpleTypeKind.String, edmSimpleKindTypeString);
-    assertEquals(EdmSimpleTypeKind.Binary, edmSimpleKindTypeByteArr);
-    assertEquals(EdmSimpleTypeKind.Int64, edmSimpleKindTypeLong);
-    assertEquals(EdmSimpleTypeKind.Int16, edmSimpleKindTypeShort);
-    assertEquals(EdmSimpleTypeKind.Int32, edmSimpleKindTypeInteger);
-    assertEquals(EdmSimpleTypeKind.Double, edmSimpleKindTypeDouble);
-    assertEquals(EdmSimpleTypeKind.Single, edmSimpleKindTypeFloat);
-    assertEquals(EdmSimpleTypeKind.Decimal, edmSimpleKindTypeBigDecimal);
-    assertEquals(EdmSimpleTypeKind.Byte, edmSimpleKindTypeByte);
-    assertEquals(EdmSimpleTypeKind.Boolean, edmSimpleKindTypeBoolean);
-    assertEquals(EdmSimpleTypeKind.String, edmSimpleKindTypeCharacter);
-    assertEquals(EdmSimpleTypeKind.Guid, edmSimpleKindTypeUUID);
-    assertEquals(EdmSimpleTypeKind.String, edmSimpleKindTypeStringFromEnum);
-  }
-
-  @Test
-  public void testConvertTypeCharacter() {
-    try {
-      assertEquals(EdmSimpleTypeKind.String, 
JPATypeConvertor.convertToEdmSimpleType(Character[].class, null));
-      assertEquals(EdmSimpleTypeKind.String, 
JPATypeConvertor.convertToEdmSimpleType(char[].class, null));
-      assertEquals(EdmSimpleTypeKind.String, 
JPATypeConvertor.convertToEdmSimpleType(char.class, null));
-    } catch (ODataJPAModelException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testConvertTypeNumbers() {
-    try {
-      assertEquals(EdmSimpleTypeKind.Int64, 
JPATypeConvertor.convertToEdmSimpleType(long.class, null));
-      assertEquals(EdmSimpleTypeKind.Int16, 
JPATypeConvertor.convertToEdmSimpleType(short.class, null));
-      assertEquals(EdmSimpleTypeKind.Int32, 
JPATypeConvertor.convertToEdmSimpleType(int.class, null));
-      assertEquals(EdmSimpleTypeKind.Double, 
JPATypeConvertor.convertToEdmSimpleType(double.class, null));
-      assertEquals(EdmSimpleTypeKind.Single, 
JPATypeConvertor.convertToEdmSimpleType(float.class, null));
-      assertEquals(EdmSimpleTypeKind.Byte, 
JPATypeConvertor.convertToEdmSimpleType(byte.class, null));
-      assertEquals(EdmSimpleTypeKind.Boolean, 
JPATypeConvertor.convertToEdmSimpleType(boolean.class, null));
-    } catch (ODataJPAModelException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testConvertTypeByteArray() {
-    try {
-      assertEquals(EdmSimpleTypeKind.Binary, 
JPATypeConvertor.convertToEdmSimpleType(Byte[].class, null));
-    } catch (ODataJPAModelException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testConvertTypeBlob() {
-    testCase = "lob";
-    try {
-      assertEquals(EdmSimpleTypeKind.Binary, 
JPATypeConvertor.convertToEdmSimpleType(Blob.class,
-          new JPASimpleAttribute()));
-    } catch (ODataJPAModelException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testConvertTypeClob() {
-    testCase = "lob";
-    try {
-      assertEquals(EdmSimpleTypeKind.String, 
JPATypeConvertor.convertToEdmSimpleType(Clob.class,
-          new JPASimpleAttribute()));
-    } catch (ODataJPAModelException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testConvertTypeBLobNegative() {
-    try {
-      JPATypeConvertor.convertToEdmSimpleType(Blob.class, null);
-    } catch (ODataJPAModelException e) {
-      assertTrue(true);
-      return;
-    }
-    fail("ExceptionExpected");
-  }
-
-  @Test
-  public void testConvertTypeClobNegative() {
-    try {
-      JPATypeConvertor.convertToEdmSimpleType(Clob.class, null);
-    } catch (ODataJPAModelException e) {
-      assertTrue(true);
-      return;
-    }
-    fail("ExceptionExpected");
-  }
-
-  @Test
-  public void testConvertTypeCalendar() {
-    try {
-      assertEquals(EdmSimpleTypeKind.DateTime, 
JPATypeConvertor.convertToEdmSimpleType(Calendar.class, null));
-      assertEquals(EdmSimpleTypeKind.Time, 
JPATypeConvertor.convertToEdmSimpleType(Time.class, null));
-      assertEquals(EdmSimpleTypeKind.DateTime, 
JPATypeConvertor.convertToEdmSimpleType(Date.class, null));
-      assertEquals(EdmSimpleTypeKind.DateTime, 
JPATypeConvertor.convertToEdmSimpleType(Timestamp.class, null));
-      assertEquals(EdmSimpleTypeKind.DateTime, 
JPATypeConvertor.convertToEdmSimpleType(java.sql.Date.class, null));
-    } catch (ODataJPAModelException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-      ;
-    }
-  }
-
-  @Test
-  public void testConvertTypeTemporal() {
-    testCase = "datetime";
-    try {
-      EdmSimpleTypeKind edmDateType = 
JPATypeConvertor.convertToEdmSimpleType(Calendar.class, new 
JPASimpleAttribute());
-      assertEquals(EdmSimpleTypeKind.DateTime, edmDateType);
-    } catch (ODataJPAModelException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testConvertTypeTemporalTime() {
-    testCase = "time";
-    try {
-      EdmSimpleTypeKind edmTimeType = 
JPATypeConvertor.convertToEdmSimpleType(Calendar.class, new 
JPASimpleAttribute());
-      assertEquals(EdmSimpleTypeKind.Time, edmTimeType);
-    } catch (ODataJPAModelException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testConvertTypeTemporalNull() {
-    testCase = "temporalnull";
-    try {
-      EdmSimpleTypeKind edmDateType = 
JPATypeConvertor.convertToEdmSimpleType(Calendar.class, new 
JPASimpleAttribute());
-      assertEquals(EdmSimpleTypeKind.DateTime, edmDateType);
-    } catch (ODataJPAModelException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testConvertTypeTemporalNull2() {
-    testCase = "temporalnull2";
-    try {
-      EdmSimpleTypeKind edmDateType = 
JPATypeConvertor.convertToEdmSimpleType(Calendar.class, new 
JPASimpleAttribute());
-      assertEquals(EdmSimpleTypeKind.DateTime, edmDateType);
-    } catch (ODataJPAModelException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + 
ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  private static class JPASimpleAttribute extends JPAAttributeMock<Object, 
String> {
-
-    @Override
-    public Member getJavaMember() {
-      if (testCase.equals("temporalNull2")) {
-        return null;
-      }
-      return new JPAJavaMember();
-    }
-  }
-
-  private static class JPAJavaMember extends JPAJavaMemberMock {
-
-    private Temporal temporal = null;
-    private Lob lob = null;
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public <T extends Annotation> T getAnnotation(final Class<T> 
annotationClass) {
-
-      if (testCase.equals("temporalnull")) {
-        return null;
-      }
-
-      if (annotationClass.equals(Temporal.class)) {
-        if (temporal == null) {
-          temporal = EasyMock.createMock(Temporal.class);
-          if (testCase.equals("datetime")) {
-            
EasyMock.expect(temporal.value()).andReturn(TemporalType.TIMESTAMP).anyTimes();
-            EasyMock.replay(temporal);
-          } else if (testCase.equals("time")) {
-            
EasyMock.expect(temporal.value()).andReturn(TemporalType.TIME).anyTimes();
-            EasyMock.replay(temporal);
-          }
-        }
-        return (T) temporal;
-      } else if (annotationClass.equals(Lob.class)) {
-        if (testCase.equals("lob")) {
-          lob = EasyMock.createMock(Lob.class);
-          EasyMock.replay(lob);
-        }
-        return (T) lob;
-      }
-      return null;
-
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java
 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java
index c4812d6..5701a4c 100644
--- 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java
+++ 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java
@@ -53,7 +53,7 @@ public class JPQLJoinStatementBuilderTest {
     EasyMock.expect(context.getSelectExpression()).andStubReturn("mat");
     EasyMock.expect(context.getWhereExpression()).andStubReturn("soh.buyerId = 
2");
     String orderByMap = new String("mat.buyerId asc , mat.city desc");
-     EasyMock.expect(context.getOrderByCollection()).andStubReturn(orderByMap);
+    EasyMock.expect(context.getOrderByCollection()).andStubReturn(orderByMap);
     EasyMock.expect(context.getJPAJoinClauses()).andStubReturn(joinClauseList);
     EasyMock.replay(context);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
index dcf3ab9..eb5e02e 100644
--- 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
+++ 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
@@ -107,6 +107,8 @@ public class EdmMockUtilV2 {
           mockEdmProperty(entityName, 
JPATypeMock.PROPERTY_NAME_MCHARARRAY)).anyTimes();
       
EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)).andReturn(
           mockEdmProperty(entityName, 
JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)).anyTimes();
+      
EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_XMLADAPTER)).andReturn(
+              mockEdmProperty(entityName, 
JPATypeMock.PROPERTY_NAME_XMLADAPTER)).anyTimes();
       
EasyMock.expect(entityType.getProperty(JPATypeMock.NAVIGATION_PROPERTY_X)).andReturn(
           mockEdmNavigationProperty(JPATypeMock.NAVIGATION_PROPERTY_X, 
EdmMultiplicity.ONE)).anyTimes();
       
EasyMock.expect(entityType.getProperty(JPATypeMock.NAVIGATION_PROPERTY_XS)).andReturn(null).anyTimes();
@@ -167,6 +169,7 @@ public class EdmMockUtilV2 {
       propertyNames.add(JPATypeMock.PROPERTY_NAME_MCHAR);
       propertyNames.add(JPATypeMock.PROPERTY_NAME_MCHARARRAY);
       propertyNames.add(JPATypeMock.PROPERTY_NAME_ENUM);
+      propertyNames.add(JPATypeMock.PROPERTY_NAME_XMLADAPTER);
     } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
       propertyNames.add(JPARelatedTypeMock.PROPERTY_NAME_MLONG);
       propertyNames.add(JPARelatedTypeMock.PROPERTY_NAME_MBYTE);
@@ -269,6 +272,7 @@ public class EdmMockUtilV2 {
         propertyName.equals(JPATypeMock.PROPERTY_NAME_MC) ||
         propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHAR) ||
         propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHARARRAY) ||
+        propertyName.equals(JPATypeMock.PROPERTY_NAME_XMLADAPTER) ||
         
propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT) ||
         
propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT) ||
         
propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID) ||
@@ -294,6 +298,9 @@ public class EdmMockUtilV2 {
         EasyMock.<Class<?>> 
expect(edmType.getDefaultType()).andReturn(String.class).anyTimes();
       } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MBLOB)) {
         EasyMock.<Class<?>> 
expect(edmType.getDefaultType()).andReturn(Blob.class).anyTimes();
+      } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_XMLADAPTER)) {
+         EasyMock.<Class<?>> expect(edmType.getDefaultType())
+               .andReturn(String.class).anyTimes();
       } else {
         EasyMock.<Class<?>> 
expect(edmType.getDefaultType()).andReturn(Integer.class).anyTimes();
       }
@@ -301,6 +308,9 @@ public class EdmMockUtilV2 {
       
EasyMock.expect(edmType.isCompatible(EasyMock.isA(EdmSimpleType.class))).andReturn(true).anyTimes();
       EasyMock.replay(edmType);
       
EasyMock.expect(edmProperty.getName()).andReturn(propertyName).anyTimes();
+      
+      
+      
       EasyMock.expect(edmProperty.getMapping()).andReturn((EdmMapping) 
mockEdmMapping(entityName, propertyName, null))
           .anyTimes();
 
@@ -402,6 +412,9 @@ public class EdmMockUtilV2 {
     } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHARARRAY)) {
       mapping.setJPAType(Character[].class);
       ((Mapping) 
mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MCHARARRAY);
+    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_XMLADAPTER)) {
+        mapping.setJPAType(EntityWithXmlAdapterOnProperty.class);
+        ((Mapping) 
mapping).setInternalName(JPATypeMock.PROPERTY_NAME_XMLADAPTER);
     } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MDATETIME)) {
       mapping.setJPAType(Calendar.class);
       ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MDATETIME);

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EntityWithXmlAdapterOnProperty.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EntityWithXmlAdapterOnProperty.java
 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EntityWithXmlAdapterOnProperty.java
new file mode 100644
index 0000000..029a3ff
--- /dev/null
+++ 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EntityWithXmlAdapterOnProperty.java
@@ -0,0 +1,16 @@
+package org.apache.olingo.odata2.jpa.processor.core.mock.data;
+
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+public class EntityWithXmlAdapterOnProperty {
+       private EntityWithXmlAdapterOnProperty self;
+
+       @XmlJavaTypeAdapter(XmlAdapter.class)
+       public EntityWithXmlAdapterOnProperty getSelf() {
+               return self;
+       }
+
+       public void setSelf(EntityWithXmlAdapterOnProperty self) {
+               this.self = self;
+       }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
index 60b1c91..a9d0c4e 100644
--- 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
+++ 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
@@ -28,6 +28,8 @@ import java.util.Date;
 import java.util.List;
 import java.util.UUID;
 
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
 /* ========================================================================= */
 public class JPATypeMock {
 
@@ -46,7 +48,8 @@ public class JPATypeMock {
   public static final String PROPERTY_NAME_MKEY = "key";
   public static final String PROPERTY_NAME_MCOMPLEXTYPE = "complexType";
   public static final String PROPERTY_NAME_ENUM = "mSomeEnum";
-  
+  public static final String PROPERTY_NAME_XMLADAPTER = 
"propertyWithXmlAdapter";
+
   public static final String NAVIGATION_PROPERTY_X = "mRelatedEntity";
   public static final String NAVIGATION_PROPERTY_XS = "mRelatedEntities";
 
@@ -62,6 +65,8 @@ public class JPATypeMock {
   private Character mChar;
   private Character[] mCharArray;
   private JPATypeMockEnum mSomeEnum;
+  
+  private EntityWithXmlAdapterOnProperty propertyWithXmlAdapter;
 
   public Clob getMClob() {
     return mClob;
@@ -177,6 +182,15 @@ public class JPATypeMock {
   public void setMSomeEnum(JPATypeMockEnum mSomeEnum) {
     this.mSomeEnum = mSomeEnum;
   }
+  
+  @XmlJavaTypeAdapter(XmlAdapter.class)
+  public EntityWithXmlAdapterOnProperty getPropertyWithXmlAdapter() {
+    return propertyWithXmlAdapter;
+  }
+
+  public void setPropertyWithXmlAdapter(EntityWithXmlAdapterOnProperty 
propertyWithXmlAdapter) {
+    this.propertyWithXmlAdapter = propertyWithXmlAdapter;
+  }
 
   /* ========================================================================= 
*/
   public static class JPATypeEmbeddableMock {

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/ODataEntryMockUtil.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/ODataEntryMockUtil.java
 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/ODataEntryMockUtil.java
index a199329..b0a2c31 100644
--- 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/ODataEntryMockUtil.java
+++ 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/ODataEntryMockUtil.java
@@ -47,6 +47,7 @@ public class ODataEntryMockUtil {
   public static final String VALUE_CHAR = "I";
   public static final String VALUE_CHARARRAY = "LMN";
   public static final String VALUE_MSTRING = "Mock";
+  public static final String VALUE_XMLADAPTER = "DOES-NOT-MATTER";
   public static final long VALUE_MLONG = 1234567890L;
   public static final double VALUE_MDOUBLE = 20.12;
   public static final byte VALUE_MBYTE = 0XA;
@@ -143,6 +144,7 @@ public class ODataEntryMockUtil {
       propertyMap.put(JPATypeMock.PROPERTY_NAME_MCHAR, VALUE_CHAR);
       propertyMap.put(JPATypeMock.PROPERTY_NAME_MCHARARRAY, VALUE_CHARARRAY);
       propertyMap.put(JPATypeMock.PROPERTY_NAME_MSTRING, VALUE_MSTRING);
+      propertyMap.put(JPATypeMock.PROPERTY_NAME_XMLADAPTER, VALUE_XMLADAPTER);
     } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
       propertyMap.put(JPARelatedTypeMock.PROPERTY_NAME_MLONG, VALUE_MLONG);
       propertyMap.put(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE, VALUE_MDOUBLE);

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7aac7976/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/XmlAdapter.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/XmlAdapter.java
 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/XmlAdapter.java
new file mode 100644
index 0000000..f0d0478
--- /dev/null
+++ 
b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/XmlAdapter.java
@@ -0,0 +1,16 @@
+package org.apache.olingo.odata2.jpa.processor.core.mock.data;
+
+public class XmlAdapter extends
+       javax.xml.bind.annotation.adapters.XmlAdapter<String, 
EntityWithXmlAdapterOnProperty> {
+
+       @Override
+       public String marshal(EntityWithXmlAdapterOnProperty arg0) throws 
Exception {
+               return "self";
+       }
+
+       @Override
+       public EntityWithXmlAdapterOnProperty unmarshal(String arg0) throws 
Exception {
+               return new EntityWithXmlAdapterOnProperty();
+       }
+
+}
\ No newline at end of file

Reply via email to