You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Patrick Linskey <pl...@gmail.com> on 2010/02/13 01:29:32 UTC

Re: How to configure a XMLStoreManager

Hi,

I just noticed this thread. Are you still having this problem?

I've been working with the AbstractStoreManager (of which the  
XMLStoreManager is a basic example) recently, so I might be able to  
point you in the right direction.

Also, note that the XMLStoreManager generates lousy XML.

-Patrick

On Jan 8, 2010, at 3:06 PM, Donald Woods wrote:

> I looked through the user docs (nothing there) and Google'd for it,  
> but I can't seem to get the XMLStoreManager to work.
>
> I created a persistence.xml with the following properties -
>
> <property name="openjpa.BrokerFactory"
>  value="org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory"/>
> <property
>  name="openjpa.abstractstore.AbstractStoreManager"
>  value="org.apache.openjpa.xmlstore.XMLStoreManager" />
>
> But am getting the following exception when running a junit -
>
> testGroupBy 
> (org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery)  Time  
> elapsed: 0.505 sec  <<< ERROR!
> java.lang.RuntimeException: <openjpa-2.0.0-SNAPSHOT-r422266:897056M  
> nonfatal general error>  
> org.apache.openjpa.persistence.PersistenceException:  
> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to  
> org.apache.openjpa.jdbc.kernel.JDBCStore
> 	at  
> org 
> .apache 
> .openjpa 
> .persistence.jdbc.query.TestGroupByQuery.setUp(TestGroupByQuery.java: 
> 47)
> 	at junit.framework.TestCase.runBare(TestCase.java:125)
> ...
> Caused by: <openjpa-2.0.0-SNAPSHOT-r422266:897056M nonfatal general  
> error> org.apache.openjpa.persistence.PersistenceException:  
> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to  
> org.apache.openjpa.jdbc.kernel.JDBCStore
> 	at  
> org 
> .apache 
> .openjpa 
> .kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java: 
> 214)
> 	at  
> org 
> .apache 
> .openjpa 
> .kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java: 
> 194)
> 	at  
> org 
> .apache 
> .openjpa 
> .kernel 
> .DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:152)
> 	at  
> org 
> .apache 
> .openjpa 
> .persistence 
> .EntityManagerFactoryImpl 
> .createEntityManager(EntityManagerFactoryImpl.java:200)
> 	at  
> org 
> .apache 
> .openjpa 
> .persistence 
> .EntityManagerFactoryImpl 
> .createEntityManager(EntityManagerFactoryImpl.java:151)
> 	at  
> org 
> .apache 
> .openjpa 
> .persistence 
> .jdbc.query.TestGroupByQuery.createData(TestGroupByQuery.java:52)
> 	at  
> org 
> .apache 
> .openjpa 
> .persistence.jdbc.query.TestGroupByQuery.setUp(TestGroupByQuery.java: 
> 45)
> 	... 24 more
> Caused by: java.lang.ClassCastException:  
> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to  
> org.apache.openjpa.jdbc.kernel.JDBCStore
> 	at  
> org 
> .apache 
> .openjpa 
> .jdbc 
> .kernel 
> .PessimisticLockManager.setContext(PessimisticLockManager.java:63)
> 	at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java: 
> 354)
> 	at  
> org 
> .apache 
> .openjpa 
> .kernel 
> .AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java: 
> 229)
> 	at  
> org 
> .apache 
> .openjpa 
> .kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java: 
> 208)
> 	... 30 more
>
>
> Any ideas?
> -Donald
>
>
>
>
> Index: src/test/java/org/apache/openjpa/persistence/jdbc/query/ 
> domain/IndoorGame.java
> ===================================================================
> --- src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
> IndoorGame.java	(revision 0)
> +++ src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
> IndoorGame.java	(revision 0)
> @@ -0,0 +1,43 @@
> +/*
> + * TestLockGroupsWithHorizontalBaseType.java
> + *
> + * Created on October 4, 2006, 5:03 PM
> + *
> + * To change this template, choose Tools | Template Manager
> + * and open the template in the editor.
> + */
> +
> +/*
> + * 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.openjpa.persistence.jdbc.query.domain;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class IndoorGame extends Game {
> +	private int nPlayer;
> +
> +	public int getPlayer() {
> +		return nPlayer;
> +	}
> +
> +	public void setPlayer(int n) {
> +		this.nPlayer = n;
> +	}
> +}
>
> Property changes on: src/test/java/org/apache/openjpa/persistence/ 
> jdbc/query/domain/IndoorGame.java
> ___________________________________________________________________
> Added: svn:eol-style
>   + native
>
> Index: src/test/java/org/apache/openjpa/persistence/jdbc/query/ 
> domain/Chess.java
> ===================================================================
> --- src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
> Chess.java	(revision 0)
> +++ src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
> Chess.java	(revision 0)
> @@ -0,0 +1,43 @@
> +/*
> + * TestLockGroupsWithHorizontalBaseType.java
> + *
> + * Created on October 4, 2006, 5:03 PM
> + *
> + * To change this template, choose Tools | Template Manager
> + * and open the template in the editor.
> + */
> +
> +/*
> + * 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.openjpa.persistence.jdbc.query.domain;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class Chess extends IndoorGame {
> +	private int nPiece;
> +
> +	public int getPiece() {
> +		return nPiece;
> +	}
> +
> +	public void setPiece(int n) {
> +		this.nPiece = n;
> +	}
> +}
>
> Property changes on: src/test/java/org/apache/openjpa/persistence/ 
> jdbc/query/domain/Chess.java
> ___________________________________________________________________
> Added: svn:eol-style
>   + native
>
> Index: src/test/java/org/apache/openjpa/persistence/jdbc/query/ 
> domain/Game.java
> ===================================================================
> --- src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
> Game.java	(revision 0)
> +++ src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
> Game.java	(revision 0)
> @@ -0,0 +1,65 @@
> +/*
> + * TestLockGroupsWithHorizontalBaseType.java
> + *
> + * Created on October 4, 2006, 5:03 PM
> + *
> + * To change this template, choose Tools | Template Manager
> + * and open the template in the editor.
> + */
> +
> +/*
> + * 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.openjpa.persistence.jdbc.query.domain;
> +
> +import javax.persistence.Entity;
> +import javax.persistence.GeneratedValue;
> +import javax.persistence.Id;
> +import javax.persistence.Inheritance;
> +import javax.persistence.InheritanceType;
> +
> +/**
> + * Simple unrelated persistent entity used to test logically union  
> queries.
> + * This class is root of an inheritance hierarchy using TABLE PER  
> CLASS
> + * strategy. Polymorphic queries on this class needs to run logical  
> union
> + * of queries on all known subclasses.
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +@Entity
> +@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
> +public class Game {
> +	@Id
> +	@GeneratedValue
> +	private long id;
> +	
> +	private String name;
> +
> +	public long getId() {
> +		return id;
> +	}
> +
> +	public String getName() {
> +		return name;
> +	}
> +
> +	public void setName(String name) {
> +		this.name = name;
> +	}
> +}
>
> Property changes on: src/test/java/org/apache/openjpa/persistence/ 
> jdbc/query/domain/Game.java
> ___________________________________________________________________
> Added: svn:eol-style
>   + native
>
> Index: src/test/java/org/apache/openjpa/persistence/jdbc/query/ 
> domain/Scrabble.java
> ===================================================================
> --- src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
> Scrabble.java	(revision 0)
> +++ src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
> Scrabble.java	(revision 0)
> @@ -0,0 +1,44 @@
> +/*
> + * TestLockGroupsWithHorizontalBaseType.java
> + *
> + * Created on October 4, 2006, 5:03 PM
> + *
> + * To change this template, choose Tools | Template Manager
> + * and open the template in the editor.
> + */
> +
> +/*
> + * 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.openjpa.persistence.jdbc.query.domain;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class Scrabble extends IndoorGame {
> +	private int nTile;
> +
> +	public int getTile() {
> +		return nTile;
> +	}
> +
> +	public void setTile(int n) {
> +		this.nTile = n;
> +	}
> +
> +}
>
> Property changes on: src/test/java/org/apache/openjpa/persistence/ 
> jdbc/query/domain/Scrabble.java
> ___________________________________________________________________
> Added: svn:eol-style
>   + native
>
> Index: src/test/java/org/apache/openjpa/persistence/jdbc/query/ 
> TestGroupByQuery.java
> ===================================================================
> --- src/test/java/org/apache/openjpa/persistence/jdbc/query/ 
> TestGroupByQuery.java	(revision 0)
> +++ src/test/java/org/apache/openjpa/persistence/jdbc/query/ 
> TestGroupByQuery.java	(revision 0)
> @@ -0,0 +1,75 @@
> +/*
> + * 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.openjpa.persistence.jdbc.query;
> +
> +import java.util.List;
> +
> +import javax.persistence.EntityManager;
> +
> +import org.apache.openjpa.persistence.jdbc.query.domain.IndoorGame;
> +import org.apache.openjpa.persistence.jdbc.query.domain.Scrabble;
> +import org.apache.openjpa.persistence.jdbc.query.domain.Chess;
> +import org.apache.openjpa.persistence.jdbc.query.domain.Game;
> +import org.apache.openjpa.persistence.test.SingleEMFTestCase;
> +
> +/**
> + * Tests GROUP BY in sub query does not get parsed by owning query.
> + *
> + * Further details can be found in <A
> + * HREF="https://issues.apache.org/jira/browse/ 
> OPENJPA-28">OPENJPA-28</A>
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +public class TestGroupByQuery extends SingleEMFTestCase {
> +	public void setUp() {
> +        super.setUp(DROP_TABLES, Game.class, IndoorGame.class,  
> Scrabble.class,
> +				Chess.class);
> +		try {
> +			createData();
> +		} catch (Exception e) {
> +			throw new RuntimeException(e);
> +		}
> +	}
> +
> +	void createData() throws Exception {
> +		EntityManager em = emf.createEntityManager();
> +		em.getTransaction().begin();
> +        Class[] classes = { Game.class, IndoorGame.class,  
> Scrabble.class,
> +				Chess.class };
> +		for (Class cls : classes) {
> +			for (int i = 1; i <= 4; i++) {
> +				Game p = (Game) cls.newInstance();
> +				p.setName(cls.getSimpleName() + "-" + i);
> +				em.persist(p);
> +			}
> +		}
> +		em.getTransaction().commit();
> +	}
> +
> +	public void testGroupBy() {
> +		String jpql = "SELECT g.name, g.nTile FROM Scrabble g WHERE "
> +                + "(g.name = ANY(SELECT g1.name FROM Scrabble g1 "
> +				+ "GROUP BY g1.name )) ORDER BY g.name";
> +		EntityManager em = emf.createEntityManager();
> +
> +        List<IndoorGame> employees =  
> em.createQuery(jpql).getResultList();
> +
> +	}
> +}
>
> Property changes on: src/test/java/org/apache/openjpa/persistence/ 
> jdbc/query/TestGroupByQuery.java
> ___________________________________________________________________
> Added: svn:eol-style
>   + native
>
> Index: src/test/ant/enhancer.xml
> ===================================================================
> --- src/test/ant/enhancer.xml	(revision 0)
> +++ src/test/ant/enhancer.xml	(revision 0)
> @@ -0,0 +1,76 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +    Licensed to the Apache Software Foundation (ASF) under one
> +    or more contributor license agreements.  See the NOTICE file
> +    distributed with this work for additional information
> +    regarding copyright ownership.  The ASF licenses this file
> +    to you under the Apache License, Version 2.0 (the
> +    "License"); you may not use this file except in compliance
> +    with the License.  You may obtain a copy of the License at
> +
> +    http://www.apache.org/licenses/LICENSE-2.0
> +
> +    Unless required by applicable law or agreed to in writing,
> +    software distributed under the License is distributed on an
> +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +    KIND, either express or implied.  See the License for the
> +    specific language governing permissions and limitations
> +    under the License.
> +-->
> +<project name="enhance" basedir=".">
> +    <!--
> +        This build file executes the PCEnhancer on the test  
> entities. It's in a
> +        separate file instead of nested in pom.xml to make some  
> conditional
> +        processing easier.
> +
> +        Test classes will not be compiled if maven is invoked with
> +        -Dmaven.test.skip=true.
> +    -->
> +
> +    <condition property="maven.test.skip.istrue">
> +        <istrue value="${maven.test.skip}" />
> +    </condition>
> +
> +    <condition property="skip.enhance">
> +        <or>
> +            <equals arg1="${test}" arg2="false" />
> +            <equals arg1="${build.enhance}" arg2="false" />
> +            <istrue value="${maven.test.skip}" />
> +            <istrue value="${skipTests}" />
> +        </or>
> +    </condition>
> +
> +    <!-- =================================
> +          target: enhance
> +         ================================= -->
> +    <target name="enhance" description="--> run the enhancer unless  
> test=false" unless="skip.enhance">
> +        <antcall target="enhance.all.entities" inheritall="true"  
> inheritrefs="true" />
> +    </target>
> +
> +    <!-- =================================
> +          target: enhance.all.entities
> +         ================================= -->
> +    <target name="enhance.all.entities" description="--> enhance  
> the test entities" unless="skip.enhance">
> +        <echo> running enhancer</echo>
> +        <!--
> +            Inherited references won't be present until the task is  
> called.
> +            Therefore the path definition needs to stay inside the  
> task.
> +          -->
> +        <path id="cp">
> +            <path refid="maven.test.classpath" />
> +        </path>
> +
> +        <taskdef name="openjpac"  
> classname="org.apache.openjpa.ant.PCEnhancerTask">
> +            <classpath refid="cp" />
> +        </taskdef>
> +
> +        <fileset id="enhance.path.ref" dir="$ 
> {project.build.testOutputDirectory}">
> +            <include name="**/*.class" />
> +        </fileset>
> +        <openjpac>
> +            <classpath refid="cp" />
> +            <fileset refid="enhance.path.ref" />
> +            <config log="DefaultLevel=${openjpa.loglevel}" />
> +        </openjpac>
> +    </target>
> +</project>
>
> Property changes on: src/test/ant/enhancer.xml
> ___________________________________________________________________
> Added: svn:eol-style
>   + native
>
> Index: src/test/resources/META-INF/persistence.xml
> ===================================================================
> --- src/test/resources/META-INF/persistence.xml	(revision 0)
> +++ src/test/resources/META-INF/persistence.xml	(revision 0)
> @@ -0,0 +1,45 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> + Licensed to the Apache Software Foundation (ASF) under one
> + or more contributor license agreements.  See the NOTICE file
> + distributed with this work for additional information
> + regarding copyright ownership.  The ASF licenses this file
> + to you under the Apache License, Version 2.0 (the
> + "License"); you may not use this file except in compliance
> + with the License.  You may obtain a copy of the License at
> +
> + http://www.apache.org/licenses/LICENSE-2.0
> +
> + Unless required by applicable law or agreed to in writing,
> + software distributed under the License is distributed on an
> + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + KIND, either express or implied.  See the License for the
> + specific language governing permissions and limitations
> + under the License.
> +-->
> +<persistence xmlns="http://java.sun.com/xml/ns/persistence"
> +    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> +    version="1.0">
> +
> +    <persistence-unit name="test">
> +        <properties>
> +            <!--
> +            These properties are instead passed via System properties
> +
> +            <property name="openjpa.ConnectionDriverName"
> +                value="org.apache.commons.dbcp.BasicDataSource"/>
> +            <property name="openjpa.ConnectionProperties"
> +                 
> value 
> = 
> "DriverClassName 
> =org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/database/ 
> openjpa-test- 
> database;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
> +            -->
> +            <property name="openjpa.jdbc.SynchronizeMappings"
> +                value="buildSchema(ForeignKeys=true)"/>
> +            <property name="openjpa.BrokerFactory"
> +                 
> value="org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory"/>
> +            <property
> +                name="openjpa.abstractstore.AbstractStoreManager"
> +                 
> value="org.apache.openjpa.xmlstore.XMLStoreManager" />
> +        </properties>
> +    </persistence-unit>
> +
> +</persistence>
> +
>
> Property changes on: src/test/resources/META-INF/persistence.xml
> ___________________________________________________________________
> Added: svn:eol-style
>   + native
>
> Index: pom.xml
> ===================================================================
> --- pom.xml	(revision 897238)
> +++ pom.xml	(working copy)
> @@ -22,22 +22,122 @@
> -->
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
> " xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd 
> ">
>     <modelVersion>4.0.0</modelVersion>
> +    <parent>
> +        <groupId>org.apache.openjpa</groupId>
> +        <artifactId>openjpa-parent</artifactId>
> +        <version>2.0.0-SNAPSHOT</version>
> +    </parent>
>     <groupId>org.apache.openjpa</groupId>
>     <artifactId>openjpa-xmlstore</artifactId>
>     <packaging>jar</packaging>
>     <name>OpenJPA XML Store</name>
>     <description>OpenJPA XML Store</description>
> -    <url>http://openjpa.apache.org</url>
> -    <parent>
> -        <groupId>org.apache.openjpa</groupId>
> -        <artifactId>openjpa-parent</artifactId>
> -        <version>2.0.0-SNAPSHOT</version>
> -    </parent>
> +
>     <dependencies>
>         <dependency>
>             <groupId>org.apache.openjpa</groupId>
>             <artifactId>openjpa-kernel</artifactId>
>             <version>${pom.version}</version>
>         </dependency>
> +        <dependency>
> +            <groupId>org.apache.openjpa</groupId>
> +            <artifactId>openjpa-persistence-jdbc</artifactId>
> +            <version>${pom.version}</version>
> +            <scope>test</scope>
> +        </dependency>
> +        <dependency>
> +            <groupId>org.apache.openjpa</groupId>
> +            <artifactId>openjpa-persistence-jdbc</artifactId>
> +            <version>${pom.version}</version>
> +            <classifier>test-base</classifier>
> +            <scope>test</scope>
> +        </dependency>
> +        <dependency>
> +            <groupId>commons-dbcp</groupId>
> +            <artifactId>commons-dbcp</artifactId>
> +            <scope>test</scope>
> +        </dependency>
>     </dependencies>
> +
> +    <properties>
> +        <connection.driver.name />
> +        <connection.url>target/database/openjpa-xmlstore</ 
> connection.url>
> +        <connection.username />
> +        <connection.password />
> +    </properties>
> +
> +    <build>
> +        <plugins>
> +            <plugin>
> +                <groupId>org.apache.maven.plugins</groupId>
> +                <artifactId>maven-antrun-plugin</artifactId>
> +                <executions>
> +                    <execution>
> +                        <phase>test-compile</phase>
> +                        <configuration>
> +                            <tasks>
> +                                <ant antfile="src/test/ant/ 
> enhancer.xml" target="enhance" inheritRefs="true">
> +                                    <property  
> name="maven.test.skip" value="${maven.test.skip}" />
> +                                    <property name="test" value="$ 
> {test}" />
> +                                    <property name="outdir" value="$ 
> {project.build.outputDirectory}" />
> +                                    <property  
> name="project.build.testOutputDirectory" value="$ 
> {project.build.testOutputDirectory}" />
> +                                    <property  
> name="openjpa.loglevel" value="${openjpa.loglevel}" />
> +                                    <property name="build.enhance"  
> value="${build.enhance}" />
> +                                </ant>
> +                            </tasks>
> +                        </configuration>
> +                        <goals>
> +                            <goal>run</goal>
> +                        </goals>
> +                    </execution>
> +                </executions>
> +            </plugin>
> +            <plugin>
> +                <groupId>org.apache.maven.plugins</groupId>
> +                <artifactId>maven-surefire-plugin</artifactId>
> +                <configuration>
> +                    <argLine>${surefire.jvm.args}</argLine>
> +                    <excludes>
> +                        <!--
> +                            exclude classes that end with 'Test'
> +                            these are not test cases per OpenJPA  
> standards
> +                        -->
> +                        <exclude>org/apache/openjpa/**/*Test.java</ 
> exclude>
> +                    </excludes>
> +                    <systemProperties>
> +                        <property>
> +                            <name>openjpa.Log</name>
> +                            <value>DefaultLevel=$ 
> {openjpa.loglevel}</value>
> +                        </property>
> +                        <property>
> +                            <name>openjpa.DynamicEnhancementAgent</ 
> name>
> +                            <value>false</value>
> +                        </property>
> +                        <property>
> +                            <name>openjpa.ConnectionDriverName</name>
> +                             
> <value>org.apache.commons.dbcp.BasicDataSource</value>
> +                        </property>
> +                        <property>
> +                            <name>openjpa.ConnectionProperties</name>
> +                            <value>DriverClassName=$ 
> {connection.driver.name},Url=${connection.url},Username=$ 
> {connection.username},Password=${connection.password}</value>
> +                        </property>
> +                        <property>
> +                            <name>tests.openjpa.allowfailure</name>
> +                            <value>${tests.openjpa.allowfailure}</ 
> value>
> +                        </property>
> +<!--
> +                        <property>
> +                            <name>openjpa.BrokerFactory</name>
> +                             
> <value>org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory</ 
> value>
> +                        </property>
> +                        <property>
> +                             
> <name>openjpa.abstractstore.AbstractStoreManager</name>
> +                             
> <value>org.apache.openjpa.xmlstore.XMLStoreManager</value>
> +                        </property>
> +-->
> +                    </systemProperties>
> +                </configuration>
> +            </plugin>
> +        </plugins>
> +    </build>
> </project>

-- 
Patrick Linskey
202 669 5907


Re: How to configure a XMLStoreManager

Posted by Michael Dick <mi...@gmail.com>.
+1 to adding junits when we get it working again.

I remember playing around with it when we were in the incubator. I remember
having a patch with some changes that were needed to get it working, but I'm
afraid I've lost that patch.

So what I'm getting at is that there might be a few fixes needed - it's not
just user error :-)

-mike

On Wed, Feb 17, 2010 at 7:46 AM, Donald Woods <dw...@apache.org> wrote:

> Well, I'd be interested in learning how to make it work, so I can add
> some junits into the build so we can verify this still works in every
> release.
>
> -Donald
>
>
> On 2/16/10 6:01 PM, Patrick Linskey wrote:
> > Let me know if you're interested in trying again; I can see about
> > sharing a more detailed (read: functional) example with you.
> >
> > -Patrick
> >
> > On Feb 15, 2010, at 10:07 AM, Donald Woods wrote:
> >
> >> I never got it to work on trunk and gave up....
> >>
> >>
> >> -Donald
> >>
> >>
> >> On 2/12/10 7:29 PM, Patrick Linskey wrote:
> >>> Hi,
> >>>
> >>> I just noticed this thread. Are you still having this problem?
> >>>
> >>> I've been working with the AbstractStoreManager (of which the
> >>> XMLStoreManager is a basic example) recently, so I might be able to
> >>> point you in the right direction.
> >>>
> >>> Also, note that the XMLStoreManager generates lousy XML.
> >>>
> >>> -Patrick
> >>>
> >>> On Jan 8, 2010, at 3:06 PM, Donald Woods wrote:
> >>>
> >>>> I looked through the user docs (nothing there) and Google'd for it,
> >>>> but I can't seem to get the XMLStoreManager to work.
> >>>>
> >>>> I created a persistence.xml with the following properties -
> >>>>
> >>>> <property name="openjpa.BrokerFactory"
> >>>> value="org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory"/>
> >>>> <property
> >>>> name="openjpa.abstractstore.AbstractStoreManager"
> >>>> value="org.apache.openjpa.xmlstore.XMLStoreManager" />
> >>>>
> >>>> But am getting the following exception when running a junit -
> >>>>
> >>>>
> testGroupBy(org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery)
> >>>> Time elapsed: 0.505 sec  <<< ERROR!
> >>>> java.lang.RuntimeException: <openjpa-2.0.0-SNAPSHOT-r422266:897056M
> >>>> nonfatal general error>
> >>>> org.apache.openjpa.persistence.PersistenceException:
> >>>> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to
> >>>> org.apache.openjpa.jdbc.kernel.JDBCStore
> >>>>    at
> >>>>
> org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery.setUp(TestGroupByQuery.java:47)
> >>>>
> >>>>
> >>>>    at junit.framework.TestCase.runBare(TestCase.java:125)
> >>>> ...
> >>>> Caused by: <openjpa-2.0.0-SNAPSHOT-r422266:897056M nonfatal general
> >>>> error> org.apache.openjpa.persistence.PersistenceException:
> >>>> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to
> >>>> org.apache.openjpa.jdbc.kernel.JDBCStore
> >>>>    at
> >>>>
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:214)
> >>>>
> >>>>
> >>>>    at
> >>>>
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:194)
> >>>>
> >>>>
> >>>>    at
> >>>>
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:152)
> >>>>
> >>>>
> >>>>    at
> >>>>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:200)
> >>>>
> >>>>
> >>>>    at
> >>>>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:151)
> >>>>
> >>>>
> >>>>    at
> >>>>
> org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery.createData(TestGroupByQuery.java:52)
> >>>>
> >>>>
> >>>>    at
> >>>>
> org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery.setUp(TestGroupByQuery.java:45)
> >>>>
> >>>>
> >>>>    ... 24 more
> >>>> Caused by: java.lang.ClassCastException:
> >>>> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to
> >>>> org.apache.openjpa.jdbc.kernel.JDBCStore
> >>>>    at
> >>>>
> org.apache.openjpa.jdbc.kernel.PessimisticLockManager.setContext(PessimisticLockManager.java:63)
> >>>>
> >>>>
> >>>>    at
> >>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:354)
> >>>>    at
> >>>>
> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)
> >>>>
> >>>>
> >>>>    at
> >>>>
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:208)
> >>>>
> >>>>
> >>>>    ... 30 more
> >>>>
> >>>>
> >>>> Any ideas?
> >>>> -Donald
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> Index:
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/IndoorGame.java
> >>>>
> >>>>
> >>>> ===================================================================
> >>>> ---
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/IndoorGame.java
> >>>>
> >>>> (revision 0)
> >>>> +++
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/IndoorGame.java
> >>>>
> >>>> (revision 0)
> >>>> @@ -0,0 +1,43 @@
> >>>> +/*
> >>>> + * TestLockGroupsWithHorizontalBaseType.java
> >>>> + *
> >>>> + * Created on October 4, 2006, 5:03 PM
> >>>> + *
> >>>> + * To change this template, choose Tools | Template Manager
> >>>> + * and open the template in the editor.
> >>>> + */
> >>>> +
> >>>> +/*
> >>>> + * 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.openjpa.persistence.jdbc.query.domain;
> >>>> +
> >>>> +import javax.persistence.Entity;
> >>>> +
> >>>> +@Entity
> >>>> +public class IndoorGame extends Game {
> >>>> +    private int nPlayer;
> >>>> +
> >>>> +    public int getPlayer() {
> >>>> +        return nPlayer;
> >>>> +    }
> >>>> +
> >>>> +    public void setPlayer(int n) {
> >>>> +        this.nPlayer = n;
> >>>> +    }
> >>>> +}
> >>>>
> >>>> Property changes on:
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/IndoorGame.java
> >>>>
> >>>>
> >>>> ___________________________________________________________________
> >>>> Added: svn:eol-style
> >>>>  + native
> >>>>
> >>>> Index:
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Chess.java
> >>>>
> >>>> ===================================================================
> >>>> ---
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Chess.java
> >>>>
> >>>> (revision 0)
> >>>> +++
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Chess.java
> >>>>
> >>>> (revision 0)
> >>>> @@ -0,0 +1,43 @@
> >>>> +/*
> >>>> + * TestLockGroupsWithHorizontalBaseType.java
> >>>> + *
> >>>> + * Created on October 4, 2006, 5:03 PM
> >>>> + *
> >>>> + * To change this template, choose Tools | Template Manager
> >>>> + * and open the template in the editor.
> >>>> + */
> >>>> +
> >>>> +/*
> >>>> + * 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.openjpa.persistence.jdbc.query.domain;
> >>>> +
> >>>> +import javax.persistence.Entity;
> >>>> +
> >>>> +@Entity
> >>>> +public class Chess extends IndoorGame {
> >>>> +    private int nPiece;
> >>>> +
> >>>> +    public int getPiece() {
> >>>> +        return nPiece;
> >>>> +    }
> >>>> +
> >>>> +    public void setPiece(int n) {
> >>>> +        this.nPiece = n;
> >>>> +    }
> >>>> +}
> >>>>
> >>>> Property changes on:
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Chess.java
> >>>>
> >>>> ___________________________________________________________________
> >>>> Added: svn:eol-style
> >>>>  + native
> >>>>
> >>>> Index:
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Game.java
> >>>>
> >>>> ===================================================================
> >>>> ---
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Game.java
> >>>>
> >>>> (revision 0)
> >>>> +++
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Game.java
> >>>>
> >>>> (revision 0)
> >>>> @@ -0,0 +1,65 @@
> >>>> +/*
> >>>> + * TestLockGroupsWithHorizontalBaseType.java
> >>>> + *
> >>>> + * Created on October 4, 2006, 5:03 PM
> >>>> + *
> >>>> + * To change this template, choose Tools | Template Manager
> >>>> + * and open the template in the editor.
> >>>> + */
> >>>> +
> >>>> +/*
> >>>> + * 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.openjpa.persistence.jdbc.query.domain;
> >>>> +
> >>>> +import javax.persistence.Entity;
> >>>> +import javax.persistence.GeneratedValue;
> >>>> +import javax.persistence.Id;
> >>>> +import javax.persistence.Inheritance;
> >>>> +import javax.persistence.InheritanceType;
> >>>> +
> >>>> +/**
> >>>> + * Simple unrelated persistent entity used to test logically union
> >>>> queries.
> >>>> + * This class is root of an inheritance hierarchy using TABLE PER
> >>>> CLASS
> >>>> + * strategy. Polymorphic queries on this class needs to run logical
> >>>> union
> >>>> + * of queries on all known subclasses.
> >>>> + *
> >>>> + * @author Pinaki Poddar
> >>>> + *
> >>>> + */
> >>>> +@Entity
> >>>> +@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
> >>>> +public class Game {
> >>>> +    @Id
> >>>> +    @GeneratedValue
> >>>> +    private long id;
> >>>> +
> >>>> +    private String name;
> >>>> +
> >>>> +    public long getId() {
> >>>> +        return id;
> >>>> +    }
> >>>> +
> >>>> +    public String getName() {
> >>>> +        return name;
> >>>> +    }
> >>>> +
> >>>> +    public void setName(String name) {
> >>>> +        this.name = name;
> >>>> +    }
> >>>> +}
> >>>>
> >>>> Property changes on:
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Game.java
> >>>>
> >>>> ___________________________________________________________________
> >>>> Added: svn:eol-style
> >>>>  + native
> >>>>
> >>>> Index:
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Scrabble.java
> >>>>
> >>>>
> >>>> ===================================================================
> >>>> ---
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Scrabble.java
> >>>>
> >>>> (revision 0)
> >>>> +++
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Scrabble.java
> >>>>
> >>>> (revision 0)
> >>>> @@ -0,0 +1,44 @@
> >>>> +/*
> >>>> + * TestLockGroupsWithHorizontalBaseType.java
> >>>> + *
> >>>> + * Created on October 4, 2006, 5:03 PM
> >>>> + *
> >>>> + * To change this template, choose Tools | Template Manager
> >>>> + * and open the template in the editor.
> >>>> + */
> >>>> +
> >>>> +/*
> >>>> + * 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.openjpa.persistence.jdbc.query.domain;
> >>>> +
> >>>> +import javax.persistence.Entity;
> >>>> +
> >>>> +@Entity
> >>>> +public class Scrabble extends IndoorGame {
> >>>> +    private int nTile;
> >>>> +
> >>>> +    public int getTile() {
> >>>> +        return nTile;
> >>>> +    }
> >>>> +
> >>>> +    public void setTile(int n) {
> >>>> +        this.nTile = n;
> >>>> +    }
> >>>> +
> >>>> +}
> >>>>
> >>>> Property changes on:
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Scrabble.java
> >>>>
> >>>>
> >>>> ___________________________________________________________________
> >>>> Added: svn:eol-style
> >>>>  + native
> >>>>
> >>>> Index:
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/TestGroupByQuery.java
> >>>>
> >>>>
> >>>> ===================================================================
> >>>> ---
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/TestGroupByQuery.java
> >>>>
> >>>> (revision 0)
> >>>> +++
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/TestGroupByQuery.java
> >>>>
> >>>> (revision 0)
> >>>> @@ -0,0 +1,75 @@
> >>>> +/*
> >>>> + * 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.openjpa.persistence.jdbc.query;
> >>>> +
> >>>> +import java.util.List;
> >>>> +
> >>>> +import javax.persistence.EntityManager;
> >>>> +
> >>>> +import org.apache.openjpa.persistence.jdbc.query.domain.IndoorGame;
> >>>> +import org.apache.openjpa.persistence.jdbc.query.domain.Scrabble;
> >>>> +import org.apache.openjpa.persistence.jdbc.query.domain.Chess;
> >>>> +import org.apache.openjpa.persistence.jdbc.query.domain.Game;
> >>>> +import org.apache.openjpa.persistence.test.SingleEMFTestCase;
> >>>> +
> >>>> +/**
> >>>> + * Tests GROUP BY in sub query does not get parsed by owning query.
> >>>> + *
> >>>> + * Further details can be found in <A
> >>>> + *
> >>>> HREF="https://issues.apache.org/jira/browse/OPENJPA-28
> ">OPENJPA-28</A>
> >>>> + *
> >>>> + * @author Pinaki Poddar
> >>>> + *
> >>>> + */
> >>>> +public class TestGroupByQuery extends SingleEMFTestCase {
> >>>> +    public void setUp() {
> >>>> +        super.setUp(DROP_TABLES, Game.class, IndoorGame.class,
> >>>> Scrabble.class,
> >>>> +                Chess.class);
> >>>> +        try {
> >>>> +            createData();
> >>>> +        } catch (Exception e) {
> >>>> +            throw new RuntimeException(e);
> >>>> +        }
> >>>> +    }
> >>>> +
> >>>> +    void createData() throws Exception {
> >>>> +        EntityManager em = emf.createEntityManager();
> >>>> +        em.getTransaction().begin();
> >>>> +        Class[] classes = { Game.class, IndoorGame.class,
> >>>> Scrabble.class,
> >>>> +                Chess.class };
> >>>> +        for (Class cls : classes) {
> >>>> +            for (int i = 1; i <= 4; i++) {
> >>>> +                Game p = (Game) cls.newInstance();
> >>>> +                p.setName(cls.getSimpleName() + "-" + i);
> >>>> +                em.persist(p);
> >>>> +            }
> >>>> +        }
> >>>> +        em.getTransaction().commit();
> >>>> +    }
> >>>> +
> >>>> +    public void testGroupBy() {
> >>>> +        String jpql = "SELECT g.name, g.nTile FROM Scrabble g WHERE
> "
> >>>> +                + "(g.name = ANY(SELECT g1.name FROM Scrabble g1 "
> >>>> +                + "GROUP BY g1.name )) ORDER BY g.name";
> >>>> +        EntityManager em = emf.createEntityManager();
> >>>> +
> >>>> +        List<IndoorGame> employees =
> >>>> em.createQuery(jpql).getResultList();
> >>>> +
> >>>> +    }
> >>>> +}
> >>>>
> >>>> Property changes on:
> >>>>
> src/test/java/org/apache/openjpa/persistence/jdbc/query/TestGroupByQuery.java
> >>>>
> >>>>
> >>>> ___________________________________________________________________
> >>>> Added: svn:eol-style
> >>>>  + native
> >>>>
> >>>> Index: src/test/ant/enhancer.xml
> >>>> ===================================================================
> >>>> --- src/test/ant/enhancer.xml    (revision 0)
> >>>> +++ src/test/ant/enhancer.xml    (revision 0)
> >>>> @@ -0,0 +1,76 @@
> >>>> +<?xml version="1.0" encoding="UTF-8"?>
> >>>> +<!--
> >>>> +    Licensed to the Apache Software Foundation (ASF) under one
> >>>> +    or more contributor license agreements.  See the NOTICE file
> >>>> +    distributed with this work for additional information
> >>>> +    regarding copyright ownership.  The ASF licenses this file
> >>>> +    to you under the Apache License, Version 2.0 (the
> >>>> +    "License"); you may not use this file except in compliance
> >>>> +    with the License.  You may obtain a copy of the License at
> >>>> +
> >>>> +    http://www.apache.org/licenses/LICENSE-2.0
> >>>> +
> >>>> +    Unless required by applicable law or agreed to in writing,
> >>>> +    software distributed under the License is distributed on an
> >>>> +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> >>>> +    KIND, either express or implied.  See the License for the
> >>>> +    specific language governing permissions and limitations
> >>>> +    under the License.
> >>>> +-->
> >>>> +<project name="enhance" basedir=".">
> >>>> +    <!--
> >>>> +        This build file executes the PCEnhancer on the test entities.
> >>>> It's in a
> >>>> +        separate file instead of nested in pom.xml to make some
> >>>> conditional
> >>>> +        processing easier.
> >>>> +
> >>>> +        Test classes will not be compiled if maven is invoked with
> >>>> +        -Dmaven.test.skip=true.
> >>>> +    -->
> >>>> +
> >>>> +    <condition property="maven.test.skip.istrue">
> >>>> +        <istrue value="${maven.test.skip}" />
> >>>> +    </condition>
> >>>> +
> >>>> +    <condition property="skip.enhance">
> >>>> +        <or>
> >>>> +            <equals arg1="${test}" arg2="false" />
> >>>> +            <equals arg1="${build.enhance}" arg2="false" />
> >>>> +            <istrue value="${maven.test.skip}" />
> >>>> +            <istrue value="${skipTests}" />
> >>>> +        </or>
> >>>> +    </condition>
> >>>> +
> >>>> +    <!-- =================================
> >>>> +          target: enhance
> >>>> +         ================================= -->
> >>>> +    <target name="enhance" description="--> run the enhancer unless
> >>>> test=false" unless="skip.enhance">
> >>>> +        <antcall target="enhance.all.entities" inheritall="true"
> >>>> inheritrefs="true" />
> >>>> +    </target>
> >>>> +
> >>>> +    <!-- =================================
> >>>> +          target: enhance.all.entities
> >>>> +         ================================= -->
> >>>> +    <target name="enhance.all.entities" description="--> enhance the
> >>>> test entities" unless="skip.enhance">
> >>>> +        <echo> running enhancer</echo>
> >>>> +        <!--
> >>>> +            Inherited references won't be present until the task is
> >>>> called.
> >>>> +            Therefore the path definition needs to stay inside the
> >>>> task.
> >>>> +          -->
> >>>> +        <path id="cp">
> >>>> +            <path refid="maven.test.classpath" />
> >>>> +        </path>
> >>>> +
> >>>> +        <taskdef name="openjpac"
> >>>> classname="org.apache.openjpa.ant.PCEnhancerTask">
> >>>> +            <classpath refid="cp" />
> >>>> +        </taskdef>
> >>>> +
> >>>> +        <fileset id="enhance.path.ref"
> >>>> dir="${project.build.testOutputDirectory}">
> >>>> +            <include name="**/*.class" />
> >>>> +        </fileset>
> >>>> +        <openjpac>
> >>>> +            <classpath refid="cp" />
> >>>> +            <fileset refid="enhance.path.ref" />
> >>>> +            <config log="DefaultLevel=${openjpa.loglevel}" />
> >>>> +        </openjpac>
> >>>> +    </target>
> >>>> +</project>
> >>>>
> >>>> Property changes on: src/test/ant/enhancer.xml
> >>>> ___________________________________________________________________
> >>>> Added: svn:eol-style
> >>>>  + native
> >>>>
> >>>> Index: src/test/resources/META-INF/persistence.xml
> >>>> ===================================================================
> >>>> --- src/test/resources/META-INF/persistence.xml    (revision 0)
> >>>> +++ src/test/resources/META-INF/persistence.xml    (revision 0)
> >>>> @@ -0,0 +1,45 @@
> >>>> +<?xml version="1.0" encoding="UTF-8"?>
> >>>> +<!--
> >>>> + Licensed to the Apache Software Foundation (ASF) under one
> >>>> + or more contributor license agreements.  See the NOTICE file
> >>>> + distributed with this work for additional information
> >>>> + regarding copyright ownership.  The ASF licenses this file
> >>>> + to you under the Apache License, Version 2.0 (the
> >>>> + "License"); you may not use this file except in compliance
> >>>> + with the License.  You may obtain a copy of the License at
> >>>> +
> >>>> + http://www.apache.org/licenses/LICENSE-2.0
> >>>> +
> >>>> + Unless required by applicable law or agreed to in writing,
> >>>> + software distributed under the License is distributed on an
> >>>> + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> >>>> + KIND, either express or implied.  See the License for the
> >>>> + specific language governing permissions and limitations
> >>>> + under the License.
> >>>> +-->
> >>>> +<persistence xmlns="http://java.sun.com/xml/ns/persistence"
> >>>> +    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >>>> +    version="1.0">
> >>>> +
> >>>> +    <persistence-unit name="test">
> >>>> +        <properties>
> >>>> +            <!--
> >>>> +            These properties are instead passed via System properties
> >>>> +
> >>>> +            <property name="openjpa.ConnectionDriverName"
> >>>> +                value="org.apache.commons.dbcp.BasicDataSource"/>
> >>>> +            <property name="openjpa.ConnectionProperties"
> >>>> +
> >>>>
> value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/database/openjpa-test-database;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
> >>>>
> >>>>
> >>>> +            -->
> >>>> +            <property name="openjpa.jdbc.SynchronizeMappings"
> >>>> +                value="buildSchema(ForeignKeys=true)"/>
> >>>> +            <property name="openjpa.BrokerFactory"
> >>>> +
> >>>> value="org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory"/>
> >>>> +            <property
> >>>> +                name="openjpa.abstractstore.AbstractStoreManager"
> >>>> +                value="org.apache.openjpa.xmlstore.XMLStoreManager"
> />
> >>>> +        </properties>
> >>>> +    </persistence-unit>
> >>>> +
> >>>> +</persistence>
> >>>> +
> >>>>
> >>>> Property changes on: src/test/resources/META-INF/persistence.xml
> >>>> ___________________________________________________________________
> >>>> Added: svn:eol-style
> >>>>  + native
> >>>>
> >>>> Index: pom.xml
> >>>> ===================================================================
> >>>> --- pom.xml    (revision 897238)
> >>>> +++ pom.xml    (working copy)
> >>>> @@ -22,22 +22,122 @@
> >>>> -->
> >>>> <project xmlns="http://maven.apache.org/POM/4.0.0"
> >>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >>>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> >>>> http://maven.apache.org/maven-v4_0_0.xsd">
> >>>>    <modelVersion>4.0.0</modelVersion>
> >>>> +    <parent>
> >>>> +        <groupId>org.apache.openjpa</groupId>
> >>>> +        <artifactId>openjpa-parent</artifactId>
> >>>> +        <version>2.0.0-SNAPSHOT</version>
> >>>> +    </parent>
> >>>>    <groupId>org.apache.openjpa</groupId>
> >>>>    <artifactId>openjpa-xmlstore</artifactId>
> >>>>    <packaging>jar</packaging>
> >>>>    <name>OpenJPA XML Store</name>
> >>>>    <description>OpenJPA XML Store</description>
> >>>> -    <url>http://openjpa.apache.org</url>
> >>>> -    <parent>
> >>>> -        <groupId>org.apache.openjpa</groupId>
> >>>> -        <artifactId>openjpa-parent</artifactId>
> >>>> -        <version>2.0.0-SNAPSHOT</version>
> >>>> -    </parent>
> >>>> +
> >>>>    <dependencies>
> >>>>        <dependency>
> >>>>            <groupId>org.apache.openjpa</groupId>
> >>>>            <artifactId>openjpa-kernel</artifactId>
> >>>>            <version>${pom.version}</version>
> >>>>        </dependency>
> >>>> +        <dependency>
> >>>> +            <groupId>org.apache.openjpa</groupId>
> >>>> +            <artifactId>openjpa-persistence-jdbc</artifactId>
> >>>> +            <version>${pom.version}</version>
> >>>> +            <scope>test</scope>
> >>>> +        </dependency>
> >>>> +        <dependency>
> >>>> +            <groupId>org.apache.openjpa</groupId>
> >>>> +            <artifactId>openjpa-persistence-jdbc</artifactId>
> >>>> +            <version>${pom.version}</version>
> >>>> +            <classifier>test-base</classifier>
> >>>> +            <scope>test</scope>
> >>>> +        </dependency>
> >>>> +        <dependency>
> >>>> +            <groupId>commons-dbcp</groupId>
> >>>> +            <artifactId>commons-dbcp</artifactId>
> >>>> +            <scope>test</scope>
> >>>> +        </dependency>
> >>>>    </dependencies>
> >>>> +
> >>>> +    <properties>
> >>>> +        <connection.driver.name />
> >>>> +
> >>>> <connection.url>target/database/openjpa-xmlstore</connection.url>
> >>>> +        <connection.username />
> >>>> +        <connection.password />
> >>>> +    </properties>
> >>>> +
> >>>> +    <build>
> >>>> +        <plugins>
> >>>> +            <plugin>
> >>>> +                <groupId>org.apache.maven.plugins</groupId>
> >>>> +                <artifactId>maven-antrun-plugin</artifactId>
> >>>> +                <executions>
> >>>> +                    <execution>
> >>>> +                        <phase>test-compile</phase>
> >>>> +                        <configuration>
> >>>> +                            <tasks>
> >>>> +                                <ant
> >>>> antfile="src/test/ant/enhancer.xml" target="enhance"
> >>>> inheritRefs="true">
> >>>> +                                    <property name="maven.test.skip"
> >>>> value="${maven.test.skip}" />
> >>>> +                                    <property name="test"
> >>>> value="${test}" />
> >>>> +                                    <property name="outdir"
> >>>> value="${project.build.outputDirectory}" />
> >>>> +                                    <property
> >>>> name="project.build.testOutputDirectory"
> >>>> value="${project.build.testOutputDirectory}" />
> >>>> +                                    <property name="openjpa.loglevel"
> >>>> value="${openjpa.loglevel}" />
> >>>> +                                    <property name="build.enhance"
> >>>> value="${build.enhance}" />
> >>>> +                                </ant>
> >>>> +                            </tasks>
> >>>> +                        </configuration>
> >>>> +                        <goals>
> >>>> +                            <goal>run</goal>
> >>>> +                        </goals>
> >>>> +                    </execution>
> >>>> +                </executions>
> >>>> +            </plugin>
> >>>> +            <plugin>
> >>>> +                <groupId>org.apache.maven.plugins</groupId>
> >>>> +                <artifactId>maven-surefire-plugin</artifactId>
> >>>> +                <configuration>
> >>>> +                    <argLine>${surefire.jvm.args}</argLine>
> >>>> +                    <excludes>
> >>>> +                        <!--
> >>>> +                            exclude classes that end with 'Test'
> >>>> +                            these are not test cases per OpenJPA
> >>>> standards
> >>>> +                        -->
> >>>> +
> >>>> <exclude>org/apache/openjpa/**/*Test.java</exclude>
> >>>> +                    </excludes>
> >>>> +                    <systemProperties>
> >>>> +                        <property>
> >>>> +                            <name>openjpa.Log</name>
> >>>> +
> >>>> <value>DefaultLevel=${openjpa.loglevel}</value>
> >>>> +                        </property>
> >>>> +                        <property>
> >>>> +
> >>>> <name>openjpa.DynamicEnhancementAgent</name>
> >>>> +                            <value>false</value>
> >>>> +                        </property>
> >>>> +                        <property>
> >>>> +                            <name>openjpa.ConnectionDriverName</name>
> >>>> +
> >>>> <value>org.apache.commons.dbcp.BasicDataSource</value>
> >>>> +                        </property>
> >>>> +                        <property>
> >>>> +                            <name>openjpa.ConnectionProperties</name>
> >>>> +
> >>>> <value>DriverClassName=${connection.driver.name
> },Url=${connection.url},Username=${connection.username},Password=${connection.password}</value>
> >>>>
> >>>>
> >>>> +                        </property>
> >>>> +                        <property>
> >>>> +                            <name>tests.openjpa.allowfailure</name>
> >>>> +
> >>>> <value>${tests.openjpa.allowfailure}</value>
> >>>> +                        </property>
> >>>> +<!--
> >>>> +                        <property>
> >>>> +                            <name>openjpa.BrokerFactory</name>
> >>>> +
> >>>>
> <value>org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory</value>
> >>>>
> >>>>
> >>>> +                        </property>
> >>>> +                        <property>
> >>>> +
> >>>> <name>openjpa.abstractstore.AbstractStoreManager</name>
> >>>> +
> >>>> <value>org.apache.openjpa.xmlstore.XMLStoreManager</value>
> >>>> +                        </property>
> >>>> +-->
> >>>> +                    </systemProperties>
> >>>> +                </configuration>
> >>>> +            </plugin>
> >>>> +        </plugins>
> >>>> +    </build>
> >>>> </project>
> >>>
> >
>

Re: How to configure a XMLStoreManager

Posted by Donald Woods <dw...@apache.org>.
Well, I'd be interested in learning how to make it work, so I can add
some junits into the build so we can verify this still works in every
release.

-Donald


On 2/16/10 6:01 PM, Patrick Linskey wrote:
> Let me know if you're interested in trying again; I can see about
> sharing a more detailed (read: functional) example with you.
> 
> -Patrick
> 
> On Feb 15, 2010, at 10:07 AM, Donald Woods wrote:
> 
>> I never got it to work on trunk and gave up....
>>
>>
>> -Donald
>>
>>
>> On 2/12/10 7:29 PM, Patrick Linskey wrote:
>>> Hi,
>>>
>>> I just noticed this thread. Are you still having this problem?
>>>
>>> I've been working with the AbstractStoreManager (of which the
>>> XMLStoreManager is a basic example) recently, so I might be able to
>>> point you in the right direction.
>>>
>>> Also, note that the XMLStoreManager generates lousy XML.
>>>
>>> -Patrick
>>>
>>> On Jan 8, 2010, at 3:06 PM, Donald Woods wrote:
>>>
>>>> I looked through the user docs (nothing there) and Google'd for it,
>>>> but I can't seem to get the XMLStoreManager to work.
>>>>
>>>> I created a persistence.xml with the following properties -
>>>>
>>>> <property name="openjpa.BrokerFactory"
>>>> value="org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory"/>
>>>> <property
>>>> name="openjpa.abstractstore.AbstractStoreManager"
>>>> value="org.apache.openjpa.xmlstore.XMLStoreManager" />
>>>>
>>>> But am getting the following exception when running a junit -
>>>>
>>>> testGroupBy(org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery)
>>>> Time elapsed: 0.505 sec  <<< ERROR!
>>>> java.lang.RuntimeException: <openjpa-2.0.0-SNAPSHOT-r422266:897056M
>>>> nonfatal general error>
>>>> org.apache.openjpa.persistence.PersistenceException:
>>>> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to
>>>> org.apache.openjpa.jdbc.kernel.JDBCStore
>>>>    at
>>>> org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery.setUp(TestGroupByQuery.java:47)
>>>>
>>>>
>>>>    at junit.framework.TestCase.runBare(TestCase.java:125)
>>>> ...
>>>> Caused by: <openjpa-2.0.0-SNAPSHOT-r422266:897056M nonfatal general
>>>> error> org.apache.openjpa.persistence.PersistenceException:
>>>> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to
>>>> org.apache.openjpa.jdbc.kernel.JDBCStore
>>>>    at
>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:214)
>>>>
>>>>
>>>>    at
>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:194)
>>>>
>>>>
>>>>    at
>>>> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:152)
>>>>
>>>>
>>>>    at
>>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:200)
>>>>
>>>>
>>>>    at
>>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:151)
>>>>
>>>>
>>>>    at
>>>> org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery.createData(TestGroupByQuery.java:52)
>>>>
>>>>
>>>>    at
>>>> org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery.setUp(TestGroupByQuery.java:45)
>>>>
>>>>
>>>>    ... 24 more
>>>> Caused by: java.lang.ClassCastException:
>>>> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to
>>>> org.apache.openjpa.jdbc.kernel.JDBCStore
>>>>    at
>>>> org.apache.openjpa.jdbc.kernel.PessimisticLockManager.setContext(PessimisticLockManager.java:63)
>>>>
>>>>
>>>>    at
>>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:354)
>>>>    at
>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)
>>>>
>>>>
>>>>    at
>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:208)
>>>>
>>>>
>>>>    ... 30 more
>>>>
>>>>
>>>> Any ideas?
>>>> -Donald
>>>>
>>>>
>>>>
>>>>
>>>> Index:
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/IndoorGame.java
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/IndoorGame.java
>>>>
>>>> (revision 0)
>>>> +++
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/IndoorGame.java
>>>>
>>>> (revision 0)
>>>> @@ -0,0 +1,43 @@
>>>> +/*
>>>> + * TestLockGroupsWithHorizontalBaseType.java
>>>> + *
>>>> + * Created on October 4, 2006, 5:03 PM
>>>> + *
>>>> + * To change this template, choose Tools | Template Manager
>>>> + * and open the template in the editor.
>>>> + */
>>>> +
>>>> +/*
>>>> + * 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.openjpa.persistence.jdbc.query.domain;
>>>> +
>>>> +import javax.persistence.Entity;
>>>> +
>>>> +@Entity
>>>> +public class IndoorGame extends Game {
>>>> +    private int nPlayer;
>>>> +
>>>> +    public int getPlayer() {
>>>> +        return nPlayer;
>>>> +    }
>>>> +
>>>> +    public void setPlayer(int n) {
>>>> +        this.nPlayer = n;
>>>> +    }
>>>> +}
>>>>
>>>> Property changes on:
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/IndoorGame.java
>>>>
>>>>
>>>> ___________________________________________________________________
>>>> Added: svn:eol-style
>>>>  + native
>>>>
>>>> Index:
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Chess.java
>>>>
>>>> ===================================================================
>>>> ---
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Chess.java
>>>>
>>>> (revision 0)
>>>> +++
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Chess.java
>>>>
>>>> (revision 0)
>>>> @@ -0,0 +1,43 @@
>>>> +/*
>>>> + * TestLockGroupsWithHorizontalBaseType.java
>>>> + *
>>>> + * Created on October 4, 2006, 5:03 PM
>>>> + *
>>>> + * To change this template, choose Tools | Template Manager
>>>> + * and open the template in the editor.
>>>> + */
>>>> +
>>>> +/*
>>>> + * 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.openjpa.persistence.jdbc.query.domain;
>>>> +
>>>> +import javax.persistence.Entity;
>>>> +
>>>> +@Entity
>>>> +public class Chess extends IndoorGame {
>>>> +    private int nPiece;
>>>> +
>>>> +    public int getPiece() {
>>>> +        return nPiece;
>>>> +    }
>>>> +
>>>> +    public void setPiece(int n) {
>>>> +        this.nPiece = n;
>>>> +    }
>>>> +}
>>>>
>>>> Property changes on:
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Chess.java
>>>>
>>>> ___________________________________________________________________
>>>> Added: svn:eol-style
>>>>  + native
>>>>
>>>> Index:
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Game.java
>>>>
>>>> ===================================================================
>>>> ---
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Game.java
>>>>
>>>> (revision 0)
>>>> +++
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Game.java
>>>>
>>>> (revision 0)
>>>> @@ -0,0 +1,65 @@
>>>> +/*
>>>> + * TestLockGroupsWithHorizontalBaseType.java
>>>> + *
>>>> + * Created on October 4, 2006, 5:03 PM
>>>> + *
>>>> + * To change this template, choose Tools | Template Manager
>>>> + * and open the template in the editor.
>>>> + */
>>>> +
>>>> +/*
>>>> + * 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.openjpa.persistence.jdbc.query.domain;
>>>> +
>>>> +import javax.persistence.Entity;
>>>> +import javax.persistence.GeneratedValue;
>>>> +import javax.persistence.Id;
>>>> +import javax.persistence.Inheritance;
>>>> +import javax.persistence.InheritanceType;
>>>> +
>>>> +/**
>>>> + * Simple unrelated persistent entity used to test logically union
>>>> queries.
>>>> + * This class is root of an inheritance hierarchy using TABLE PER
>>>> CLASS
>>>> + * strategy. Polymorphic queries on this class needs to run logical
>>>> union
>>>> + * of queries on all known subclasses.
>>>> + *
>>>> + * @author Pinaki Poddar
>>>> + *
>>>> + */
>>>> +@Entity
>>>> +@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
>>>> +public class Game {
>>>> +    @Id
>>>> +    @GeneratedValue
>>>> +    private long id;
>>>> +
>>>> +    private String name;
>>>> +
>>>> +    public long getId() {
>>>> +        return id;
>>>> +    }
>>>> +
>>>> +    public String getName() {
>>>> +        return name;
>>>> +    }
>>>> +
>>>> +    public void setName(String name) {
>>>> +        this.name = name;
>>>> +    }
>>>> +}
>>>>
>>>> Property changes on:
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Game.java
>>>>
>>>> ___________________________________________________________________
>>>> Added: svn:eol-style
>>>>  + native
>>>>
>>>> Index:
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Scrabble.java
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Scrabble.java
>>>>
>>>> (revision 0)
>>>> +++
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Scrabble.java
>>>>
>>>> (revision 0)
>>>> @@ -0,0 +1,44 @@
>>>> +/*
>>>> + * TestLockGroupsWithHorizontalBaseType.java
>>>> + *
>>>> + * Created on October 4, 2006, 5:03 PM
>>>> + *
>>>> + * To change this template, choose Tools | Template Manager
>>>> + * and open the template in the editor.
>>>> + */
>>>> +
>>>> +/*
>>>> + * 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.openjpa.persistence.jdbc.query.domain;
>>>> +
>>>> +import javax.persistence.Entity;
>>>> +
>>>> +@Entity
>>>> +public class Scrabble extends IndoorGame {
>>>> +    private int nTile;
>>>> +
>>>> +    public int getTile() {
>>>> +        return nTile;
>>>> +    }
>>>> +
>>>> +    public void setTile(int n) {
>>>> +        this.nTile = n;
>>>> +    }
>>>> +
>>>> +}
>>>>
>>>> Property changes on:
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Scrabble.java
>>>>
>>>>
>>>> ___________________________________________________________________
>>>> Added: svn:eol-style
>>>>  + native
>>>>
>>>> Index:
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/TestGroupByQuery.java
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/TestGroupByQuery.java
>>>>
>>>> (revision 0)
>>>> +++
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/TestGroupByQuery.java
>>>>
>>>> (revision 0)
>>>> @@ -0,0 +1,75 @@
>>>> +/*
>>>> + * 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.openjpa.persistence.jdbc.query;
>>>> +
>>>> +import java.util.List;
>>>> +
>>>> +import javax.persistence.EntityManager;
>>>> +
>>>> +import org.apache.openjpa.persistence.jdbc.query.domain.IndoorGame;
>>>> +import org.apache.openjpa.persistence.jdbc.query.domain.Scrabble;
>>>> +import org.apache.openjpa.persistence.jdbc.query.domain.Chess;
>>>> +import org.apache.openjpa.persistence.jdbc.query.domain.Game;
>>>> +import org.apache.openjpa.persistence.test.SingleEMFTestCase;
>>>> +
>>>> +/**
>>>> + * Tests GROUP BY in sub query does not get parsed by owning query.
>>>> + *
>>>> + * Further details can be found in <A
>>>> + *
>>>> HREF="https://issues.apache.org/jira/browse/OPENJPA-28">OPENJPA-28</A>
>>>> + *
>>>> + * @author Pinaki Poddar
>>>> + *
>>>> + */
>>>> +public class TestGroupByQuery extends SingleEMFTestCase {
>>>> +    public void setUp() {
>>>> +        super.setUp(DROP_TABLES, Game.class, IndoorGame.class,
>>>> Scrabble.class,
>>>> +                Chess.class);
>>>> +        try {
>>>> +            createData();
>>>> +        } catch (Exception e) {
>>>> +            throw new RuntimeException(e);
>>>> +        }
>>>> +    }
>>>> +
>>>> +    void createData() throws Exception {
>>>> +        EntityManager em = emf.createEntityManager();
>>>> +        em.getTransaction().begin();
>>>> +        Class[] classes = { Game.class, IndoorGame.class,
>>>> Scrabble.class,
>>>> +                Chess.class };
>>>> +        for (Class cls : classes) {
>>>> +            for (int i = 1; i <= 4; i++) {
>>>> +                Game p = (Game) cls.newInstance();
>>>> +                p.setName(cls.getSimpleName() + "-" + i);
>>>> +                em.persist(p);
>>>> +            }
>>>> +        }
>>>> +        em.getTransaction().commit();
>>>> +    }
>>>> +
>>>> +    public void testGroupBy() {
>>>> +        String jpql = "SELECT g.name, g.nTile FROM Scrabble g WHERE "
>>>> +                + "(g.name = ANY(SELECT g1.name FROM Scrabble g1 "
>>>> +                + "GROUP BY g1.name )) ORDER BY g.name";
>>>> +        EntityManager em = emf.createEntityManager();
>>>> +
>>>> +        List<IndoorGame> employees =
>>>> em.createQuery(jpql).getResultList();
>>>> +
>>>> +    }
>>>> +}
>>>>
>>>> Property changes on:
>>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/TestGroupByQuery.java
>>>>
>>>>
>>>> ___________________________________________________________________
>>>> Added: svn:eol-style
>>>>  + native
>>>>
>>>> Index: src/test/ant/enhancer.xml
>>>> ===================================================================
>>>> --- src/test/ant/enhancer.xml    (revision 0)
>>>> +++ src/test/ant/enhancer.xml    (revision 0)
>>>> @@ -0,0 +1,76 @@
>>>> +<?xml version="1.0" encoding="UTF-8"?>
>>>> +<!--
>>>> +    Licensed to the Apache Software Foundation (ASF) under one
>>>> +    or more contributor license agreements.  See the NOTICE file
>>>> +    distributed with this work for additional information
>>>> +    regarding copyright ownership.  The ASF licenses this file
>>>> +    to you under the Apache License, Version 2.0 (the
>>>> +    "License"); you may not use this file except in compliance
>>>> +    with the License.  You may obtain a copy of the License at
>>>> +
>>>> +    http://www.apache.org/licenses/LICENSE-2.0
>>>> +
>>>> +    Unless required by applicable law or agreed to in writing,
>>>> +    software distributed under the License is distributed on an
>>>> +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> +    KIND, either express or implied.  See the License for the
>>>> +    specific language governing permissions and limitations
>>>> +    under the License.
>>>> +-->
>>>> +<project name="enhance" basedir=".">
>>>> +    <!--
>>>> +        This build file executes the PCEnhancer on the test entities.
>>>> It's in a
>>>> +        separate file instead of nested in pom.xml to make some
>>>> conditional
>>>> +        processing easier.
>>>> +
>>>> +        Test classes will not be compiled if maven is invoked with
>>>> +        -Dmaven.test.skip=true.
>>>> +    -->
>>>> +
>>>> +    <condition property="maven.test.skip.istrue">
>>>> +        <istrue value="${maven.test.skip}" />
>>>> +    </condition>
>>>> +
>>>> +    <condition property="skip.enhance">
>>>> +        <or>
>>>> +            <equals arg1="${test}" arg2="false" />
>>>> +            <equals arg1="${build.enhance}" arg2="false" />
>>>> +            <istrue value="${maven.test.skip}" />
>>>> +            <istrue value="${skipTests}" />
>>>> +        </or>
>>>> +    </condition>
>>>> +
>>>> +    <!-- =================================
>>>> +          target: enhance
>>>> +         ================================= -->
>>>> +    <target name="enhance" description="--> run the enhancer unless
>>>> test=false" unless="skip.enhance">
>>>> +        <antcall target="enhance.all.entities" inheritall="true"
>>>> inheritrefs="true" />
>>>> +    </target>
>>>> +
>>>> +    <!-- =================================
>>>> +          target: enhance.all.entities
>>>> +         ================================= -->
>>>> +    <target name="enhance.all.entities" description="--> enhance the
>>>> test entities" unless="skip.enhance">
>>>> +        <echo> running enhancer</echo>
>>>> +        <!--
>>>> +            Inherited references won't be present until the task is
>>>> called.
>>>> +            Therefore the path definition needs to stay inside the
>>>> task.
>>>> +          -->
>>>> +        <path id="cp">
>>>> +            <path refid="maven.test.classpath" />
>>>> +        </path>
>>>> +
>>>> +        <taskdef name="openjpac"
>>>> classname="org.apache.openjpa.ant.PCEnhancerTask">
>>>> +            <classpath refid="cp" />
>>>> +        </taskdef>
>>>> +
>>>> +        <fileset id="enhance.path.ref"
>>>> dir="${project.build.testOutputDirectory}">
>>>> +            <include name="**/*.class" />
>>>> +        </fileset>
>>>> +        <openjpac>
>>>> +            <classpath refid="cp" />
>>>> +            <fileset refid="enhance.path.ref" />
>>>> +            <config log="DefaultLevel=${openjpa.loglevel}" />
>>>> +        </openjpac>
>>>> +    </target>
>>>> +</project>
>>>>
>>>> Property changes on: src/test/ant/enhancer.xml
>>>> ___________________________________________________________________
>>>> Added: svn:eol-style
>>>>  + native
>>>>
>>>> Index: src/test/resources/META-INF/persistence.xml
>>>> ===================================================================
>>>> --- src/test/resources/META-INF/persistence.xml    (revision 0)
>>>> +++ src/test/resources/META-INF/persistence.xml    (revision 0)
>>>> @@ -0,0 +1,45 @@
>>>> +<?xml version="1.0" encoding="UTF-8"?>
>>>> +<!--
>>>> + Licensed to the Apache Software Foundation (ASF) under one
>>>> + or more contributor license agreements.  See the NOTICE file
>>>> + distributed with this work for additional information
>>>> + regarding copyright ownership.  The ASF licenses this file
>>>> + to you under the Apache License, Version 2.0 (the
>>>> + "License"); you may not use this file except in compliance
>>>> + with the License.  You may obtain a copy of the License at
>>>> +
>>>> + http://www.apache.org/licenses/LICENSE-2.0
>>>> +
>>>> + Unless required by applicable law or agreed to in writing,
>>>> + software distributed under the License is distributed on an
>>>> + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + KIND, either express or implied.  See the License for the
>>>> + specific language governing permissions and limitations
>>>> + under the License.
>>>> +-->
>>>> +<persistence xmlns="http://java.sun.com/xml/ns/persistence"
>>>> +    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> +    version="1.0">
>>>> +
>>>> +    <persistence-unit name="test">
>>>> +        <properties>
>>>> +            <!--
>>>> +            These properties are instead passed via System properties
>>>> +
>>>> +            <property name="openjpa.ConnectionDriverName"
>>>> +                value="org.apache.commons.dbcp.BasicDataSource"/>
>>>> +            <property name="openjpa.ConnectionProperties"
>>>> +
>>>> value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/database/openjpa-test-database;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
>>>>
>>>>
>>>> +            -->
>>>> +            <property name="openjpa.jdbc.SynchronizeMappings"
>>>> +                value="buildSchema(ForeignKeys=true)"/>
>>>> +            <property name="openjpa.BrokerFactory"
>>>> +
>>>> value="org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory"/>
>>>> +            <property
>>>> +                name="openjpa.abstractstore.AbstractStoreManager"
>>>> +                value="org.apache.openjpa.xmlstore.XMLStoreManager" />
>>>> +        </properties>
>>>> +    </persistence-unit>
>>>> +
>>>> +</persistence>
>>>> +
>>>>
>>>> Property changes on: src/test/resources/META-INF/persistence.xml
>>>> ___________________________________________________________________
>>>> Added: svn:eol-style
>>>>  + native
>>>>
>>>> Index: pom.xml
>>>> ===================================================================
>>>> --- pom.xml    (revision 897238)
>>>> +++ pom.xml    (working copy)
>>>> @@ -22,22 +22,122 @@
>>>> -->
>>>> <project xmlns="http://maven.apache.org/POM/4.0.0"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>>>> http://maven.apache.org/maven-v4_0_0.xsd">
>>>>    <modelVersion>4.0.0</modelVersion>
>>>> +    <parent>
>>>> +        <groupId>org.apache.openjpa</groupId>
>>>> +        <artifactId>openjpa-parent</artifactId>
>>>> +        <version>2.0.0-SNAPSHOT</version>
>>>> +    </parent>
>>>>    <groupId>org.apache.openjpa</groupId>
>>>>    <artifactId>openjpa-xmlstore</artifactId>
>>>>    <packaging>jar</packaging>
>>>>    <name>OpenJPA XML Store</name>
>>>>    <description>OpenJPA XML Store</description>
>>>> -    <url>http://openjpa.apache.org</url>
>>>> -    <parent>
>>>> -        <groupId>org.apache.openjpa</groupId>
>>>> -        <artifactId>openjpa-parent</artifactId>
>>>> -        <version>2.0.0-SNAPSHOT</version>
>>>> -    </parent>
>>>> +
>>>>    <dependencies>
>>>>        <dependency>
>>>>            <groupId>org.apache.openjpa</groupId>
>>>>            <artifactId>openjpa-kernel</artifactId>
>>>>            <version>${pom.version}</version>
>>>>        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.apache.openjpa</groupId>
>>>> +            <artifactId>openjpa-persistence-jdbc</artifactId>
>>>> +            <version>${pom.version}</version>
>>>> +            <scope>test</scope>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.apache.openjpa</groupId>
>>>> +            <artifactId>openjpa-persistence-jdbc</artifactId>
>>>> +            <version>${pom.version}</version>
>>>> +            <classifier>test-base</classifier>
>>>> +            <scope>test</scope>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>commons-dbcp</groupId>
>>>> +            <artifactId>commons-dbcp</artifactId>
>>>> +            <scope>test</scope>
>>>> +        </dependency>
>>>>    </dependencies>
>>>> +
>>>> +    <properties>
>>>> +        <connection.driver.name />
>>>> +
>>>> <connection.url>target/database/openjpa-xmlstore</connection.url>
>>>> +        <connection.username />
>>>> +        <connection.password />
>>>> +    </properties>
>>>> +
>>>> +    <build>
>>>> +        <plugins>
>>>> +            <plugin>
>>>> +                <groupId>org.apache.maven.plugins</groupId>
>>>> +                <artifactId>maven-antrun-plugin</artifactId>
>>>> +                <executions>
>>>> +                    <execution>
>>>> +                        <phase>test-compile</phase>
>>>> +                        <configuration>
>>>> +                            <tasks>
>>>> +                                <ant
>>>> antfile="src/test/ant/enhancer.xml" target="enhance"
>>>> inheritRefs="true">
>>>> +                                    <property name="maven.test.skip"
>>>> value="${maven.test.skip}" />
>>>> +                                    <property name="test"
>>>> value="${test}" />
>>>> +                                    <property name="outdir"
>>>> value="${project.build.outputDirectory}" />
>>>> +                                    <property
>>>> name="project.build.testOutputDirectory"
>>>> value="${project.build.testOutputDirectory}" />
>>>> +                                    <property name="openjpa.loglevel"
>>>> value="${openjpa.loglevel}" />
>>>> +                                    <property name="build.enhance"
>>>> value="${build.enhance}" />
>>>> +                                </ant>
>>>> +                            </tasks>
>>>> +                        </configuration>
>>>> +                        <goals>
>>>> +                            <goal>run</goal>
>>>> +                        </goals>
>>>> +                    </execution>
>>>> +                </executions>
>>>> +            </plugin>
>>>> +            <plugin>
>>>> +                <groupId>org.apache.maven.plugins</groupId>
>>>> +                <artifactId>maven-surefire-plugin</artifactId>
>>>> +                <configuration>
>>>> +                    <argLine>${surefire.jvm.args}</argLine>
>>>> +                    <excludes>
>>>> +                        <!--
>>>> +                            exclude classes that end with 'Test'
>>>> +                            these are not test cases per OpenJPA
>>>> standards
>>>> +                        -->
>>>> +
>>>> <exclude>org/apache/openjpa/**/*Test.java</exclude>
>>>> +                    </excludes>
>>>> +                    <systemProperties>
>>>> +                        <property>
>>>> +                            <name>openjpa.Log</name>
>>>> +
>>>> <value>DefaultLevel=${openjpa.loglevel}</value>
>>>> +                        </property>
>>>> +                        <property>
>>>> +                           
>>>> <name>openjpa.DynamicEnhancementAgent</name>
>>>> +                            <value>false</value>
>>>> +                        </property>
>>>> +                        <property>
>>>> +                            <name>openjpa.ConnectionDriverName</name>
>>>> +
>>>> <value>org.apache.commons.dbcp.BasicDataSource</value>
>>>> +                        </property>
>>>> +                        <property>
>>>> +                            <name>openjpa.ConnectionProperties</name>
>>>> +
>>>> <value>DriverClassName=${connection.driver.name},Url=${connection.url},Username=${connection.username},Password=${connection.password}</value>
>>>>
>>>>
>>>> +                        </property>
>>>> +                        <property>
>>>> +                            <name>tests.openjpa.allowfailure</name>
>>>> +                           
>>>> <value>${tests.openjpa.allowfailure}</value>
>>>> +                        </property>
>>>> +<!--
>>>> +                        <property>
>>>> +                            <name>openjpa.BrokerFactory</name>
>>>> +
>>>> <value>org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory</value>
>>>>
>>>>
>>>> +                        </property>
>>>> +                        <property>
>>>> +
>>>> <name>openjpa.abstractstore.AbstractStoreManager</name>
>>>> +
>>>> <value>org.apache.openjpa.xmlstore.XMLStoreManager</value>
>>>> +                        </property>
>>>> +-->
>>>> +                    </systemProperties>
>>>> +                </configuration>
>>>> +            </plugin>
>>>> +        </plugins>
>>>> +    </build>
>>>> </project>
>>>
> 

Re: How to configure a XMLStoreManager

Posted by Patrick Linskey <pl...@gmail.com>.
Let me know if you're interested in trying again; I can see about  
sharing a more detailed (read: functional) example with you.

-Patrick

On Feb 15, 2010, at 10:07 AM, Donald Woods wrote:

> I never got it to work on trunk and gave up....
>
>
> -Donald
>
>
> On 2/12/10 7:29 PM, Patrick Linskey wrote:
>> Hi,
>>
>> I just noticed this thread. Are you still having this problem?
>>
>> I've been working with the AbstractStoreManager (of which the
>> XMLStoreManager is a basic example) recently, so I might be able to
>> point you in the right direction.
>>
>> Also, note that the XMLStoreManager generates lousy XML.
>>
>> -Patrick
>>
>> On Jan 8, 2010, at 3:06 PM, Donald Woods wrote:
>>
>>> I looked through the user docs (nothing there) and Google'd for it,
>>> but I can't seem to get the XMLStoreManager to work.
>>>
>>> I created a persistence.xml with the following properties -
>>>
>>> <property name="openjpa.BrokerFactory"
>>> value 
>>> ="org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory"/>
>>> <property
>>> name="openjpa.abstractstore.AbstractStoreManager"
>>> value="org.apache.openjpa.xmlstore.XMLStoreManager" />
>>>
>>> But am getting the following exception when running a junit -
>>>
>>> testGroupBy 
>>> (org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery)
>>> Time elapsed: 0.505 sec  <<< ERROR!
>>> java.lang.RuntimeException: <openjpa-2.0.0-SNAPSHOT-r422266:897056M
>>> nonfatal general error>
>>> org.apache.openjpa.persistence.PersistenceException:
>>> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to
>>> org.apache.openjpa.jdbc.kernel.JDBCStore
>>>    at
>>> org 
>>> .apache 
>>> .openjpa 
>>> .persistence 
>>> .jdbc.query.TestGroupByQuery.setUp(TestGroupByQuery.java:47)
>>>
>>>    at junit.framework.TestCase.runBare(TestCase.java:125)
>>> ...
>>> Caused by: <openjpa-2.0.0-SNAPSHOT-r422266:897056M nonfatal general
>>> error> org.apache.openjpa.persistence.PersistenceException:
>>> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to
>>> org.apache.openjpa.jdbc.kernel.JDBCStore
>>>    at
>>> org 
>>> .apache 
>>> .openjpa 
>>> .kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java: 
>>> 214)
>>>
>>>    at
>>> org 
>>> .apache 
>>> .openjpa 
>>> .kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java: 
>>> 194)
>>>
>>>    at
>>> org 
>>> .apache 
>>> .openjpa 
>>> .kernel 
>>> .DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:152)
>>>
>>>    at
>>> org 
>>> .apache 
>>> .openjpa 
>>> .persistence 
>>> .EntityManagerFactoryImpl 
>>> .createEntityManager(EntityManagerFactoryImpl.java:200)
>>>
>>>    at
>>> org 
>>> .apache 
>>> .openjpa 
>>> .persistence 
>>> .EntityManagerFactoryImpl 
>>> .createEntityManager(EntityManagerFactoryImpl.java:151)
>>>
>>>    at
>>> org 
>>> .apache 
>>> .openjpa 
>>> .persistence 
>>> .jdbc.query.TestGroupByQuery.createData(TestGroupByQuery.java:52)
>>>
>>>    at
>>> org 
>>> .apache 
>>> .openjpa 
>>> .persistence 
>>> .jdbc.query.TestGroupByQuery.setUp(TestGroupByQuery.java:45)
>>>
>>>    ... 24 more
>>> Caused by: java.lang.ClassCastException:
>>> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to
>>> org.apache.openjpa.jdbc.kernel.JDBCStore
>>>    at
>>> org 
>>> .apache 
>>> .openjpa 
>>> .jdbc 
>>> .kernel 
>>> .PessimisticLockManager.setContext(PessimisticLockManager.java:63)
>>>
>>>    at
>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:354)
>>>    at
>>> org 
>>> .apache 
>>> .openjpa 
>>> .kernel 
>>> .AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java: 
>>> 229)
>>>
>>>    at
>>> org 
>>> .apache 
>>> .openjpa 
>>> .kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java: 
>>> 208)
>>>
>>>    ... 30 more
>>>
>>>
>>> Any ideas?
>>> -Donald
>>>
>>>
>>>
>>>
>>> Index:
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> IndoorGame.java
>>>
>>> ===================================================================
>>> ---
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> IndoorGame.java
>>> (revision 0)
>>> +++
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> IndoorGame.java
>>> (revision 0)
>>> @@ -0,0 +1,43 @@
>>> +/*
>>> + * TestLockGroupsWithHorizontalBaseType.java
>>> + *
>>> + * Created on October 4, 2006, 5:03 PM
>>> + *
>>> + * To change this template, choose Tools | Template Manager
>>> + * and open the template in the editor.
>>> + */
>>> +
>>> +/*
>>> + * 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.openjpa.persistence.jdbc.query.domain;
>>> +
>>> +import javax.persistence.Entity;
>>> +
>>> +@Entity
>>> +public class IndoorGame extends Game {
>>> +    private int nPlayer;
>>> +
>>> +    public int getPlayer() {
>>> +        return nPlayer;
>>> +    }
>>> +
>>> +    public void setPlayer(int n) {
>>> +        this.nPlayer = n;
>>> +    }
>>> +}
>>>
>>> Property changes on:
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> IndoorGame.java
>>>
>>> ___________________________________________________________________
>>> Added: svn:eol-style
>>>  + native
>>>
>>> Index:
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> Chess.java
>>> ===================================================================
>>> ---
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> Chess.java
>>> (revision 0)
>>> +++
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> Chess.java
>>> (revision 0)
>>> @@ -0,0 +1,43 @@
>>> +/*
>>> + * TestLockGroupsWithHorizontalBaseType.java
>>> + *
>>> + * Created on October 4, 2006, 5:03 PM
>>> + *
>>> + * To change this template, choose Tools | Template Manager
>>> + * and open the template in the editor.
>>> + */
>>> +
>>> +/*
>>> + * 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.openjpa.persistence.jdbc.query.domain;
>>> +
>>> +import javax.persistence.Entity;
>>> +
>>> +@Entity
>>> +public class Chess extends IndoorGame {
>>> +    private int nPiece;
>>> +
>>> +    public int getPiece() {
>>> +        return nPiece;
>>> +    }
>>> +
>>> +    public void setPiece(int n) {
>>> +        this.nPiece = n;
>>> +    }
>>> +}
>>>
>>> Property changes on:
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> Chess.java
>>> ___________________________________________________________________
>>> Added: svn:eol-style
>>>  + native
>>>
>>> Index:
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> Game.java
>>> ===================================================================
>>> ---
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> Game.java
>>> (revision 0)
>>> +++
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> Game.java
>>> (revision 0)
>>> @@ -0,0 +1,65 @@
>>> +/*
>>> + * TestLockGroupsWithHorizontalBaseType.java
>>> + *
>>> + * Created on October 4, 2006, 5:03 PM
>>> + *
>>> + * To change this template, choose Tools | Template Manager
>>> + * and open the template in the editor.
>>> + */
>>> +
>>> +/*
>>> + * 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.openjpa.persistence.jdbc.query.domain;
>>> +
>>> +import javax.persistence.Entity;
>>> +import javax.persistence.GeneratedValue;
>>> +import javax.persistence.Id;
>>> +import javax.persistence.Inheritance;
>>> +import javax.persistence.InheritanceType;
>>> +
>>> +/**
>>> + * Simple unrelated persistent entity used to test logically union
>>> queries.
>>> + * This class is root of an inheritance hierarchy using TABLE PER  
>>> CLASS
>>> + * strategy. Polymorphic queries on this class needs to run logical
>>> union
>>> + * of queries on all known subclasses.
>>> + *
>>> + * @author Pinaki Poddar
>>> + *
>>> + */
>>> +@Entity
>>> +@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
>>> +public class Game {
>>> +    @Id
>>> +    @GeneratedValue
>>> +    private long id;
>>> +
>>> +    private String name;
>>> +
>>> +    public long getId() {
>>> +        return id;
>>> +    }
>>> +
>>> +    public String getName() {
>>> +        return name;
>>> +    }
>>> +
>>> +    public void setName(String name) {
>>> +        this.name = name;
>>> +    }
>>> +}
>>>
>>> Property changes on:
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> Game.java
>>> ___________________________________________________________________
>>> Added: svn:eol-style
>>>  + native
>>>
>>> Index:
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> Scrabble.java
>>>
>>> ===================================================================
>>> ---
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> Scrabble.java
>>> (revision 0)
>>> +++
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> Scrabble.java
>>> (revision 0)
>>> @@ -0,0 +1,44 @@
>>> +/*
>>> + * TestLockGroupsWithHorizontalBaseType.java
>>> + *
>>> + * Created on October 4, 2006, 5:03 PM
>>> + *
>>> + * To change this template, choose Tools | Template Manager
>>> + * and open the template in the editor.
>>> + */
>>> +
>>> +/*
>>> + * 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.openjpa.persistence.jdbc.query.domain;
>>> +
>>> +import javax.persistence.Entity;
>>> +
>>> +@Entity
>>> +public class Scrabble extends IndoorGame {
>>> +    private int nTile;
>>> +
>>> +    public int getTile() {
>>> +        return nTile;
>>> +    }
>>> +
>>> +    public void setTile(int n) {
>>> +        this.nTile = n;
>>> +    }
>>> +
>>> +}
>>>
>>> Property changes on:
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/ 
>>> Scrabble.java
>>>
>>> ___________________________________________________________________
>>> Added: svn:eol-style
>>>  + native
>>>
>>> Index:
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/ 
>>> TestGroupByQuery.java
>>>
>>> ===================================================================
>>> ---
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/ 
>>> TestGroupByQuery.java
>>> (revision 0)
>>> +++
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/ 
>>> TestGroupByQuery.java
>>> (revision 0)
>>> @@ -0,0 +1,75 @@
>>> +/*
>>> + * 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.openjpa.persistence.jdbc.query;
>>> +
>>> +import java.util.List;
>>> +
>>> +import javax.persistence.EntityManager;
>>> +
>>> +import org.apache.openjpa.persistence.jdbc.query.domain.IndoorGame;
>>> +import org.apache.openjpa.persistence.jdbc.query.domain.Scrabble;
>>> +import org.apache.openjpa.persistence.jdbc.query.domain.Chess;
>>> +import org.apache.openjpa.persistence.jdbc.query.domain.Game;
>>> +import org.apache.openjpa.persistence.test.SingleEMFTestCase;
>>> +
>>> +/**
>>> + * Tests GROUP BY in sub query does not get parsed by owning query.
>>> + *
>>> + * Further details can be found in <A
>>> + *
>>> HREF="https://issues.apache.org/jira/browse/ 
>>> OPENJPA-28">OPENJPA-28</A>
>>> + *
>>> + * @author Pinaki Poddar
>>> + *
>>> + */
>>> +public class TestGroupByQuery extends SingleEMFTestCase {
>>> +    public void setUp() {
>>> +        super.setUp(DROP_TABLES, Game.class, IndoorGame.class,
>>> Scrabble.class,
>>> +                Chess.class);
>>> +        try {
>>> +            createData();
>>> +        } catch (Exception e) {
>>> +            throw new RuntimeException(e);
>>> +        }
>>> +    }
>>> +
>>> +    void createData() throws Exception {
>>> +        EntityManager em = emf.createEntityManager();
>>> +        em.getTransaction().begin();
>>> +        Class[] classes = { Game.class, IndoorGame.class,
>>> Scrabble.class,
>>> +                Chess.class };
>>> +        for (Class cls : classes) {
>>> +            for (int i = 1; i <= 4; i++) {
>>> +                Game p = (Game) cls.newInstance();
>>> +                p.setName(cls.getSimpleName() + "-" + i);
>>> +                em.persist(p);
>>> +            }
>>> +        }
>>> +        em.getTransaction().commit();
>>> +    }
>>> +
>>> +    public void testGroupBy() {
>>> +        String jpql = "SELECT g.name, g.nTile FROM Scrabble g  
>>> WHERE "
>>> +                + "(g.name = ANY(SELECT g1.name FROM Scrabble g1 "
>>> +                + "GROUP BY g1.name )) ORDER BY g.name";
>>> +        EntityManager em = emf.createEntityManager();
>>> +
>>> +        List<IndoorGame> employees =
>>> em.createQuery(jpql).getResultList();
>>> +
>>> +    }
>>> +}
>>>
>>> Property changes on:
>>> src/test/java/org/apache/openjpa/persistence/jdbc/query/ 
>>> TestGroupByQuery.java
>>>
>>> ___________________________________________________________________
>>> Added: svn:eol-style
>>>  + native
>>>
>>> Index: src/test/ant/enhancer.xml
>>> ===================================================================
>>> --- src/test/ant/enhancer.xml    (revision 0)
>>> +++ src/test/ant/enhancer.xml    (revision 0)
>>> @@ -0,0 +1,76 @@
>>> +<?xml version="1.0" encoding="UTF-8"?>
>>> +<!--
>>> +    Licensed to the Apache Software Foundation (ASF) under one
>>> +    or more contributor license agreements.  See the NOTICE file
>>> +    distributed with this work for additional information
>>> +    regarding copyright ownership.  The ASF licenses this file
>>> +    to you under the Apache License, Version 2.0 (the
>>> +    "License"); you may not use this file except in compliance
>>> +    with the License.  You may obtain a copy of the License at
>>> +
>>> +    http://www.apache.org/licenses/LICENSE-2.0
>>> +
>>> +    Unless required by applicable law or agreed to in writing,
>>> +    software distributed under the License is distributed on an
>>> +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>> +    KIND, either express or implied.  See the License for the
>>> +    specific language governing permissions and limitations
>>> +    under the License.
>>> +-->
>>> +<project name="enhance" basedir=".">
>>> +    <!--
>>> +        This build file executes the PCEnhancer on the test  
>>> entities.
>>> It's in a
>>> +        separate file instead of nested in pom.xml to make some
>>> conditional
>>> +        processing easier.
>>> +
>>> +        Test classes will not be compiled if maven is invoked with
>>> +        -Dmaven.test.skip=true.
>>> +    -->
>>> +
>>> +    <condition property="maven.test.skip.istrue">
>>> +        <istrue value="${maven.test.skip}" />
>>> +    </condition>
>>> +
>>> +    <condition property="skip.enhance">
>>> +        <or>
>>> +            <equals arg1="${test}" arg2="false" />
>>> +            <equals arg1="${build.enhance}" arg2="false" />
>>> +            <istrue value="${maven.test.skip}" />
>>> +            <istrue value="${skipTests}" />
>>> +        </or>
>>> +    </condition>
>>> +
>>> +    <!-- =================================
>>> +          target: enhance
>>> +         ================================= -->
>>> +    <target name="enhance" description="--> run the enhancer unless
>>> test=false" unless="skip.enhance">
>>> +        <antcall target="enhance.all.entities" inheritall="true"
>>> inheritrefs="true" />
>>> +    </target>
>>> +
>>> +    <!-- =================================
>>> +          target: enhance.all.entities
>>> +         ================================= -->
>>> +    <target name="enhance.all.entities" description="--> enhance  
>>> the
>>> test entities" unless="skip.enhance">
>>> +        <echo> running enhancer</echo>
>>> +        <!--
>>> +            Inherited references won't be present until the task is
>>> called.
>>> +            Therefore the path definition needs to stay inside  
>>> the task.
>>> +          -->
>>> +        <path id="cp">
>>> +            <path refid="maven.test.classpath" />
>>> +        </path>
>>> +
>>> +        <taskdef name="openjpac"
>>> classname="org.apache.openjpa.ant.PCEnhancerTask">
>>> +            <classpath refid="cp" />
>>> +        </taskdef>
>>> +
>>> +        <fileset id="enhance.path.ref"
>>> dir="${project.build.testOutputDirectory}">
>>> +            <include name="**/*.class" />
>>> +        </fileset>
>>> +        <openjpac>
>>> +            <classpath refid="cp" />
>>> +            <fileset refid="enhance.path.ref" />
>>> +            <config log="DefaultLevel=${openjpa.loglevel}" />
>>> +        </openjpac>
>>> +    </target>
>>> +</project>
>>>
>>> Property changes on: src/test/ant/enhancer.xml
>>> ___________________________________________________________________
>>> Added: svn:eol-style
>>>  + native
>>>
>>> Index: src/test/resources/META-INF/persistence.xml
>>> ===================================================================
>>> --- src/test/resources/META-INF/persistence.xml    (revision 0)
>>> +++ src/test/resources/META-INF/persistence.xml    (revision 0)
>>> @@ -0,0 +1,45 @@
>>> +<?xml version="1.0" encoding="UTF-8"?>
>>> +<!--
>>> + Licensed to the Apache Software Foundation (ASF) under one
>>> + or more contributor license agreements.  See the NOTICE file
>>> + distributed with this work for additional information
>>> + regarding copyright ownership.  The ASF licenses this file
>>> + to you under the Apache License, Version 2.0 (the
>>> + "License"); you may not use this file except in compliance
>>> + with the License.  You may obtain a copy of the License at
>>> +
>>> + http://www.apache.org/licenses/LICENSE-2.0
>>> +
>>> + Unless required by applicable law or agreed to in writing,
>>> + software distributed under the License is distributed on an
>>> + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>> + KIND, either express or implied.  See the License for the
>>> + specific language governing permissions and limitations
>>> + under the License.
>>> +-->
>>> +<persistence xmlns="http://java.sun.com/xml/ns/persistence"
>>> +    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> +    version="1.0">
>>> +
>>> +    <persistence-unit name="test">
>>> +        <properties>
>>> +            <!--
>>> +            These properties are instead passed via System  
>>> properties
>>> +
>>> +            <property name="openjpa.ConnectionDriverName"
>>> +                value="org.apache.commons.dbcp.BasicDataSource"/>
>>> +            <property name="openjpa.ConnectionProperties"
>>> +
>>> value 
>>> = 
>>> "DriverClassName 
>>> =org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/ 
>>> database/openjpa-test- 
>>> database 
>>> ;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
>>>
>>> +            -->
>>> +            <property name="openjpa.jdbc.SynchronizeMappings"
>>> +                value="buildSchema(ForeignKeys=true)"/>
>>> +            <property name="openjpa.BrokerFactory"
>>> +
>>> value 
>>> ="org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory"/>
>>> +            <property
>>> +                name="openjpa.abstractstore.AbstractStoreManager"
>>> +                 
>>> value="org.apache.openjpa.xmlstore.XMLStoreManager" />
>>> +        </properties>
>>> +    </persistence-unit>
>>> +
>>> +</persistence>
>>> +
>>>
>>> Property changes on: src/test/resources/META-INF/persistence.xml
>>> ___________________________________________________________________
>>> Added: svn:eol-style
>>>  + native
>>>
>>> Index: pom.xml
>>> ===================================================================
>>> --- pom.xml    (revision 897238)
>>> +++ pom.xml    (working copy)
>>> @@ -22,22 +22,122 @@
>>> -->
>>> <project xmlns="http://maven.apache.org/POM/4.0.0"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>>> http://maven.apache.org/maven-v4_0_0.xsd">
>>>    <modelVersion>4.0.0</modelVersion>
>>> +    <parent>
>>> +        <groupId>org.apache.openjpa</groupId>
>>> +        <artifactId>openjpa-parent</artifactId>
>>> +        <version>2.0.0-SNAPSHOT</version>
>>> +    </parent>
>>>    <groupId>org.apache.openjpa</groupId>
>>>    <artifactId>openjpa-xmlstore</artifactId>
>>>    <packaging>jar</packaging>
>>>    <name>OpenJPA XML Store</name>
>>>    <description>OpenJPA XML Store</description>
>>> -    <url>http://openjpa.apache.org</url>
>>> -    <parent>
>>> -        <groupId>org.apache.openjpa</groupId>
>>> -        <artifactId>openjpa-parent</artifactId>
>>> -        <version>2.0.0-SNAPSHOT</version>
>>> -    </parent>
>>> +
>>>    <dependencies>
>>>        <dependency>
>>>            <groupId>org.apache.openjpa</groupId>
>>>            <artifactId>openjpa-kernel</artifactId>
>>>            <version>${pom.version}</version>
>>>        </dependency>
>>> +        <dependency>
>>> +            <groupId>org.apache.openjpa</groupId>
>>> +            <artifactId>openjpa-persistence-jdbc</artifactId>
>>> +            <version>${pom.version}</version>
>>> +            <scope>test</scope>
>>> +        </dependency>
>>> +        <dependency>
>>> +            <groupId>org.apache.openjpa</groupId>
>>> +            <artifactId>openjpa-persistence-jdbc</artifactId>
>>> +            <version>${pom.version}</version>
>>> +            <classifier>test-base</classifier>
>>> +            <scope>test</scope>
>>> +        </dependency>
>>> +        <dependency>
>>> +            <groupId>commons-dbcp</groupId>
>>> +            <artifactId>commons-dbcp</artifactId>
>>> +            <scope>test</scope>
>>> +        </dependency>
>>>    </dependencies>
>>> +
>>> +    <properties>
>>> +        <connection.driver.name />
>>> +
>>> <connection.url>target/database/openjpa-xmlstore</connection.url>
>>> +        <connection.username />
>>> +        <connection.password />
>>> +    </properties>
>>> +
>>> +    <build>
>>> +        <plugins>
>>> +            <plugin>
>>> +                <groupId>org.apache.maven.plugins</groupId>
>>> +                <artifactId>maven-antrun-plugin</artifactId>
>>> +                <executions>
>>> +                    <execution>
>>> +                        <phase>test-compile</phase>
>>> +                        <configuration>
>>> +                            <tasks>
>>> +                                <ant
>>> antfile="src/test/ant/enhancer.xml" target="enhance"  
>>> inheritRefs="true">
>>> +                                    <property  
>>> name="maven.test.skip"
>>> value="${maven.test.skip}" />
>>> +                                    <property name="test"
>>> value="${test}" />
>>> +                                    <property name="outdir"
>>> value="${project.build.outputDirectory}" />
>>> +                                    <property
>>> name="project.build.testOutputDirectory"
>>> value="${project.build.testOutputDirectory}" />
>>> +                                    <property  
>>> name="openjpa.loglevel"
>>> value="${openjpa.loglevel}" />
>>> +                                    <property name="build.enhance"
>>> value="${build.enhance}" />
>>> +                                </ant>
>>> +                            </tasks>
>>> +                        </configuration>
>>> +                        <goals>
>>> +                            <goal>run</goal>
>>> +                        </goals>
>>> +                    </execution>
>>> +                </executions>
>>> +            </plugin>
>>> +            <plugin>
>>> +                <groupId>org.apache.maven.plugins</groupId>
>>> +                <artifactId>maven-surefire-plugin</artifactId>
>>> +                <configuration>
>>> +                    <argLine>${surefire.jvm.args}</argLine>
>>> +                    <excludes>
>>> +                        <!--
>>> +                            exclude classes that end with 'Test'
>>> +                            these are not test cases per OpenJPA
>>> standards
>>> +                        -->
>>> +
>>> <exclude>org/apache/openjpa/**/*Test.java</exclude>
>>> +                    </excludes>
>>> +                    <systemProperties>
>>> +                        <property>
>>> +                            <name>openjpa.Log</name>
>>> +
>>> <value>DefaultLevel=${openjpa.loglevel}</value>
>>> +                        </property>
>>> +                        <property>
>>> +                             
>>> <name>openjpa.DynamicEnhancementAgent</name>
>>> +                            <value>false</value>
>>> +                        </property>
>>> +                        <property>
>>> +                            <name>openjpa.ConnectionDriverName</ 
>>> name>
>>> +
>>> <value>org.apache.commons.dbcp.BasicDataSource</value>
>>> +                        </property>
>>> +                        <property>
>>> +                            <name>openjpa.ConnectionProperties</ 
>>> name>
>>> +
>>> <value>DriverClassName=${connection.driver.name},Url=$ 
>>> {connection.url},Username=${connection.username},Password=$ 
>>> {connection.password}</value>
>>>
>>> +                        </property>
>>> +                        <property>
>>> +                            <name>tests.openjpa.allowfailure</name>
>>> +                            <value>${tests.openjpa.allowfailure}</ 
>>> value>
>>> +                        </property>
>>> +<!--
>>> +                        <property>
>>> +                            <name>openjpa.BrokerFactory</name>
>>> +
>>> < 
>>> value>org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory</ 
>>> value>
>>>
>>> +                        </property>
>>> +                        <property>
>>> +
>>> <name>openjpa.abstractstore.AbstractStoreManager</name>
>>> +
>>> <value>org.apache.openjpa.xmlstore.XMLStoreManager</value>
>>> +                        </property>
>>> +-->
>>> +                    </systemProperties>
>>> +                </configuration>
>>> +            </plugin>
>>> +        </plugins>
>>> +    </build>
>>> </project>
>>

-- 
Patrick Linskey
202 669 5907


Re: How to configure a XMLStoreManager

Posted by Donald Woods <dw...@apache.org>.
I never got it to work on trunk and gave up....


-Donald


On 2/12/10 7:29 PM, Patrick Linskey wrote:
> Hi,
> 
> I just noticed this thread. Are you still having this problem?
> 
> I've been working with the AbstractStoreManager (of which the
> XMLStoreManager is a basic example) recently, so I might be able to
> point you in the right direction.
> 
> Also, note that the XMLStoreManager generates lousy XML.
> 
> -Patrick
> 
> On Jan 8, 2010, at 3:06 PM, Donald Woods wrote:
> 
>> I looked through the user docs (nothing there) and Google'd for it,
>> but I can't seem to get the XMLStoreManager to work.
>>
>> I created a persistence.xml with the following properties -
>>
>> <property name="openjpa.BrokerFactory"
>>  value="org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory"/>
>> <property
>>  name="openjpa.abstractstore.AbstractStoreManager"
>>  value="org.apache.openjpa.xmlstore.XMLStoreManager" />
>>
>> But am getting the following exception when running a junit -
>>
>> testGroupBy(org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery) 
>> Time elapsed: 0.505 sec  <<< ERROR!
>> java.lang.RuntimeException: <openjpa-2.0.0-SNAPSHOT-r422266:897056M
>> nonfatal general error>
>> org.apache.openjpa.persistence.PersistenceException:
>> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to
>> org.apache.openjpa.jdbc.kernel.JDBCStore
>>     at
>> org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery.setUp(TestGroupByQuery.java:47)
>>
>>     at junit.framework.TestCase.runBare(TestCase.java:125)
>> ...
>> Caused by: <openjpa-2.0.0-SNAPSHOT-r422266:897056M nonfatal general
>> error> org.apache.openjpa.persistence.PersistenceException:
>> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to
>> org.apache.openjpa.jdbc.kernel.JDBCStore
>>     at
>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:214)
>>
>>     at
>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:194)
>>
>>     at
>> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:152)
>>
>>     at
>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:200)
>>
>>     at
>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:151)
>>
>>     at
>> org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery.createData(TestGroupByQuery.java:52)
>>
>>     at
>> org.apache.openjpa.persistence.jdbc.query.TestGroupByQuery.setUp(TestGroupByQuery.java:45)
>>
>>     ... 24 more
>> Caused by: java.lang.ClassCastException:
>> org.apache.openjpa.xmlstore.XMLStoreManager cannot be cast to
>> org.apache.openjpa.jdbc.kernel.JDBCStore
>>     at
>> org.apache.openjpa.jdbc.kernel.PessimisticLockManager.setContext(PessimisticLockManager.java:63)
>>
>>     at
>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:354)
>>     at
>> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)
>>
>>     at
>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:208)
>>
>>     ... 30 more
>>
>>
>> Any ideas?
>> -Donald
>>
>>
>>
>>
>> Index:
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/IndoorGame.java
>>
>> ===================================================================
>> ---
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/IndoorGame.java   
>> (revision 0)
>> +++
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/IndoorGame.java   
>> (revision 0)
>> @@ -0,0 +1,43 @@
>> +/*
>> + * TestLockGroupsWithHorizontalBaseType.java
>> + *
>> + * Created on October 4, 2006, 5:03 PM
>> + *
>> + * To change this template, choose Tools | Template Manager
>> + * and open the template in the editor.
>> + */
>> +
>> +/*
>> + * 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.openjpa.persistence.jdbc.query.domain;
>> +
>> +import javax.persistence.Entity;
>> +
>> +@Entity
>> +public class IndoorGame extends Game {
>> +    private int nPlayer;
>> +
>> +    public int getPlayer() {
>> +        return nPlayer;
>> +    }
>> +
>> +    public void setPlayer(int n) {
>> +        this.nPlayer = n;
>> +    }
>> +}
>>
>> Property changes on:
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/IndoorGame.java
>>
>> ___________________________________________________________________
>> Added: svn:eol-style
>>   + native
>>
>> Index:
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Chess.java
>> ===================================================================
>> ---
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Chess.java   
>> (revision 0)
>> +++
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Chess.java   
>> (revision 0)
>> @@ -0,0 +1,43 @@
>> +/*
>> + * TestLockGroupsWithHorizontalBaseType.java
>> + *
>> + * Created on October 4, 2006, 5:03 PM
>> + *
>> + * To change this template, choose Tools | Template Manager
>> + * and open the template in the editor.
>> + */
>> +
>> +/*
>> + * 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.openjpa.persistence.jdbc.query.domain;
>> +
>> +import javax.persistence.Entity;
>> +
>> +@Entity
>> +public class Chess extends IndoorGame {
>> +    private int nPiece;
>> +
>> +    public int getPiece() {
>> +        return nPiece;
>> +    }
>> +
>> +    public void setPiece(int n) {
>> +        this.nPiece = n;
>> +    }
>> +}
>>
>> Property changes on:
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Chess.java
>> ___________________________________________________________________
>> Added: svn:eol-style
>>   + native
>>
>> Index:
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Game.java
>> ===================================================================
>> ---
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Game.java   
>> (revision 0)
>> +++
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Game.java   
>> (revision 0)
>> @@ -0,0 +1,65 @@
>> +/*
>> + * TestLockGroupsWithHorizontalBaseType.java
>> + *
>> + * Created on October 4, 2006, 5:03 PM
>> + *
>> + * To change this template, choose Tools | Template Manager
>> + * and open the template in the editor.
>> + */
>> +
>> +/*
>> + * 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.openjpa.persistence.jdbc.query.domain;
>> +
>> +import javax.persistence.Entity;
>> +import javax.persistence.GeneratedValue;
>> +import javax.persistence.Id;
>> +import javax.persistence.Inheritance;
>> +import javax.persistence.InheritanceType;
>> +
>> +/**
>> + * Simple unrelated persistent entity used to test logically union
>> queries.
>> + * This class is root of an inheritance hierarchy using TABLE PER CLASS
>> + * strategy. Polymorphic queries on this class needs to run logical
>> union
>> + * of queries on all known subclasses.
>> + *
>> + * @author Pinaki Poddar
>> + *
>> + */
>> +@Entity
>> +@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
>> +public class Game {
>> +    @Id
>> +    @GeneratedValue
>> +    private long id;
>> +   
>> +    private String name;
>> +
>> +    public long getId() {
>> +        return id;
>> +    }
>> +
>> +    public String getName() {
>> +        return name;
>> +    }
>> +
>> +    public void setName(String name) {
>> +        this.name = name;
>> +    }
>> +}
>>
>> Property changes on:
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Game.java
>> ___________________________________________________________________
>> Added: svn:eol-style
>>   + native
>>
>> Index:
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Scrabble.java
>>
>> ===================================================================
>> ---
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Scrabble.java   
>> (revision 0)
>> +++
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Scrabble.java   
>> (revision 0)
>> @@ -0,0 +1,44 @@
>> +/*
>> + * TestLockGroupsWithHorizontalBaseType.java
>> + *
>> + * Created on October 4, 2006, 5:03 PM
>> + *
>> + * To change this template, choose Tools | Template Manager
>> + * and open the template in the editor.
>> + */
>> +
>> +/*
>> + * 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.openjpa.persistence.jdbc.query.domain;
>> +
>> +import javax.persistence.Entity;
>> +
>> +@Entity
>> +public class Scrabble extends IndoorGame {
>> +    private int nTile;
>> +
>> +    public int getTile() {
>> +        return nTile;
>> +    }
>> +
>> +    public void setTile(int n) {
>> +        this.nTile = n;
>> +    }
>> +
>> +}
>>
>> Property changes on:
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Scrabble.java
>>
>> ___________________________________________________________________
>> Added: svn:eol-style
>>   + native
>>
>> Index:
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/TestGroupByQuery.java
>>
>> ===================================================================
>> ---
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/TestGroupByQuery.java   
>> (revision 0)
>> +++
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/TestGroupByQuery.java   
>> (revision 0)
>> @@ -0,0 +1,75 @@
>> +/*
>> + * 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.openjpa.persistence.jdbc.query;
>> +
>> +import java.util.List;
>> +
>> +import javax.persistence.EntityManager;
>> +
>> +import org.apache.openjpa.persistence.jdbc.query.domain.IndoorGame;
>> +import org.apache.openjpa.persistence.jdbc.query.domain.Scrabble;
>> +import org.apache.openjpa.persistence.jdbc.query.domain.Chess;
>> +import org.apache.openjpa.persistence.jdbc.query.domain.Game;
>> +import org.apache.openjpa.persistence.test.SingleEMFTestCase;
>> +
>> +/**
>> + * Tests GROUP BY in sub query does not get parsed by owning query.
>> + *
>> + * Further details can be found in <A
>> + *
>> HREF="https://issues.apache.org/jira/browse/OPENJPA-28">OPENJPA-28</A>
>> + *
>> + * @author Pinaki Poddar
>> + *
>> + */
>> +public class TestGroupByQuery extends SingleEMFTestCase {
>> +    public void setUp() {
>> +        super.setUp(DROP_TABLES, Game.class, IndoorGame.class,
>> Scrabble.class,
>> +                Chess.class);
>> +        try {
>> +            createData();
>> +        } catch (Exception e) {
>> +            throw new RuntimeException(e);
>> +        }
>> +    }
>> +
>> +    void createData() throws Exception {
>> +        EntityManager em = emf.createEntityManager();
>> +        em.getTransaction().begin();
>> +        Class[] classes = { Game.class, IndoorGame.class,
>> Scrabble.class,
>> +                Chess.class };
>> +        for (Class cls : classes) {
>> +            for (int i = 1; i <= 4; i++) {
>> +                Game p = (Game) cls.newInstance();
>> +                p.setName(cls.getSimpleName() + "-" + i);
>> +                em.persist(p);
>> +            }
>> +        }
>> +        em.getTransaction().commit();
>> +    }
>> +
>> +    public void testGroupBy() {
>> +        String jpql = "SELECT g.name, g.nTile FROM Scrabble g WHERE "
>> +                + "(g.name = ANY(SELECT g1.name FROM Scrabble g1 "
>> +                + "GROUP BY g1.name )) ORDER BY g.name";
>> +        EntityManager em = emf.createEntityManager();
>> +
>> +        List<IndoorGame> employees =
>> em.createQuery(jpql).getResultList();
>> +
>> +    }
>> +}
>>
>> Property changes on:
>> src/test/java/org/apache/openjpa/persistence/jdbc/query/TestGroupByQuery.java
>>
>> ___________________________________________________________________
>> Added: svn:eol-style
>>   + native
>>
>> Index: src/test/ant/enhancer.xml
>> ===================================================================
>> --- src/test/ant/enhancer.xml    (revision 0)
>> +++ src/test/ant/enhancer.xml    (revision 0)
>> @@ -0,0 +1,76 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<!--
>> +    Licensed to the Apache Software Foundation (ASF) under one
>> +    or more contributor license agreements.  See the NOTICE file
>> +    distributed with this work for additional information
>> +    regarding copyright ownership.  The ASF licenses this file
>> +    to you under the Apache License, Version 2.0 (the
>> +    "License"); you may not use this file except in compliance
>> +    with the License.  You may obtain a copy of the License at
>> +
>> +    http://www.apache.org/licenses/LICENSE-2.0
>> +
>> +    Unless required by applicable law or agreed to in writing,
>> +    software distributed under the License is distributed on an
>> +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> +    KIND, either express or implied.  See the License for the
>> +    specific language governing permissions and limitations
>> +    under the License.
>> +-->
>> +<project name="enhance" basedir=".">
>> +    <!--
>> +        This build file executes the PCEnhancer on the test entities.
>> It's in a
>> +        separate file instead of nested in pom.xml to make some
>> conditional
>> +        processing easier.
>> +
>> +        Test classes will not be compiled if maven is invoked with
>> +        -Dmaven.test.skip=true.
>> +    -->
>> +
>> +    <condition property="maven.test.skip.istrue">
>> +        <istrue value="${maven.test.skip}" />
>> +    </condition>
>> +
>> +    <condition property="skip.enhance">
>> +        <or>
>> +            <equals arg1="${test}" arg2="false" />
>> +            <equals arg1="${build.enhance}" arg2="false" />
>> +            <istrue value="${maven.test.skip}" />
>> +            <istrue value="${skipTests}" />
>> +        </or>
>> +    </condition>
>> +
>> +    <!-- =================================
>> +          target: enhance
>> +         ================================= -->
>> +    <target name="enhance" description="--> run the enhancer unless
>> test=false" unless="skip.enhance">
>> +        <antcall target="enhance.all.entities" inheritall="true"
>> inheritrefs="true" />
>> +    </target>
>> +
>> +    <!-- =================================
>> +          target: enhance.all.entities
>> +         ================================= -->
>> +    <target name="enhance.all.entities" description="--> enhance the
>> test entities" unless="skip.enhance">
>> +        <echo> running enhancer</echo>
>> +        <!--
>> +            Inherited references won't be present until the task is
>> called.
>> +            Therefore the path definition needs to stay inside the task.
>> +          -->
>> +        <path id="cp">
>> +            <path refid="maven.test.classpath" />
>> +        </path>
>> +
>> +        <taskdef name="openjpac"
>> classname="org.apache.openjpa.ant.PCEnhancerTask">
>> +            <classpath refid="cp" />
>> +        </taskdef>
>> +
>> +        <fileset id="enhance.path.ref"
>> dir="${project.build.testOutputDirectory}">
>> +            <include name="**/*.class" />
>> +        </fileset>
>> +        <openjpac>
>> +            <classpath refid="cp" />
>> +            <fileset refid="enhance.path.ref" />
>> +            <config log="DefaultLevel=${openjpa.loglevel}" />
>> +        </openjpac>
>> +    </target>
>> +</project>
>>
>> Property changes on: src/test/ant/enhancer.xml
>> ___________________________________________________________________
>> Added: svn:eol-style
>>   + native
>>
>> Index: src/test/resources/META-INF/persistence.xml
>> ===================================================================
>> --- src/test/resources/META-INF/persistence.xml    (revision 0)
>> +++ src/test/resources/META-INF/persistence.xml    (revision 0)
>> @@ -0,0 +1,45 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<!--
>> + Licensed to the Apache Software Foundation (ASF) under one
>> + or more contributor license agreements.  See the NOTICE file
>> + distributed with this work for additional information
>> + regarding copyright ownership.  The ASF licenses this file
>> + to you under the Apache License, Version 2.0 (the
>> + "License"); you may not use this file except in compliance
>> + with the License.  You may obtain a copy of the License at
>> +
>> + http://www.apache.org/licenses/LICENSE-2.0
>> +
>> + Unless required by applicable law or agreed to in writing,
>> + software distributed under the License is distributed on an
>> + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + KIND, either express or implied.  See the License for the
>> + specific language governing permissions and limitations
>> + under the License.
>> +-->
>> +<persistence xmlns="http://java.sun.com/xml/ns/persistence"
>> +    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> +    version="1.0">
>> +
>> +    <persistence-unit name="test">
>> +        <properties>
>> +            <!--
>> +            These properties are instead passed via System properties
>> +
>> +            <property name="openjpa.ConnectionDriverName"
>> +                value="org.apache.commons.dbcp.BasicDataSource"/>
>> +            <property name="openjpa.ConnectionProperties"
>> +               
>> value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/database/openjpa-test-database;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
>>
>> +            -->
>> +            <property name="openjpa.jdbc.SynchronizeMappings"
>> +                value="buildSchema(ForeignKeys=true)"/>
>> +            <property name="openjpa.BrokerFactory"
>> +               
>> value="org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory"/>
>> +            <property
>> +                name="openjpa.abstractstore.AbstractStoreManager"
>> +                value="org.apache.openjpa.xmlstore.XMLStoreManager" />
>> +        </properties>
>> +    </persistence-unit>
>> +
>> +</persistence>
>> +
>>
>> Property changes on: src/test/resources/META-INF/persistence.xml
>> ___________________________________________________________________
>> Added: svn:eol-style
>>   + native
>>
>> Index: pom.xml
>> ===================================================================
>> --- pom.xml    (revision 897238)
>> +++ pom.xml    (working copy)
>> @@ -22,22 +22,122 @@
>> -->
>> <project xmlns="http://maven.apache.org/POM/4.0.0"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>> http://maven.apache.org/maven-v4_0_0.xsd">
>>     <modelVersion>4.0.0</modelVersion>
>> +    <parent>
>> +        <groupId>org.apache.openjpa</groupId>
>> +        <artifactId>openjpa-parent</artifactId>
>> +        <version>2.0.0-SNAPSHOT</version>
>> +    </parent>
>>     <groupId>org.apache.openjpa</groupId>
>>     <artifactId>openjpa-xmlstore</artifactId>
>>     <packaging>jar</packaging>
>>     <name>OpenJPA XML Store</name>
>>     <description>OpenJPA XML Store</description>
>> -    <url>http://openjpa.apache.org</url>
>> -    <parent>
>> -        <groupId>org.apache.openjpa</groupId>
>> -        <artifactId>openjpa-parent</artifactId>
>> -        <version>2.0.0-SNAPSHOT</version>
>> -    </parent>
>> +
>>     <dependencies>
>>         <dependency>
>>             <groupId>org.apache.openjpa</groupId>
>>             <artifactId>openjpa-kernel</artifactId>
>>             <version>${pom.version}</version>
>>         </dependency>
>> +        <dependency>
>> +            <groupId>org.apache.openjpa</groupId>
>> +            <artifactId>openjpa-persistence-jdbc</artifactId>
>> +            <version>${pom.version}</version>
>> +            <scope>test</scope>
>> +        </dependency>
>> +        <dependency>
>> +            <groupId>org.apache.openjpa</groupId>
>> +            <artifactId>openjpa-persistence-jdbc</artifactId>
>> +            <version>${pom.version}</version>
>> +            <classifier>test-base</classifier>
>> +            <scope>test</scope>
>> +        </dependency>
>> +        <dependency>
>> +            <groupId>commons-dbcp</groupId>
>> +            <artifactId>commons-dbcp</artifactId>
>> +            <scope>test</scope>
>> +        </dependency>
>>     </dependencies>
>> +
>> +    <properties>
>> +        <connection.driver.name />
>> +       
>> <connection.url>target/database/openjpa-xmlstore</connection.url>
>> +        <connection.username />
>> +        <connection.password />
>> +    </properties>
>> +
>> +    <build>
>> +        <plugins>
>> +            <plugin>
>> +                <groupId>org.apache.maven.plugins</groupId>
>> +                <artifactId>maven-antrun-plugin</artifactId>
>> +                <executions>
>> +                    <execution>
>> +                        <phase>test-compile</phase>
>> +                        <configuration>
>> +                            <tasks>
>> +                                <ant
>> antfile="src/test/ant/enhancer.xml" target="enhance" inheritRefs="true">
>> +                                    <property name="maven.test.skip"
>> value="${maven.test.skip}" />
>> +                                    <property name="test"
>> value="${test}" />
>> +                                    <property name="outdir"
>> value="${project.build.outputDirectory}" />
>> +                                    <property
>> name="project.build.testOutputDirectory"
>> value="${project.build.testOutputDirectory}" />
>> +                                    <property name="openjpa.loglevel"
>> value="${openjpa.loglevel}" />
>> +                                    <property name="build.enhance"
>> value="${build.enhance}" />
>> +                                </ant>
>> +                            </tasks>
>> +                        </configuration>
>> +                        <goals>
>> +                            <goal>run</goal>
>> +                        </goals>
>> +                    </execution>
>> +                </executions>
>> +            </plugin>
>> +            <plugin>
>> +                <groupId>org.apache.maven.plugins</groupId>
>> +                <artifactId>maven-surefire-plugin</artifactId>
>> +                <configuration>
>> +                    <argLine>${surefire.jvm.args}</argLine>
>> +                    <excludes>
>> +                        <!--
>> +                            exclude classes that end with 'Test'
>> +                            these are not test cases per OpenJPA
>> standards
>> +                        -->
>> +                       
>> <exclude>org/apache/openjpa/**/*Test.java</exclude>
>> +                    </excludes>
>> +                    <systemProperties>
>> +                        <property>
>> +                            <name>openjpa.Log</name>
>> +                           
>> <value>DefaultLevel=${openjpa.loglevel}</value>
>> +                        </property>
>> +                        <property>
>> +                            <name>openjpa.DynamicEnhancementAgent</name>
>> +                            <value>false</value>
>> +                        </property>
>> +                        <property>
>> +                            <name>openjpa.ConnectionDriverName</name>
>> +                           
>> <value>org.apache.commons.dbcp.BasicDataSource</value>
>> +                        </property>
>> +                        <property>
>> +                            <name>openjpa.ConnectionProperties</name>
>> +                           
>> <value>DriverClassName=${connection.driver.name},Url=${connection.url},Username=${connection.username},Password=${connection.password}</value>
>>
>> +                        </property>
>> +                        <property>
>> +                            <name>tests.openjpa.allowfailure</name>
>> +                            <value>${tests.openjpa.allowfailure}</value>
>> +                        </property>
>> +<!--
>> +                        <property>
>> +                            <name>openjpa.BrokerFactory</name>
>> +                           
>> <value>org.apache.openjpa.abstractstore.AbstractStoreBrokerFactory</value>
>>
>> +                        </property>
>> +                        <property>
>> +                           
>> <name>openjpa.abstractstore.AbstractStoreManager</name>
>> +                           
>> <value>org.apache.openjpa.xmlstore.XMLStoreManager</value>
>> +                        </property>
>> +-->
>> +                    </systemProperties>
>> +                </configuration>
>> +            </plugin>
>> +        </plugins>
>> +    </build>
>> </project>
>