cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1351410 - in /cxf/trunk: parent/ rt/rs/extensions/search/ rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/ rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/ rt/rs/extensions/search/src/main/ja...
Date Mon, 18 Jun 2012 16:31:34 GMT
Author: sergeyb
Date: Mon Jun 18 16:31:33 2012
New Revision: 1351410

URL: http://svn.apache.org/viewvc?rev=1351410&view=rev
Log:
[CXF-4221] Initial support for FIQL to JPA convertors, applying a slightly modified patch
on behalf of Jeff Wang

Added:
    cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java
  (with props)
    cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/
    cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitor.java
  (with props)
    cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java
  (with props)
    cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/
    cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java
  (with props)
    cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitorTest.java
  (with props)
    cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java
  (with props)
    cxf/trunk/rt/rs/extensions/search/src/test/resources/
    cxf/trunk/rt/rs/extensions/search/src/test/resources/META-INF/
    cxf/trunk/rt/rs/extensions/search/src/test/resources/META-INF/persistence.xml   (with
props)
Modified:
    cxf/trunk/parent/pom.xml
    cxf/trunk/rt/rs/extensions/search/pom.xml
    cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java
    cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchConditionVisitor.java
    cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
    cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
    cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
    cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java

Modified: cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/parent/pom.xml?rev=1351410&r1=1351409&r2=1351410&view=diff
==============================================================================
--- cxf/trunk/parent/pom.xml (original)
+++ cxf/trunk/parent/pom.xml Mon Jun 18 16:31:33 2012
@@ -146,7 +146,8 @@
         <cxf.geronimo.ws.metadata.version>1.1.3</cxf.geronimo.ws.metadata.version>
         <cxf.geronimo.servlet.version>1.0</cxf.geronimo.servlet.version>
         <cxf.geronimo.servlet25.version>1.1.2</cxf.geronimo.servlet25.version>
-
+        <cxf.geronimo.jpa.version>1.0</cxf.geronimo.jpa.version>
+ 
         <cxf.commons-codec.version>1.4</cxf.commons-codec.version>
         <cxf.commons-lang.version>2.6</cxf.commons-lang.version>
         <cxf.commons-collections.version>3.2.1</cxf.commons-collections.version>

Modified: cxf/trunk/rt/rs/extensions/search/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/pom.xml?rev=1351410&r1=1351409&r2=1351410&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/pom.xml (original)
+++ cxf/trunk/rt/rs/extensions/search/pom.xml Mon Jun 18 16:31:33 2012
@@ -34,6 +34,8 @@
     </parent>
 
     <properties>
+        <hibernate.em.version>4.1.0.Final</hibernate.em.version>
+        <hsqldb.version>1.8.0.10</hsqldb.version>
     </properties>
 
     <dependencies>
@@ -47,12 +49,30 @@
             <artifactId>cxf-rt-frontend-jaxrs</artifactId>
             <version>${project.version}</version>
         </dependency>
-        
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <version>${cxf.geronimo.jpa.version}</version>
+            <scope>provided</scope>
+            <optional>true</optional>
+        </dependency>        
         <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymock</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-entitymanager</artifactId>
+			<version>${hibernate.em.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>hsqldb</groupId>
+			<artifactId>hsqldb</artifactId>
+			<version>1.8.0.10</version>
+			<scope>test</scope>
+		</dependency>
     </dependencies>
     <build>
         <plugins>

Added: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java?rev=1351410&view=auto
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java
(added)
+++ cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java
Mon Jun 18 16:31:33 2012
@@ -0,0 +1,47 @@
+/**
+ * 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.cxf.jaxrs.ext.search;
+
+import java.util.Map;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+
+
+public abstract class AbstractSearchConditionVisitor <T> implements SearchConditionVisitor<T>
{
+
+    private static final Logger LOG = LogUtils.getL7dLogger(AbstractSearchConditionVisitor.class);
+    
+    private Map<String, String> fieldMap;
+    
+    protected AbstractSearchConditionVisitor(Map<String, String> fieldMap) {
+        this.fieldMap = fieldMap;
+    }
+    
+    protected String getRealPropertyName(String name) {
+        if (fieldMap != null) {
+            if (fieldMap.containsKey(name)) {
+                return fieldMap.get(name);
+            } else {
+                LOG.warning("Unrecognized field alias : " + name);
+            }
+        }
+        return name;
+    }
+}

Propchange: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java?rev=1351410&r1=1351409&r2=1351410&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java
(original)
+++ cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java
Mon Jun 18 16:31:33 2012
@@ -92,18 +92,4 @@ public interface SearchCondition<T> {
      */
     void accept(SearchConditionVisitor<T> visitor);
     
-    /**
-     * 
-     * This method is now deprecated and will be removed soon.
-     * 
-     * Utility method for converting this condition into an SQL expression
-     * @param table table name
-     * @param columns column names, a wildcard as in 'SELECT * from table' will be used
-     *                if names are not provided 
-     * @return SQL expression
-     */    
-    @Deprecated
-    String toSQL(String table, String... columns);
-    
-    
 }

Modified: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchConditionVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchConditionVisitor.java?rev=1351410&r1=1351409&r2=1351410&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchConditionVisitor.java
(original)
+++ cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchConditionVisitor.java
Mon Jun 18 16:31:33 2012
@@ -29,11 +29,4 @@ public interface SearchConditionVisitor<
      * Callback providing a current SearchCondition object 
      */
     void visit(SearchCondition<T> sc);
-    
-    /**
-     * Recover the accumulated query
-     * @return query string
-     */
-    String getResult();
-
 }

Modified: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java?rev=1351410&r1=1351409&r2=1351410&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
(original)
+++ cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
Mon Jun 18 16:31:33 2012
@@ -19,6 +19,7 @@
 package org.apache.cxf.jaxrs.ext.search;
 
 import java.text.SimpleDateFormat;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.cxf.jaxrs.ext.search.sql.SQLPrinterVisitor;
@@ -43,24 +44,31 @@ public final class SearchUtils {
     }
     
     public static <T> String toSQL(SearchCondition<T> sc, String table, String...
columns) {
-        SearchConditionVisitor<T> visitor = new SQLPrinterVisitor<T>(table, columns);
+        SQLPrinterVisitor<T> visitor = new SQLPrinterVisitor<T>(table, columns);
         sc.accept(visitor);
-        return visitor.getResult();
+        return visitor.getQuery();
     }
     
-    public static void startSqlQuery(StringBuilder sb, String table, String... columns) {
+    public static void startSqlQuery(StringBuilder sb, 
+                                     String table,
+                                     String tableAlias,
+                                     List<String> columns) {
         sb.append("SELECT ");
-        if (columns.length > 0) {
-            for (int i = 0; i < columns.length; i++) {
-                sb.append(columns[i]);
-                if (i + 1 < columns.length) {
+        if (columns != null && columns.size() > 0) {
+            for (int i = 0; i < columns.size(); i++) {
+                sb.append(columns.get(i));
+                if (i + 1 < columns.size()) {
                     sb.append(",");
                 }
             }
         } else {
             sb.append("*");
         }
-        sb.append(" FROM ").append(table).append(" WHERE ");
+        sb.append(" FROM ").append(table);
+        if (tableAlias != null) {
+            sb.append(" " + tableAlias);
+        }
+        sb.append(" WHERE ");
     }
     
     public static String conditionTypeToSqlOperator(ConditionType ct, String value) {

Added: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitor.java?rev=1351410&view=auto
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitor.java
(added)
+++ cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitor.java
Mon Jun 18 16:31:33 2012
@@ -0,0 +1,56 @@
+/**
+ * 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.cxf.jaxrs.ext.search.jpa;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.cxf.jaxrs.ext.search.SearchCondition;
+import org.apache.cxf.jaxrs.ext.search.sql.SQLPrinterVisitor;
+
+public class JPALanguageVisitor<T> extends SQLPrinterVisitor<T> {
+
+    
+    public JPALanguageVisitor(Class<T> tClass) {
+        this(tClass, "t", null);
+    }
+    
+    public JPALanguageVisitor(Class<T> tClass, String tableAlias) {
+        this(tClass, tableAlias, null);
+    }
+    
+    public JPALanguageVisitor(Class<T> tClass,
+                              Map<String, String> fieldMap) {
+        this(tClass, "t", fieldMap);
+    }
+    
+    public JPALanguageVisitor(Class<T> tClass,
+                              String tableAlias,
+                              Map<String, String> fieldMap) {
+        super(fieldMap, 
+              tClass.getSimpleName(), 
+              tableAlias, 
+              tableAlias != null ? Collections.singletonList(tableAlias) : null);
+    }
+        
+    public void visit(SearchCondition<T> sc) {
+        // provide more customizations as needed
+        super.visit(sc);
+    }
+}

Propchange: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java?rev=1351410&view=auto
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java
(added)
+++ cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java
Mon Jun 18 16:31:33 2012
@@ -0,0 +1,160 @@
+/**
+ * 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.cxf.jaxrs.ext.search.jpa;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Path;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+import org.apache.cxf.jaxrs.ext.search.AbstractSearchConditionVisitor;
+import org.apache.cxf.jaxrs.ext.search.ConditionType;
+import org.apache.cxf.jaxrs.ext.search.OrSearchCondition;
+import org.apache.cxf.jaxrs.ext.search.PrimitiveStatement;
+import org.apache.cxf.jaxrs.ext.search.SearchCondition;
+
+public class JPATypedQueryVisitor<T> extends AbstractSearchConditionVisitor<T>
{
+
+    private EntityManager em;
+    private Class<T> tClass;
+    private Root<T> root;
+    private CriteriaBuilder builder;
+    private CriteriaQuery<T> cq;
+    private Stack<List<Predicate>> predStack = new Stack<List<Predicate>>();
+    private boolean criteriaFinalized;
+    
+    public JPATypedQueryVisitor(EntityManager em, Class<T> tClass) {
+        this(em, tClass, null);
+    }
+    
+    public JPATypedQueryVisitor(EntityManager em, Class<T> tClass, Map<String, String>
fieldMap) {
+        super(fieldMap);
+        this.em = em;
+        this.tClass = tClass;
+    }
+    
+    public void visit(SearchCondition<T> sc) {
+        if (builder == null) {
+            builder = em.getCriteriaBuilder();
+            cq = builder.createQuery(tClass);
+            root = cq.from(tClass);
+            predStack.push(new ArrayList<Predicate>());
+        }
+        PrimitiveStatement statement = sc.getStatement();
+        if (statement != null) {
+            if (statement.getProperty() != null) {
+                predStack.peek().add(buildPredicate(sc.getConditionType(), 
+                                                    statement.getProperty(), 
+                                                    statement.getValue()));
+            }
+        } else {
+            predStack.push(new ArrayList<Predicate>());
+            for (SearchCondition<T> condition : sc.getSearchConditions()) {
+                condition.accept(this);
+            }
+            Predicate[] preds = predStack.pop().toArray(new Predicate[0]);
+            Predicate newPred;
+            if (sc instanceof OrSearchCondition) {
+                newPred = builder.or(preds);
+            } else {
+                newPred = builder.and(preds);
+            }
+            predStack.peek().add(newPred);
+        }
+    }
+
+    public TypedQuery<T> getQuery() {
+        return em.createQuery(getCriteriaQuery());
+    }
+    
+    public CriteriaQuery<T> getCriteriaQuery() {
+        if (!criteriaFinalized) {
+            cq.where(predStack.pop().toArray(new Predicate[0]));
+            criteriaFinalized = true;
+        }
+        return cq;
+    }
+    
+    
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    private Predicate buildPredicate(ConditionType ct, String name, Object value) {
+
+        Class<? extends Comparable> clazz = (Class<? extends Comparable>) value
+                        .getClass();
+        
+        name = super.getRealPropertyName(name);
+        
+        Path<?> path = getPath(root, name);
+        
+        Predicate pred = null;
+        switch (ct) {
+        case GREATER_THAN:
+            pred = builder.greaterThan(path.as(clazz), clazz.cast(value));
+            break;
+        case EQUALS:
+            if (clazz.equals(String.class)) {
+                pred = builder.like(path.as(String.class), "%"
+                                    + (String) value + "%");
+            } else {
+                pred = builder.equal(path.as(clazz), clazz.cast(value));
+            }
+            break;
+        case NOT_EQUALS:
+            pred = builder.notEqual(path.as(clazz), 
+                                    clazz.cast(value));
+            break;
+        case LESS_THAN:
+            pred = builder.lessThan(path.as(clazz), 
+                                    clazz.cast(value));
+            break;
+        case LESS_OR_EQUALS:
+            pred = builder.lessThanOrEqualTo(path.as(clazz), 
+                                             clazz.cast(value));
+            break;
+        case GREATER_OR_EQUALS:
+            pred = builder.greaterThanOrEqualTo(path.as(clazz), 
+                                                clazz.cast(value));
+            break;
+        default: 
+            break;
+        }
+        return pred;
+    }
+
+    private Path<?> getPath(Path<?> element, String name) {
+        if (name.contains(".")) {
+            String pre = name.substring(0, name.indexOf('.'));
+            String post = name.substring(name.indexOf('.') + 1);
+            Path<?> newPath = element.get(pre);
+            return getPath(newPath, post);
+        } else {
+            return element.get(name);
+        }
+    }
+    
+    
+}

Propchange: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java?rev=1351410&r1=1351409&r2=1351410&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
(original)
+++ cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
Mon Jun 18 16:31:33 2012
@@ -18,33 +18,41 @@
  */
 package org.apache.cxf.jaxrs.ext.search.sql;
 
+import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
-import java.util.logging.Logger;
 
-import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxrs.ext.search.AbstractSearchConditionVisitor;
 import org.apache.cxf.jaxrs.ext.search.PrimitiveStatement;
 import org.apache.cxf.jaxrs.ext.search.SearchCondition;
-import org.apache.cxf.jaxrs.ext.search.SearchConditionVisitor;
 import org.apache.cxf.jaxrs.ext.search.SearchUtils;
 
 
-public class SQLPrinterVisitor<T> implements SearchConditionVisitor<T> {
+public class SQLPrinterVisitor<T> extends AbstractSearchConditionVisitor<T> {
 
-    private static final Logger LOG = LogUtils.getL7dLogger(SQLPrinterVisitor.class);
-    
     private StringBuilder sb;
     private String table;
-    private String[] columns;
-    private Map<String, String> fieldMap;
+    private String tableAlias;
+    private List<String> columns;
     
     public SQLPrinterVisitor(String table, String... columns) {
-        this(null, table, columns);
+        this(null, table, Arrays.asList(columns));
+    }
+    
+    public SQLPrinterVisitor(Map<String, String> fieldMap, 
+                             String table,
+                             List<String> columns) {
+        this(fieldMap, table, null, columns);
     }
     
-    public SQLPrinterVisitor(Map<String, String> fieldMap, String table, String...
columns) {
-        this.fieldMap = fieldMap;
+    public SQLPrinterVisitor(Map<String, String> fieldMap, 
+                             String table, 
+                             String tableAlias,
+                             List<String> columns) {
+        super(fieldMap);
         this.columns = columns;
         this.table = table;
+        this.tableAlias = tableAlias;
     }
     
     public void visit(SearchCondition<T> sc) {
@@ -52,7 +60,7 @@ public class SQLPrinterVisitor<T> implem
         if (sb == null) {
             sb = new StringBuilder();
             if (table != null) {
-                SearchUtils.startSqlQuery(sb, table, columns);
+                SearchUtils.startSqlQuery(sb, table, tableAlias, columns);
             }
         }
         
@@ -60,14 +68,10 @@ public class SQLPrinterVisitor<T> implem
         if (statement != null) {
             if (statement.getProperty() != null) {
                 String rvalStr = statement.getValue().toString().replaceAll("\\*", "%");
-                String name = statement.getProperty();
-                if (fieldMap != null) {
-                    if (fieldMap.containsKey(name)) {
-                        name = fieldMap.get(name);
-                    } else {
-                        LOG.warning("Unrecognized field alias : " + name);
-                        return;
-                    }
+                String name = getRealPropertyName(statement.getProperty());
+               
+                if (tableAlias != null) {
+                    name = tableAlias + "." + name;
                 }
                 
                 sb.append(name).append(" ").append(
@@ -90,7 +94,12 @@ public class SQLPrinterVisitor<T> implem
     }
     
 
+    @Deprecated
     public String getResult() {
+        return getQuery();
+    }
+    
+    public String getQuery() {
         return sb == null ? null : sb.toString();
     }
 }

Modified: cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java?rev=1351410&r1=1351409&r2=1351410&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
(original)
+++ cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
Mon Jun 18 16:31:33 2012
@@ -193,11 +193,10 @@ public class FiqlParserTest extends Asse
         assertFalse(filter.isMet(new Condition("am", 20, null)));
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testSQL1() throws FiqlParseException {
         SearchCondition<Condition> filter = parser.parse("name==ami*;level=gt=10");
-        String sql = filter.toSQL("table");
+        String sql = SearchUtils.toSQL(filter, "table");
         assertTrue("SELECT * FROM table WHERE (name LIKE 'ami%') AND (level > '10')".equals(sql)
                    || "SELECT * FROM table WHERE (level > '10') AND (name LIKE 'ami%')".equals(sql));
     }
@@ -222,11 +221,10 @@ public class FiqlParserTest extends Asse
         assertFalse(filter.isMet(new Condition("foo", 0, null)));
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testSQL2() throws FiqlParseException {
         SearchCondition<Condition> filter = parser.parse("name==ami*,level=gt=10");
-        String sql = filter.toSQL("table");
+        String sql = SearchUtils.toSQL(filter, "table");
         assertTrue("SELECT * FROM table WHERE (name LIKE 'ami%') OR (level > '10')".equals(sql)
                    || "SELECT * FROM table WHERE (level > '10') OR (name LIKE 'ami%')".equals(sql));
     }
@@ -240,33 +238,30 @@ public class FiqlParserTest extends Asse
         assertFalse(filter.isMet(new Condition("bar", 20, null)));
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testSQL3() throws FiqlParseException {
         SearchCondition<Condition> filter = parser.parse("name==foo*;(name!=*bar,level=gt=10)");
-        String sql = filter.toSQL("table");
+        String sql = SearchUtils.toSQL(filter, "table");
         assertTrue(("SELECT * FROM table WHERE (name LIKE 'foo%') AND ((name NOT LIKE '%bar')
"
                     + "OR (level > '10'))").equals(sql)
                    || ("SELECT * FROM table WHERE (name LIKE 'foo%') AND "
                        + "((level > '10') OR (name NOT LIKE '%bar'))").equals(sql));
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testSQL4() throws FiqlParseException {
         SearchCondition<Condition> filter = parser.parse("(name==test,level==18);(name==test1,level!=19)");
-        String sql = filter.toSQL("table");
+        String sql = SearchUtils.toSQL(filter, "table");
         assertTrue(("SELECT * FROM table WHERE ((name = 'test') OR (level = '18'))"
                     + " AND ((name = 'test1') OR (level <> '19'))").equals(sql)
                    || ("SELECT * FROM table WHERE ((name = 'test1') OR (level <> '19'))"
                        + " AND ((name = 'test') OR (level = '18'))").equals(sql));
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testSQL5() throws FiqlParseException {
         SearchCondition<Condition> filter = parser.parse("name==test");
-        String sql = filter.toSQL("table");
+        String sql = SearchUtils.toSQL(filter, "table");
         assertTrue("SELECT * FROM table WHERE name = 'test'".equals(sql));
     }
 

Added: cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java?rev=1351410&view=auto
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java
(added)
+++ cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java
Mon Jun 18 16:31:33 2012
@@ -0,0 +1,36 @@
+/**
+ * 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.cxf.jaxrs.ext.search.jpa;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity(name = "Book")
+public class Book {
+    @Id
+    private int id;
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+}

Propchange: cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitorTest.java?rev=1351410&view=auto
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitorTest.java
(added)
+++ cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitorTest.java
Mon Jun 18 16:31:33 2012
@@ -0,0 +1,38 @@
+/**
+ * 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.cxf.jaxrs.ext.search.jpa;
+
+import org.apache.cxf.jaxrs.ext.search.FiqlParser;
+import org.apache.cxf.jaxrs.ext.search.SearchCondition;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class JPALanguageVisitorTest extends Assert {
+
+    @Test
+    public void testSimpleQuery() throws Exception {
+        
+        SearchCondition<Book> filter = new FiqlParser<Book>(Book.class).parse("id=lt=10");
+        JPALanguageVisitor<Book> jpa = new JPALanguageVisitor<Book>(Book.class);
+        filter.accept(jpa);
+        assertEquals("SELECT t FROM Book t WHERE t.id < '10'", jpa.getQuery());
+        
+    }
+}

Propchange: cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitorTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java?rev=1351410&view=auto
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java
(added)
+++ cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java
Mon Jun 18 16:31:33 2012
@@ -0,0 +1,110 @@
+/**
+ * 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.cxf.jaxrs.ext.search.jpa;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.persistence.TypedQuery;
+
+import org.apache.cxf.jaxrs.ext.search.FiqlParser;
+import org.apache.cxf.jaxrs.ext.search.SearchCondition;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JPATypedQueryVisitorTest extends Assert {
+
+    private EntityManagerFactory emFactory;
+
+    private EntityManager em;
+
+    private Connection connection;
+
+    @Before
+    public void setUp() throws Exception {
+        try {
+            Class.forName("org.hsqldb.jdbcDriver");
+            connection = DriverManager.getConnection("jdbc:hsqldb:mem:books-jpa", "sa", "");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            fail("Exception during HSQL database init.");
+        }
+        try {
+            emFactory = Persistence.createEntityManagerFactory("testUnit");
+            em = emFactory.createEntityManager();
+         
+            em.getTransaction().begin();
+            Book b1 = new Book();
+            b1.setId(9);
+            em.persist(b1);
+            assertTrue(em.contains(b1));
+            Book b2 = new Book();
+            b2.setId(10);
+            em.persist(b2);
+            assertTrue(em.contains(b2));
+            Book b3 = new Book();
+            b3.setId(11);
+            em.persist(b3);
+            assertTrue(em.contains(b3));
+            
+            
+            em.getTransaction().commit();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            fail("Exception during JPA EntityManager creation.");
+        }
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        try {
+            if (em != null) {
+                em.close();
+            }
+            if (emFactory != null) {
+                emFactory.close();
+            }
+        } finally {    
+            try {
+                connection.createStatement().execute("SHUTDOWN");
+            } catch (Exception ex) {
+                ex.printStackTrace();
+            }
+        }
+    }
+    
+    @Test
+    public void testSimpleQuery() throws Exception {
+        SearchCondition<Book> filter = new FiqlParser<Book>(Book.class).parse("id=lt=10,id=gt=10");
+        JPATypedQueryVisitor<Book> jpa = new JPATypedQueryVisitor<Book>(em, Book.class);
+        filter.accept(jpa);
+        TypedQuery<Book> query = jpa.getQuery();
+        List<Book> books = query.getResultList();
+        assertEquals(2, books.size());
+        assertTrue(9 == books.get(0).getId() && 11 == books.get(1).getId()
+            || 11 == books.get(0).getId() && 9 == books.get(1).getId());
+    }
+}

Propchange: cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java?rev=1351410&r1=1351409&r2=1351410&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java
(original)
+++ cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java
Mon Jun 18 16:31:33 2012
@@ -39,7 +39,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<Condition> filter = parser.parse("name==ami*;level=gt=10");
         SQLPrinterVisitor<Condition> visitor = new SQLPrinterVisitor<Condition>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         
         assertTrue("SELECT * FROM table WHERE (name LIKE 'ami%') AND (level > '10')".equals(sql)
                    || "SELECT * FROM table WHERE (level > '10') AND (name LIKE 'ami%')".equals(sql));
@@ -51,7 +51,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<SearchBean> filter = beanParser.parse("name==ami*;level=gt=10");
         SQLPrinterVisitor<SearchBean> visitor = new SQLPrinterVisitor<SearchBean>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         
         assertTrue("SELECT * FROM table WHERE (name LIKE 'ami%') AND (level > '10')".equals(sql)
                    || "SELECT * FROM table WHERE (level > '10') AND (name LIKE 'ami%')".equals(sql));
@@ -62,7 +62,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<Condition> filter = parser.parse("name==ami*,level=gt=10");
         SQLPrinterVisitor<Condition> visitor = new SQLPrinterVisitor<Condition>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue("SELECT * FROM table WHERE (name LIKE 'ami%') OR (level > '10')".equals(sql)
                    || "SELECT * FROM table WHERE (level > '10') OR (name LIKE 'ami%')".equals(sql));
     }
@@ -72,7 +72,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<Condition> filter = parser.parse("name==foo*;(name!=*bar,level=gt=10)");
         SQLPrinterVisitor<Condition> visitor = new SQLPrinterVisitor<Condition>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue(("SELECT * FROM table WHERE (name LIKE 'foo%') AND ((name NOT LIKE '%bar')
"
                    + "OR (level > '10'))").equals(sql)
                    || ("SELECT * FROM table WHERE (name LIKE 'foo%') AND "
@@ -85,7 +85,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<SearchBean> filter = beanParser.parse("name==foo*;(name!=*bar,level=gt=10)");
         SQLPrinterVisitor<SearchBean> visitor = new SQLPrinterVisitor<SearchBean>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue(("SELECT * FROM table WHERE (name LIKE 'foo%') AND ((name NOT LIKE '%bar')
"
                    + "OR (level > '10'))").equals(sql)
                    || ("SELECT * FROM table WHERE (name LIKE 'foo%') AND "
@@ -97,7 +97,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<Condition> filter = parser.parse("(name==test,level==18);(name==test1,level!=19)");
         SQLPrinterVisitor<Condition> visitor = new SQLPrinterVisitor<Condition>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue(("SELECT * FROM table WHERE ((name = 'test') OR (level = '18'))"
                    + " AND ((name = 'test1') OR (level <> '19'))").equals(sql)
                    || ("SELECT * FROM table WHERE ((name = 'test1') OR (level <> '19'))"
@@ -109,7 +109,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<Condition> filter = parser.parse("name==test");
         SQLPrinterVisitor<Condition> visitor = new SQLPrinterVisitor<Condition>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue("SELECT * FROM table WHERE name = 'test'".equals(sql));
     }
     
@@ -119,7 +119,7 @@ public class SQLPrinterVisitorTest exten
         SQLPrinterVisitor<Condition> visitor = 
             new SQLPrinterVisitor<Condition>("table", "NAMES");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue("SELECT NAMES FROM table WHERE name = 'test'".equals(sql));
     }
     
@@ -129,9 +129,9 @@ public class SQLPrinterVisitorTest exten
         SQLPrinterVisitor<Condition> visitor = 
             new SQLPrinterVisitor<Condition>(
                 Collections.singletonMap("name", "NAMES"),
-                "table", "NAMES");
+                "table", Collections.singletonList("NAMES"));
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue("SELECT NAMES FROM table WHERE NAMES = 'test'".equals(sql));
     }
     

Added: cxf/trunk/rt/rs/extensions/search/src/test/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/test/resources/META-INF/persistence.xml?rev=1351410&view=auto
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/test/resources/META-INF/persistence.xml (added)
+++ cxf/trunk/rt/rs/extensions/search/src/test/resources/META-INF/persistence.xml Mon Jun
18 16:31:33 2012
@@ -0,0 +1,18 @@
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+             version="2.0">
+   <persistence-unit name="testUnit" transaction-type="RESOURCE_LOCAL">
+    <provider>org.hibernate.ejb.HibernatePersistence</provider>
+    <class>org.apache.cxf.jaxrs.ext.search.jpa.Book</class>
+    <exclude-unlisted-classes>true</exclude-unlisted-classes>
+    <properties>
+        <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:books-jpa"/>
+        <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
+        <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
+        <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+        <property name="hibernate.connection.username" value="sa"/>
+        <property name="hibernate.connection.password" value=""/>
+    </properties>
+</persistence-unit>
+</persistence>
\ No newline at end of file

Propchange: cxf/trunk/rt/rs/extensions/search/src/test/resources/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/rs/extensions/search/src/test/resources/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/rs/extensions/search/src/test/resources/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message