Skip to content

Commit

Permalink
Fix for ReportQuery not fetching relationships with BatchFetch.IN - t…
Browse files Browse the repository at this point in the history
…ests for 2.7 branch (#2)

Signed-off-by: Radek Felcman <[email protected]>
  • Loading branch information
rfelcman authored Nov 26, 2024
1 parent 554b4fe commit b34e627
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 21 deletions.
1 change: 1 addition & 0 deletions jpa/eclipselink.jpa.test/antbuild.properties
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ jpa.performance=jpa-performance
jpa.performance2=jpa-performance2
eclipselink.delimited.model=eclipselink-delimited-model
eclipselink.extensibility.model=eclipselink-extensibility-model
eclipselink.batchfetch.model=eclipselink-batchfetch-model
eclipselink.beanvalidation.model=eclipselink-beanvalidation-model
eclipselink.beanvalidation.dynamic.model=eclipselink-beanvalidation-dynamic-model

Expand Down
44 changes: 43 additions & 1 deletion jpa/eclipselink.jpa.test/antbuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@
<fileset file="${jpatest.basedir}/${eclipselink.cascade.deletes}.jar"/>
<fileset file="${jpatest.basedir}/${eclipselink.delimited.model}.jar"/>
<fileset file="${jpatest.basedir}/${eclipselink.extensibility.model}.jar"/>
<fileset file="${jpatest.basedir}/${eclipselink.batchfetch.model}.jar"/>
<fileset file="${jpatest.basedir}/${eclipselink.beanvalidation.model}.jar"/>
<fileset file="${jpatest.basedir}/${eclipselink.beanvalidation.dynamic.model}.jar"/>
<fileset file="${jpatest.basedir}/${eclipselink.composite.advanced.model}.jar"/>
Expand Down Expand Up @@ -656,6 +657,7 @@
<mkdir dir="${jpatest.basedir}/${build.dir}/${eclipselink.metamodel.model}"/>
<mkdir dir="${jpatest.basedir}/${build.dir}/${eclipselink.delimited.model}"/>
<mkdir dir="${jpatest.basedir}/${build.dir}/${eclipselink.extensibility.model}"/>
<mkdir dir="${jpatest.basedir}/${build.dir}/${eclipselink.batchfetch.model}"/>
<mkdir dir="${jpatest.basedir}/${build.dir}/${eclipselink.beanvalidation.model}"/>
<mkdir dir="${jpatest.basedir}/${build.dir}/${eclipselink.beanvalidation.dynamic.model}"/>
<mkdir dir="${jpatest.basedir}/${build.dir}/${eclipselink.composite.advanced.model}"/>
Expand Down Expand Up @@ -935,7 +937,7 @@
<target name="package" depends="config-classpath, package-annotation, package-ddl, package-xml-only, package-xml-merge, package-jpa21-model,
package-jpa22-model, package-xml-extended, package-validation-failed, package-jpa-advanced-field-access, package-jpa-advanced-properties,
package-jpa-pu_with_spaces, package-partitioned, package-plsql, package-jpa-performance, package-jpa-performance2, package-cascade-deletes,
package-jpa-metamodel, package-delimited, package-beanvalidation, package-beanvalidation-dynamic, package-composite-advanced,
package-jpa-metamodel, package-delimited, package-batchfetch, package-beanvalidation, package-beanvalidation-dynamic, package-composite-advanced,
package-composite-advanced-member_1, package-composite-advanced-member_2, package-composite-advanced-member_3, package-xml-composite-advanced,
package-xml-composite-advanced-member_1, package-xml-composite-advanced-member_2, package-xml-composite-advanced-member_3,
package-xml-extended-composite-advanced, package-xml-extended-composite-advanced-member_1, package-xml-extended-composite-advanced-member_2,
Expand Down Expand Up @@ -1385,6 +1387,20 @@
</jar>
</target>

<target name="package-batchfetch" depends="">
<copy todir="${jpatest.basedir}/${build.dir}/${eclipselink.batchfetch.model}/META-INF">
<fileset dir="${jpatest.basedir}/resource/${eclipselink.batchfetch.model}" includes="*.xml"/>
</copy>
<copy todir="${jpatest.basedir}/${build.dir}/${eclipselink.batchfetch.model}">
<fileset dir="${jpatest.basedir}/${classes.dir}"
includes="org/eclipse/persistence/testing/models/jpa/batchfetch/**"/>
</copy>
<jar jarfile="${jpatest.basedir}/${eclipselink.batchfetch.model}.jar">
<fileset dir="${jpatest.basedir}/${build.dir}/${eclipselink.batchfetch.model}">
</fileset>
</jar>
</target>

<target name="package-beanvalidation" depends="">
<copy todir="${jpatest.basedir}/${build.dir}/${eclipselink.beanvalidation.model}/META-INF">
<fileset dir="${jpatest.basedir}/resource/${eclipselink.beanvalidation.model}" includes="*.xml"/>
Expand Down Expand Up @@ -1609,6 +1625,7 @@
<!--pathelement path="${jpatest.basedir}/${eclipselink.pu.with.multibyte}.jar"/-->
<pathelement path="${jpatest.basedir}/${eclipselink.delimited.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.extensibility.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.batchfetch.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.beanvalidation.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.composite.advanced.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.composite.advanced.model.member_1}.jar"/>
Expand Down Expand Up @@ -1646,6 +1663,7 @@
<!--pathelement path="${jpatest.basedir}/${eclipselink.pu.with.multibyte}.jar"/-->
<pathelement path="${jpatest.basedir}/${eclipselink.delimited.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.extensibility.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.batchfetch.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.beanvalidation.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.composite.advanced.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.composite.advanced.model.member_1}.jar"/>
Expand Down Expand Up @@ -1683,6 +1701,7 @@
<!--pathelement path="${jpatest.basedir}/${eclipselink.pu.with.multibyte}.jar"/-->
<pathelement path="${jpatest.basedir}/${eclipselink.delimited.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.extensibility.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.batchfetch.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.beanvalidation.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.composite.advanced.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.composite.advanced.model.member_1}.jar"/>
Expand Down Expand Up @@ -2204,6 +2223,7 @@
<pathelement path="${jpatest.basedir}/woven-${eclipselink.metamodel.model}.jar"/>
<pathelement path="${jpatest.basedir}/woven-${eclipselink.delimited.model}.jar"/>
<pathelement path="${jpatest.basedir}/woven-${eclipselink.extensibility.model}.jar"/>
<pathelement path="${jpatest.basedir}/woven-${eclipselink.batchfetch.model}.jar"/>
<pathelement path="${jpatest.basedir}/woven-${eclipselink.beanvalidation.model}.jar"/>
<pathelement path="${jpatest.basedir}/woven-${eclipselink.beanvalidation.dynamic.model}.jar"/>
<pathelement path="${jpatest.basedir}/${eclipselink.composite.advanced.model}.jar"/>
Expand Down Expand Up @@ -2803,6 +2823,13 @@
<path refid="run.classpath"/>
</classpath>
</weave>
<weave source= "${jpatest.basedir}/${eclipselink.batchfetch.model}.jar"
target = "${jpatest.basedir}/woven-${eclipselink.batchfetch.model}.jar"
loglevel="${logging.level}">
<classpath>
<path refid="run.classpath"/>
</classpath>
</weave>
<weave source= "${jpatest.basedir}/${eclipselink.beanvalidation.model}.jar"
target = "${jpatest.basedir}/woven-${eclipselink.beanvalidation.model}.jar"
loglevel="${logging.level}">
Expand Down Expand Up @@ -3997,6 +4024,7 @@
<target name="server-test-lrg" depends="clean-test">
<antcall target="server-test-advanced" inheritRefs="true"/>
<antcall target="server-test-advanced-multitenant" inheritRefs="true"/>
<antcall target="server-test-batchfetch" inheritRefs="true"/>
<antcall target="server-test-beanvalidation" inheritRefs="true"/>
<antcall target="server-test-cacheable" inheritRefs="true"/>
<antcall target="server-test-cascadedeletes" inheritRefs="true"/>
Expand Down Expand Up @@ -4142,6 +4170,20 @@
*.jdbc"/>
</delete>
</target>

<target name="server-test-batchfetch">
<antcall target="server-run-all" inheritRefs="true">
<param name="PERSISTENCE_UNIT_NAME" value="batchfetch"/>
<param name="MODEL_DIR" value="org/eclipse/persistence/testing/models/jpa/batchfetch"/>
<param name="MODEL_NAME" value="eclipselink-batchfetch-model"/>
<param name="TEST_DIR" value="org/eclipse/persistence/testing/tests/jpa/batchfetch"/>
<param name="TEST_NAME" value="eclipselink-batchfetch-model"/>
<param name="EAR_NAME" value="eclipselink-batchfetch-model"/>
<param name="TEST_SUITE" value="org.eclipse.persistence.testing.tests.jpa.batchfetch.BatchFetchJUnitTest"/>
<param name="eclipselink.jpa.test.dir" value="."/>
</antcall>
</target>

<target name="server-test-beanvalidation">
<antcall target="server-run-all" inheritRefs="true">
<param name="PERSISTENCE_UNIT_NAME" value="beanvalidation"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0,
or the Eclipse Distribution License v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
-->

<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_2_0.xsd" version="2.0">
<persistence-unit name="batchfetch">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.eclipse.persistence.testing.models.jpa.batchfetch.Company</class>
<class>org.eclipse.persistence.testing.models.jpa.batchfetch.Employee</class>
<class>org.eclipse.persistence.testing.models.jpa.batchfetch.Record</class>
<properties>
<property name="eclipselink.logging.level" value="FINE" />
<property name="eclipselink.logging.level.sql" value="FINEST"/>
<property name="eclipselink.logging.parameters" value="true"/>
</properties>
</persistence-unit>
</persistence>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--
Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0,
or the Eclipse Distribution License v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
-->

<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_2_0.xsd" version="2.0">
<persistence-unit name="@default@" transaction-type="@transaction-type@">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<@datasource-type@>@data-source-name@</@datasource-type@>
<class>org.eclipse.persistence.testing.models.jpa.batchfetch.Company</class>
<class>org.eclipse.persistence.testing.models.jpa.batchfetch.Employee</class>
<class>org.eclipse.persistence.testing.models.jpa.batchfetch.Record</class>
<properties>
<property name="eclipselink.target-server" value="@server-platform@"/>
<property name="eclipselink.target-database" value="@database-platform@"/>
<property name="eclipselink.weaving" value="@server-weaving@"/>
<property name="eclipselink.logging.logger" value="DefaultLogger"/>
</properties>
</persistence-unit>
</persistence>
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

package org.eclipse.persistence.testing.models.jpa.batchfetch;

import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.BatchFetch;
import org.eclipse.persistence.annotations.BatchFetchType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

package org.eclipse.persistence.testing.models.jpa.batchfetch;

import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.BatchFetch;
import org.eclipse.persistence.annotations.BatchFetchType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

package org.eclipse.persistence.testing.models.jpa.batchfetch;

import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.BatchFetch;
import org.eclipse.persistence.annotations.BatchFetchType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

package org.eclipse.persistence.testing.tests.jpa.batchfetch;

import jakarta.persistence.EntityManager;
import jakarta.persistence.TypedQuery;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.persistence.config.QueryHints;
Expand Down

0 comments on commit b34e627

Please sign in to comment.