[OLINGO-1262]Issue with parameterization when filter is applied on a navigation property and issue when query has GUID property
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParser.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParser.java
index 18d581b..b417627 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParser.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParser.java
@@ -28,6 +28,7 @@
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.TreeMap;
+import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.olingo.odata2.api.edm.EdmException;
@@ -90,7 +91,7 @@
   }
   
   public static String parseToJPAWhereExpression(final CommonExpression whereExpression, final String tableAlias, 
-      int index, ConcurrentHashMap<Integer,Object> positionalParameters) throws ODataException {
+      int index, Map<Integer,Object> positionalParameters) throws ODataException {
     switch (whereExpression.getKind()) {
     case UNARY:
       final UnaryExpression unaryExpression = (UnaryExpression) whereExpression;
@@ -127,9 +128,9 @@
         }
       }
       final String left = parseToJPAWhereExpression(binaryExpression.getLeftOperand(), tableAlias, 
-          getIndexValue(positionalParameters), positionalParameters);
+          getIndexValue(index, positionalParameters), positionalParameters);
       final String right = parseToJPAWhereExpression(binaryExpression.getRightOperand(), tableAlias, 
-          getIndexValue(positionalParameters), positionalParameters);
+          getIndexValue(index, positionalParameters), positionalParameters);
 
       // Special handling for STARTSWITH and ENDSWITH method expression
       if (operator != null && (operator == MethodOperator.STARTSWITH || operator == MethodOperator.ENDSWITH)) {
@@ -232,13 +233,13 @@
     case METHOD:
       final MethodExpression methodExpression = (MethodExpression) whereExpression;
       String first = parseToJPAWhereExpression(methodExpression.getParameters().get(0), tableAlias, 
-          getIndexValue(positionalParameters), positionalParameters);
+          getIndexValue(index, positionalParameters), positionalParameters);
       String second =
           methodExpression.getParameterCount() > 1 ? parseToJPAWhereExpression(methodExpression.getParameters().get(1),
-              tableAlias, getIndexValue(positionalParameters), positionalParameters) : null;
+              tableAlias, getIndexValue(index, positionalParameters), positionalParameters) : null;
       String third =
           methodExpression.getParameterCount() > 2 ? parseToJPAWhereExpression(methodExpression.getParameters().get(2),
-              tableAlias, getIndexValue(positionalParameters), positionalParameters) : null;
+              tableAlias, getIndexValue(index, positionalParameters), positionalParameters) : null;
 
       switch (methodExpression.getMethod()) {
       case SUBSTRING:
@@ -270,12 +271,15 @@
     }
   }
   
-  private static int getIndexValue(Map<Integer, Object> map) {
-    int index = 1;
-    for (Entry<Integer, Object> entry : map.entrySet()) {
-      index = entry.getKey();
+  private static int getIndexValue(int index, Map<Integer, Object> map) {
+    if (map != null && !map.isEmpty()) {
+      for (Entry<Integer, Object> entry : map.entrySet()) {
+        index = entry.getKey();
+      }
+      return index + 1;
+    } else {
+      return index;
     }
-    return index + 1;
   }
 
   /**
@@ -398,7 +402,7 @@
     for (KeyPredicate keyPredicate : keyPredicates) {
 	  int index = null == getPositionalParametersThreadLocal() ||
 	    getPositionalParametersThreadLocal().size() == 0 ? 1 :
-		getIndexValue(getPositionalParametersThreadLocal());
+		getIndexValue(1, getPositionalParametersThreadLocal());
       if (i > 0) {
         keyFilters.append(JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.AND + JPQLStatement.DELIMITER.SPACE);
       }
@@ -490,7 +494,11 @@
         if(edmMappedType != null){
           evaluateExpressionForString(uriLiteral, edmMappedType, positionalParameters, index);
         }else{
-          positionalParameters.put(index, String.valueOf(uriLiteral));
+          if (EdmSimpleTypeKind.Guid.getEdmSimpleTypeInstance().isCompatible(edmSimpleType)) {
+            positionalParameters.put(index, UUID.fromString(uriLiteral.toString()));
+          } else {
+            positionalParameters.put(index, String.valueOf(uriLiteral));
+          }
         }
       }
       uriLiteral = "?" + index;
@@ -598,6 +606,8 @@
       positionalParameters.put(index, charObjectArray);
     }else if(edmMappedType.equals(Character.class)){
       positionalParameters.put(index, (Character)uriLiteral.charAt(0));
+    }else if(edmMappedType.equals(UUID.class)){
+      positionalParameters.put(index, UUID.fromString(uriLiteral));
     }else {
       positionalParameters.put(index, String.valueOf(uriLiteral));
     }
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAQueryBuilder.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAQueryBuilder.java
index b3ed847..d4b8c07 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAQueryBuilder.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAQueryBuilder.java
@@ -25,7 +25,6 @@
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -50,7 +49,6 @@
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
-import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextView;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLJoinContextView;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLJoinSelectSingleContextView;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLSelectContextView;
@@ -58,7 +56,6 @@
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLStatement;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping;
 import org.apache.olingo.odata2.jpa.processor.core.ODataExpressionParser;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectContext;
 
 public class JPAQueryBuilder {
 
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContext.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContext.java
index e54ef68..3b8176c 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContext.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContext.java
@@ -20,6 +20,8 @@
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.olingo.odata2.api.edm.EdmEntityType;
 import org.apache.olingo.odata2.api.edm.EdmException;
@@ -57,7 +59,11 @@
   
   protected final void setParameterizedQueryMap(
       final Map<String, Map<Integer, Object>> parameterizedQueryMap) {
-    this.parameterizedQueryMap = parameterizedQueryMap;
+    if (null == this.parameterizedQueryMap || this.parameterizedQueryMap.isEmpty()) {
+      this.parameterizedQueryMap = parameterizedQueryMap;
+    } else {
+      this.parameterizedQueryMap.putAll(parameterizedQueryMap);
+    }
   }
 
   protected final void setSelectExpression(final String selectExpression) {
@@ -167,8 +173,23 @@
      */
     protected String generateWhereExpression() throws ODataException {
       if (entitySetView.getFilter() != null) {
-        String whereExpression = ODataExpressionParser.parseToJPAWhereExpression(
-            entitySetView.getFilter(), getJPAEntityAlias());
+        String whereExpression = null;
+        if (null != parameterizedQueryMap && !parameterizedQueryMap.isEmpty()) {
+          int index = 1;
+          int previousIndex = 1;
+          for (Entry<String, Map<Integer, Object>> parameter : parameterizedQueryMap.entrySet()) {
+            index = getIndexValue(parameter.getValue());
+            if (index > previousIndex) {
+              previousIndex = index;
+            }
+          }
+          whereExpression = ODataExpressionParser.parseToJPAWhereExpression(
+              entitySetView.getFilter(), getJPAEntityAlias(), 
+              previousIndex, new ConcurrentHashMap<Integer, Object>());
+        } else {
+          whereExpression = ODataExpressionParser.parseToJPAWhereExpression(
+              entitySetView.getFilter(), getJPAEntityAlias());
+        }
         Map<String, Map<Integer, Object>> parameterizedExpressionMap = 
             new HashMap<String, Map<Integer,Object>>();
         parameterizedExpressionMap.put(whereExpression, 
@@ -179,6 +200,18 @@
       return null;
     }
   }
+  
+  private int getIndexValue(Map<Integer, Object> map) {
+    int index = 1;
+    if (map != null) {
+      for (Entry<Integer, Object> entry : map.entrySet()) {
+        index = entry.getKey();
+      }
+      return index + 1;
+    } else {
+      return index;
+    }
+  }
 
   @Override
   public Map<String, Map<Integer, Object>> getParameterizedQueryMap() {
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataFilterExpressionParserTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataFilterExpressionParserTest.java
index e17a779..87bda2f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataFilterExpressionParserTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataFilterExpressionParserTest.java
@@ -133,6 +133,10 @@
 
   private static final String[] EXPRESSION_NULL_EQ = { "id eq null", "(E1.id IS null)" };
   
+  private static final String[] EXPRESSION_GUID_EQ = { 
+      "ExternalRecommendationUUID eq guid'56fe79b1-1c88-465b-b309-33bf8b8f6800'", 
+      "(E1.ExternalRecommendationUUID = 56fe79b1-1c88-465b-b309-33bf8b8f6800)" };
+	  
   private static Edm edm = null;
 
   @BeforeClass
@@ -147,6 +151,13 @@
   }
 
   @Test
+  public void testUUID() {
+    String whereExpression = parseWhereExpression(EXPRESSION_GUID_EQ[INPUT], false);
+    whereExpression = replacePositionalParameters(whereExpression);
+    assertEquals(EXPRESSION_GUID_EQ[OUTPUT], whereExpression);
+  }
+  
+  @Test
   public void testDateTime() {
     String whereExpression = parseWhereExpression(EXPRESSION_DATETIME[INPUT], false);
     whereExpression = replacePositionalParameters(whereExpression);
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAQueryBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAQueryBuilderTest.java
index d65f76e..e8a7192 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAQueryBuilderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAQueryBuilderTest.java
@@ -26,6 +26,7 @@
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
+import java.util.UUID;
 
 import javax.persistence.EntityManager;
 import javax.persistence.Query;
@@ -174,6 +175,9 @@
     EdmProperty edmProperty7 = mockEdmProperty(mapping, "Binary");
     keyPreds.add(mockKeyPredicate(edmProperty7, getBinaryData()));
     
+    EdmProperty edmProperty8 = mockEdmProperty(mapping, "uuid");
+    keyPreds.add(mockKeyPredicate(edmProperty8, "56fe79b1-1c88-465b-b309-32bf8b8f6800"));
+    
     EasyMock.expect(uriInfo.getKeyPredicates()).andStubReturn(keyPreds); 
     EasyMock.replay(edmEntityType, edmEntitySet, uriInfo);
     return uriInfo;
@@ -229,6 +233,8 @@
       EasyMock.expect(edmProperty.getType()).andStubReturn(EdmSimpleTypeKind.Time.getEdmSimpleTypeInstance());
     } else if (type.equals("Binary")) {
       EasyMock.expect(edmProperty.getType()).andStubReturn(EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance());
+    } else if (type.equals("uuid")) {
+      EasyMock.expect(edmProperty.getType()).andStubReturn(EdmSimpleTypeKind.Guid.getEdmSimpleTypeInstance());
     }
     EasyMock.replay(edmProperty);
     return edmProperty;
@@ -506,6 +512,16 @@
     }
   }
   
+  @Test
+  public void buildQueryWithKeyNavSegmentAndFilter() {
+    EdmMapping mapping = (EdmMapping) mockMapping();
+    try {
+      assertNotNull(builder.build((GetEntitySetUriInfo) mockURIInfoWithKeyNavSegAndFilter(mapping)));
+    } catch (ODataException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+  
   @SuppressWarnings("unchecked")
   private GetEntityUriInfo mockURIInfoWithTopSkip(EdmMapping mapping) throws EdmException {
     UriInfo uriInfo = EasyMock.createMock(UriInfo.class);
@@ -555,6 +571,80 @@
 
   }
   
+  private UriInfo mockURIInfoWithKeyNavSegAndFilter(EdmMapping mapping) throws EdmException {
+    UriInfo uriInfo = EasyMock.createMock(UriInfo.class);
+    
+    EdmEntityType startEntityType = EasyMock.createMock(EdmEntityType.class);
+    EasyMock.expect(startEntityType.getMapping()).andStubReturn(mapping);
+    
+    EdmEntitySet startEntitySet = EasyMock.createMock(EdmEntitySet.class);
+    EasyMock.expect(startEntitySet.getEntityType()).andStubReturn(startEntityType);
+    EasyMock.expect(uriInfo.getStartEntitySet()).andStubReturn(startEntitySet);
+    
+    EdmEntityType targetEntityType = EasyMock.createMock(EdmEntityType.class);
+    EasyMock.expect(targetEntityType.getMapping()).andStubReturn((EdmMapping) mockNavEdmMappingForProperty());
+    
+    EdmEntitySet targetEntitySet = EasyMock.createMock(EdmEntitySet.class);
+    EasyMock.expect(targetEntitySet.getEntityType()).andStubReturn(targetEntityType);
+    EasyMock.expect(uriInfo.getTargetEntitySet()).andStubReturn(targetEntitySet);
+    
+    List<KeyPredicate> keyPreds = new ArrayList<KeyPredicate>();
+    EdmProperty edmProperty = mockEdmProperty((EdmMapping) mockMappingWithType("uuid"), "uuid");
+    keyPreds.add(mockKeyPredicate(edmProperty, "56fe79b1-1c88-465b-b309-33bf8b8f6800"));
+    EasyMock.expect(uriInfo.getKeyPredicates()).andStubReturn(keyPreds); 
+    
+    List<NavigationSegment> navSegments = new ArrayList<NavigationSegment>();
+    EasyMock.expect(uriInfo.getNavigationSegments()).andStubReturn(navSegments);
+    NavigationSegment navSegment = EasyMock.createMock(NavigationSegment.class);
+    EasyMock.expect(navSegment.getEntitySet()).andStubReturn(targetEntitySet);
+    List<KeyPredicate> navKeyPreds = new ArrayList<KeyPredicate>();
+    EasyMock.expect(navSegment.getKeyPredicates()).andStubReturn(navKeyPreds);
+    EdmNavigationProperty navEdmProperty = EasyMock.createMock(EdmNavigationProperty.class);
+    EasyMock.expect(navSegment.getNavigationProperty()).andStubReturn(navEdmProperty);
+    EasyMock.expect(navEdmProperty.getMapping()).andStubReturn((EdmMapping)mockNavEdmMappingForProperty());
+    EasyMock.expect(navEdmProperty.getFromRole()).andStubReturn("Customers");
+    EasyMock.expect(navEdmProperty.getToRole()).andStubReturn("SalesOrderHeader");
+    EdmAssociation association = EasyMock.createMock(EdmAssociation.class);
+    EasyMock.expect(navEdmProperty.getRelationship()).andStubReturn(association);
+    EdmAssociationEnd associationEnd = EasyMock.createMock(EdmAssociationEnd.class);
+    EasyMock.expect(associationEnd.getEntityType()).andStubReturn(startEntityType);
+    EasyMock.expect(association.getEnd("Customers")).andStubReturn(associationEnd);
+    navSegments.add(navSegment);
+    
+    FilterExpression filterExpression = EasyMock.createMock(FilterExpression.class);
+    PropertyExpression propExp = EasyMock.createMock(PropertyExpression.class);
+    LiteralExpression literalExp = EasyMock.createMock(LiteralExpression.class);
+    EasyMock.expect(uriInfo.getFilter()).andStubReturn(filterExpression);
+    BinaryExpression commonExpression = EasyMock.createMock(BinaryExpression.class);
+    EasyMock.expect(commonExpression.getOperator()).andStubReturn(BinaryOperator.EQ);
+    EasyMock.expect(commonExpression.getKind()).andStubReturn(ExpressionKind.BINARY);
+    EasyMock.expect(filterExpression.getExpression()).andStubReturn(commonExpression);
+    EasyMock.expect(filterExpression.getKind()).andStubReturn(ExpressionKind.FILTER); 
+    EasyMock.expect(filterExpression.getExpressionString()).andStubReturn(
+        "Customer eq '56fe79b1-1c88-465b-b309-32bf8b8f7800'"); 
+    
+    EasyMock.expect(commonExpression.getLeftOperand()).andStubReturn(propExp);
+    EasyMock.expect(propExp.getEdmProperty()).andStubReturn(mockEdmProperty(
+        (EdmMapping) mockMappingWithType("uuid"), "uuid"));
+    EasyMock.expect(propExp.getKind()).andStubReturn(ExpressionKind.PROPERTY);
+    EasyMock.expect(propExp.getEdmType()).andStubReturn(EdmSimpleTypeKind.Guid.getEdmSimpleTypeInstance());
+    
+    EasyMock.expect(commonExpression.getRightOperand()).andStubReturn(literalExp);
+    EasyMock.expect(literalExp.getUriLiteral()).andStubReturn("guid'56fe79b1-1c88-465b-b309-32bf8b8f7800'");
+    EasyMock.expect(literalExp.getKind()).andStubReturn(ExpressionKind.LITERAL);
+    EasyMock.expect(literalExp.getEdmType()).andStubReturn(EdmSimpleTypeKind.Guid.getEdmSimpleTypeInstance());
+    
+    EasyMock.expect(uriInfo.getOrderBy()).andStubReturn(null);
+    EasyMock.expect(uriInfo.getTop()).andStubReturn(null);
+    EasyMock.expect(uriInfo.getSkip()).andStubReturn(null);
+    
+    EasyMock.replay(startEntityType, targetEntityType, startEntitySet, targetEntitySet, uriInfo,
+        filterExpression, propExp, literalExp, navSegment, navEdmProperty, 
+        commonExpression, association, associationEnd);
+    return uriInfo;
+
+  }
+  
   @SuppressWarnings("unchecked")
   private UriInfo mockURIInfo(EdmMapping mapping) throws EdmException {
     
@@ -618,6 +708,9 @@
     EdmProperty edmProperty7 = mockEdmProperty(mapping, "String");
     keyPreds.add(mockKeyPredicate(edmProperty7, "ABC"));
     
+    EdmProperty edmProperty8 = mockEdmProperty((EdmMapping) mockMappingWithType("uuid"), "uuid");
+    keyPreds.add(mockKeyPredicate(edmProperty8, "56fe79b1-1c88-465b-b309-33bf8b8f6800"));
+    
     EasyMock.expect(uriInfo.getKeyPredicates()).andStubReturn(keyPreds); 
     EasyMock.replay(edmEntityType, edmEntitySet, uriInfo);
     return uriInfo;
@@ -913,6 +1006,8 @@
       mockedEdmMapping.setJPAType(char[].class);
     } else if (type.equals("characterArray")) {
       mockedEdmMapping.setJPAType(Character[].class);
+    } else if (type.equals("uuid")) {
+      mockedEdmMapping.setJPAType(UUID.class);
     }
     return mockedEdmMapping;
   }
diff --git a/odata2-jpa-processor/jpa-core/src/test/resources/metadata.xml b/odata2-jpa-processor/jpa-core/src/test/resources/metadata.xml
index 96f7c99..1617e6f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/resources/metadata.xml
+++ b/odata2-jpa-processor/jpa-core/src/test/resources/metadata.xml
@@ -26,6 +26,7 @@
 				<Property Name="time" Type="Edm.Time" Nullable="false" />
 				<Property Name="text" Type="Edm.String" Nullable="true"
 					MaxLength="255" />
+				<Property Name="ExternalRecommendationUUID" Type="Edm.Guid" Nullable="false"/>
 				<NavigationProperty Name="salesOrderHeader"
 					Relationship="SalesOrderProcessing.Note_SalesOrder" FromRole="Note"
 					ToRole="SalesOrder" />
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/converter/UUIDConverter.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/converter/UUIDConverter.java
new file mode 100644
index 0000000..aec0ece
--- /dev/null
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/converter/UUIDConverter.java
@@ -0,0 +1,21 @@
+package org.apache.olingo.odata2.jpa.processor.ref.converter;
+
+import java.util.UUID;
+
+import javax.persistence.AttributeConverter;
+import javax.persistence.Converter;
+
+@Converter(autoApply = true)
+public class UUIDConverter implements AttributeConverter<UUID, String> {
+
+  @Override
+  public String convertToDatabaseColumn(UUID uuid) {
+    return uuid.toString();
+  }
+
+  @Override
+  public UUID convertToEntityAttribute(String string) {
+    return UUID.fromString(string);
+  }
+
+}
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SampleGuid.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SampleGuid.java
new file mode 100644
index 0000000..91cbede
--- /dev/null
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SampleGuid.java
@@ -0,0 +1,78 @@
+package org.apache.olingo.odata2.jpa.processor.ref.model;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Convert;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "T_SAMPLEGUID")
+public class SampleGuid {
+
+  public SampleGuid() {}
+  
+  public SampleGuid(final int id, final String name) {
+    super();
+    this.id = id;
+    this.name = name;
+  }
+  
+  @Column
+  private int id;
+  
+  @Column
+  private String name;
+  
+  @Id
+  @Convert(converter=org.apache.olingo.odata2.jpa.processor.ref.converter.UUIDConverter.class)
+  @GeneratedValue(generator="reco-UUID")
+  @Column(name = "ExternalRecommendationUUID")
+  private UUID ExternalRecommendationUUID;
+
+  /**
+   * @return the id
+   */
+  public int getId() {
+    return id;
+  }
+
+  /**
+   * @param id the id to set
+   */
+  public void setId(int id) {
+    this.id = id;
+  }
+
+  /**
+   * @return the name
+   */
+  public String getName() {
+    return name;
+  }
+
+  /**
+   * @param name the name to set
+   */
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  /**
+   * @return the externalRecommendationUUID
+   */
+  public UUID getExternalRecommendationUUID() {
+    return ExternalRecommendationUUID;
+  }
+
+  /**
+   * @param externalRecommendationUUID the externalRecommendationUUID to set
+   */
+  public void setExternalRecommendationUUID(UUID externalRecommendationUUID) {
+    ExternalRecommendationUUID = externalRecommendationUUID;
+  }
+  
+}
diff --git a/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml b/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
index 0c8899c..9e4492b 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
+++ b/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
@@ -24,8 +24,10 @@
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Category</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Material</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Employee</class>
+		<class>org.apache.olingo.odata2.jpa.processor.ref.model.SampleGuid</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.converter.BlobToByteConverter</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.converter.ClobToStringConverter</class>
+		<class>org.apache.olingo.odata2.jpa.processor.ref.converter.UUIDConverter</class>
 		<properties>
 			<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" />
 			<property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:mem:apache.olingo.jpa.sample" />
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties
index 6a55bab..3f3d88f 100644
--- a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties
@@ -19,4 +19,4 @@
 
 #This file contains names of file which will contain the SQL statements to be executed by Data generator. Add a file name here and it will be picked up by Generator
 #You need to put the file names in order you want to get them called. First Entry will be inserted first.
-insert_file_names = SQL_Insert_Customer,SQL_Insert_Category,SQL_Insert_SalesOrderHeader,SQL_Insert_Store,SQL_Insert_Material,SQL_Insert_SalesOrderItem,SQL_Insert_Note
\ No newline at end of file
+insert_file_names = SQL_Insert_Customer,SQL_Insert_Category,SQL_Insert_SalesOrderHeader,SQL_Insert_Store,SQL_Insert_Material,SQL_Insert_SalesOrderItem,SQL_Insert_Note,SQL_Insert_SampleGuid
\ No newline at end of file
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SampleGuid.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SampleGuid.properties
new file mode 100644
index 0000000..1903ced
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SampleGuid.properties
@@ -0,0 +1,23 @@
+#-------------------------------------------------------------------------------
+# 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.
+#-------------------------------------------------------------------------------
+
+query_1 = insert into T_SAMPLEGUID (ExternalRecommendationUUID , id, name) values('56fe79b1-1c88-465b-b309-32bf8b8f6800', 111, 'aa');
+query_2 = insert into T_SAMPLEGUID (ExternalRecommendationUUID , id, name) values('56fe79b1-1c88-465b-b309-32bf8b8f7800', 112, 'aab');
+query_3 = insert into T_SAMPLEGUID (ExternalRecommendationUUID , id, name) values('56fe79b1-1c88-465b-b309-33bf8b8f6800', 113, 'aac');
+query_4 = insert into T_SAMPLEGUID (ExternalRecommendationUUID , id, name) values('56fe79b1-1c88-465b-b309-42bf8b8f6800', 114, 'aad');
\ No newline at end of file