diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/INameEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/INameEntity.java new file mode 100644 index 000000000..3beb8577c --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/INameEntity.java @@ -0,0 +1,32 @@ +/* + * 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.jpql.entities; + +public interface INameEntity { + + public int getId(); + + public void setId(int id); + + public String getName(); + + public void setName(String name); + + public String toString(); +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/IOrderedEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/IOrderedEntity.java new file mode 100644 index 000000000..40ca24c2f --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/IOrderedEntity.java @@ -0,0 +1,40 @@ +/* + * 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.jpql.entities; + +import java.util.List; + +public interface IOrderedEntity { + + public int getId(); + + public void setId(int id); + + public List getEntities(); + + public void setEntities(List entities); + + public void addEntities(INameEntity entity); + + public INameEntity removeEntities(int location); + + public void insertEntities(int location, INameEntity entity); + + public String toString(); +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/OrderedElementEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/OrderedElementEntity.java new file mode 100644 index 000000000..584a826ca --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/OrderedElementEntity.java @@ -0,0 +1,80 @@ +/* + * 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.jpql.entities; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OrderColumn; + +@Entity +public class OrderedElementEntity implements java.io.Serializable { + + @Id + private int id; + + @ElementCollection + @OrderColumn + private List listElements; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public List getListElements() { + return listElements; + } + + public void setListElements(List elements) { + this.listElements = elements; + } + + public void addListElements(String element) { + if( listElements == null) { + listElements = new ArrayList(); + } + listElements.add(element); + } + + public String removeListElements(int location) { + String rtnVal = null; + if( listElements != null) { + rtnVal = listElements.remove(location); + } + return rtnVal; + } + + public void insertListElements(int location, String name) { + if( listElements == null) { + listElements = new ArrayList(); + } + listElements.add(location, name); + } + + public String toString() { + return "OrderedElementEntity[" + id + "]=" + listElements; + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/OrderedManyToManyEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/OrderedManyToManyEntity.java new file mode 100644 index 000000000..61c681e5f --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/OrderedManyToManyEntity.java @@ -0,0 +1,81 @@ +/* + * 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.jpql.entities; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToMany; +import javax.persistence.OrderColumn; + +@Entity +public class OrderedManyToManyEntity implements IOrderedEntity, java.io.Serializable { + + @Id + private int id; + + @ManyToMany + @OrderColumn + private List om2mEntities; + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public List getEntities() { + return om2mEntities; + } + + public void setEntities(List entities) { + this.om2mEntities = entities; + } + + public void addEntities(INameEntity entity) { + if( om2mEntities == null) { + om2mEntities = new ArrayList(); + } + om2mEntities.add(entity); + } + + public INameEntity removeEntities(int location) { + INameEntity rtnVal = null; + if( om2mEntities != null) { + rtnVal = om2mEntities.remove(location); + } + return rtnVal; + } + + public void insertEntities(int location, INameEntity entity) { + if( om2mEntities == null) { + om2mEntities = new ArrayList(); + } + om2mEntities.add(location, entity); + } + + public String toString() { + return "OrderedManyToManyEntity[" + id + "]=" + om2mEntities; + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/OrderedOneToManyEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/OrderedOneToManyEntity.java new file mode 100644 index 000000000..eb04078de --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/OrderedOneToManyEntity.java @@ -0,0 +1,81 @@ +/* + * 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.jpql.entities; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.OrderColumn; + +@Entity +public class OrderedOneToManyEntity implements IOrderedEntity, java.io.Serializable { + + @Id + private int id; + + @OneToMany + @OrderColumn + private List oo2mEntities; + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public List getEntities() { + return oo2mEntities; + } + + public void setEntities(List names) { + this.oo2mEntities = names; + } + + public void addEntities(INameEntity name) { + if( oo2mEntities == null) { + oo2mEntities = new ArrayList(); + } + oo2mEntities.add(name); + } + + public INameEntity removeEntities(int location) { + INameEntity rtnVal = null; + if( oo2mEntities != null) { + rtnVal = oo2mEntities.remove(location); + } + return rtnVal; + } + + public void insertEntities(int location, INameEntity name) { + if( oo2mEntities == null) { + oo2mEntities = new ArrayList(); + } + oo2mEntities.add(location, name); + } + + public String toString() { + return "OrderedOneToManyEntity[" + id + "]=" + oo2mEntities; + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/UnorderedNameEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/UnorderedNameEntity.java new file mode 100644 index 000000000..8894c57a9 --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/UnorderedNameEntity.java @@ -0,0 +1,60 @@ +/* + * 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.jpql.entities; + +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class UnorderedNameEntity implements INameEntity, java.io.Serializable { + + @Id + private int id; + + private String name; + + + public UnorderedNameEntity() { + } + + public UnorderedNameEntity(String name) { + this.id = name.charAt(0) - 'A' + 1; + this.name = name; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String toString() { + return "UnorderedNameEntity[" + id + "]=" + name; + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/XMLOrderedElementEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/XMLOrderedElementEntity.java new file mode 100644 index 000000000..c87cd8ab2 --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/XMLOrderedElementEntity.java @@ -0,0 +1,71 @@ +/* + * 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.jpql.entities; + +import java.util.ArrayList; +import java.util.List; + +public class XMLOrderedElementEntity implements java.io.Serializable { + + private int id; + + private List listElements; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public List getListElements() { + return listElements; + } + + public void setListElements(List elements) { + this.listElements = elements; + } + + public void addListElements(String element) { + if( listElements == null) { + listElements = new ArrayList(); + } + listElements.add(element); + } + + public String removeListElements(int location) { + String rtnVal = null; + if( listElements != null) { + rtnVal = listElements.remove(location); + } + return rtnVal; + } + + public void insertListElements(int location, String name) { + if( listElements == null) { + listElements = new ArrayList(); + } + listElements.add(location, name); + } + + public String toString() { + return "XMLOrderedElementEntity[" + id + "]=" + listElements; + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/XMLOrderedManyToManyEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/XMLOrderedManyToManyEntity.java new file mode 100644 index 000000000..ef939b988 --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/XMLOrderedManyToManyEntity.java @@ -0,0 +1,72 @@ +/* + * 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.jpql.entities; + +import java.util.ArrayList; +import java.util.List; + +public class XMLOrderedManyToManyEntity implements IOrderedEntity, java.io.Serializable { + + private int id; + + private List xom2mEntities; + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public List getEntities() { + return xom2mEntities; + } + + public void setEntities(List entities) { + this.xom2mEntities = entities; + } + + public void addEntities(INameEntity entity) { + if( xom2mEntities == null) { + xom2mEntities = new ArrayList(); + } + xom2mEntities.add(entity); + } + + public INameEntity removeEntities(int location) { + INameEntity rtnVal = null; + if( xom2mEntities != null) { + rtnVal = xom2mEntities.remove(location); + } + return rtnVal; + } + + public void insertEntities(int location, INameEntity entity) { + if( xom2mEntities == null) { + xom2mEntities = new ArrayList(); + } + xom2mEntities.add(location, entity); + } + + public String toString() { + return "XMLOrderedManyToManyEntity[" + id + "]=" + xom2mEntities; + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/XMLOrderedOneToManyEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/XMLOrderedOneToManyEntity.java new file mode 100644 index 000000000..860a1b1db --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/XMLOrderedOneToManyEntity.java @@ -0,0 +1,72 @@ +/* + * 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.jpql.entities; + +import java.util.ArrayList; +import java.util.List; + +public class XMLOrderedOneToManyEntity implements IOrderedEntity, java.io.Serializable { + + private int id; + + private List xoo2mEntities; + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public List getEntities() { + return xoo2mEntities; + } + + public void setEntities(List entities) { + this.xoo2mEntities = entities; + } + + public void addEntities(INameEntity entity) { + if( xoo2mEntities == null) { + xoo2mEntities = new ArrayList(); + } + xoo2mEntities.add(entity); + } + + public INameEntity removeEntities(int location) { + INameEntity rtnVal = null; + if( xoo2mEntities != null) { + rtnVal = xoo2mEntities.remove(location); + } + return rtnVal; + } + + public void insertEntities(int location, INameEntity entity) { + if( xoo2mEntities == null) { + xoo2mEntities = new ArrayList(); + } + xoo2mEntities.add(location, entity); + } + + public String toString() { + return "XMLOrderedOneToManyEntity[" + id + "]=" + xoo2mEntities; + } +} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/XMLUnorderedNameEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/XMLUnorderedNameEntity.java new file mode 100644 index 000000000..1aa7e74b5 --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/entities/XMLUnorderedNameEntity.java @@ -0,0 +1,55 @@ +/* + * 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.jpql.entities; + +public class XMLUnorderedNameEntity implements INameEntity, java.io.Serializable { + + private int id; + + private String name; + + + public XMLUnorderedNameEntity() { + } + + public XMLUnorderedNameEntity(String name) { + this.id = name.charAt(0) - 'A' + 1; + this.name = name; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String toString() { + return "XMLUnorderedNameEntity[" + id + "]=" + name; + } +} diff --git a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jpql/expressions/orm.xml b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jpql/expressions/orm.xml new file mode 100644 index 000000000..78e72e72b --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jpql/expressions/orm.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jpql/expressions/persistence.xml b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jpql/expressions/persistence.xml new file mode 100644 index 000000000..b8f42622d --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jpql/expressions/persistence.xml @@ -0,0 +1,46 @@ + + + + + + PU for JPQL Index testing + org.apache.openjpa.persistence.PersistenceProviderImpl + org/apache/openjpa/persistence/jpql/expressions/orm.xml + + org.apache.openjpa.persistence.jpql.entities.OrderedElementEntity + org.apache.openjpa.persistence.jpql.entities.XMLOrderedElementEntity + org.apache.openjpa.persistence.jpql.entities.OrderedManyToManyEntity + org.apache.openjpa.persistence.jpql.entities.XMLOrderedManyToManyEntity + org.apache.openjpa.persistence.jpql.entities.OrderedOneToManyEntity + org.apache.openjpa.persistence.jpql.entities.XMLOrderedOneToManyEntity + org.apache.openjpa.persistence.jpql.entities.UnorderedNameEntity + org.apache.openjpa.persistence.jpql.entities.XMLUnorderedNameEntity + + + + + + + +