-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for ReportQuery not fetching relationships with BatchFetch.IN (#2316
) Co-authored-by: Radek Felcman <[email protected]>
- Loading branch information
Showing
13 changed files
with
598 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
jpa/eclipselink.jpa.test/resource/eclipselink-batchfetch-model/persistence.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
29 changes: 29 additions & 0 deletions
29
jpa/eclipselink.jpa.test/resource/eclipselink-batchfetch-model/server/persistence.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
105 changes: 105 additions & 0 deletions
105
...est/src/org/eclipse/persistence/testing/models/jpa/batchfetch/BatchFetchTableCreator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
* 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 | ||
*/ | ||
|
||
// Contributors: | ||
|
||
package org.eclipse.persistence.testing.models.jpa.batchfetch; | ||
|
||
import org.eclipse.persistence.tools.schemaframework.FieldDefinition; | ||
import org.eclipse.persistence.tools.schemaframework.TableCreator; | ||
import org.eclipse.persistence.tools.schemaframework.TableDefinition; | ||
|
||
public class BatchFetchTableCreator extends TableCreator { | ||
public BatchFetchTableCreator() { | ||
setName("BatchFetchProject"); | ||
|
||
addTableDefinition(buildCompanyTable()); | ||
addTableDefinition(buildEmployeeTable()); | ||
addTableDefinition(buildRecordTable()); | ||
} | ||
|
||
public TableDefinition buildRecordTable() { | ||
TableDefinition table = new TableDefinition(); | ||
table.setName("BATCH_IN_RECORD"); | ||
|
||
FieldDefinition fieldID = new FieldDefinition(); | ||
fieldID.setName("ID"); | ||
fieldID.setTypeName("NUMBER"); | ||
fieldID.setSize(19); | ||
fieldID.setSubSize(0); | ||
fieldID.setIsPrimaryKey(true); | ||
fieldID.setIsIdentity(true); | ||
fieldID.setShouldAllowNull(false); | ||
table.addField(fieldID); | ||
|
||
FieldDefinition fieldUSER = new FieldDefinition(); | ||
fieldUSER.setName("EMPLOYEE_ID"); | ||
fieldUSER.setTypeName("NUMBER"); | ||
fieldUSER.setSize(19); | ||
fieldUSER.setSubSize(0); | ||
fieldUSER.setIsPrimaryKey(false); | ||
fieldUSER.setIsIdentity(false); | ||
fieldUSER.setShouldAllowNull(false); | ||
fieldUSER.setForeignKeyFieldName("BATCH_IN_EMPLOYEE.ID"); | ||
table.addField(fieldUSER); | ||
|
||
return table; | ||
} | ||
|
||
public TableDefinition buildCompanyTable() { | ||
TableDefinition table = new TableDefinition(); | ||
table.setName("BATCH_IN_COMPANY"); | ||
|
||
FieldDefinition fieldID = new FieldDefinition(); | ||
fieldID.setName("ID"); | ||
fieldID.setTypeName("NUMBER"); | ||
fieldID.setSize(19); | ||
fieldID.setSubSize(0); | ||
fieldID.setIsPrimaryKey(true); | ||
fieldID.setIsIdentity(true); | ||
fieldID.setShouldAllowNull(false); | ||
table.addField(fieldID); | ||
|
||
return table; | ||
} | ||
|
||
|
||
public TableDefinition buildEmployeeTable() { | ||
TableDefinition table = new TableDefinition(); | ||
table.setName("BATCH_IN_EMPLOYEE"); | ||
|
||
FieldDefinition fieldID = new FieldDefinition(); | ||
fieldID.setName("ID"); | ||
fieldID.setTypeName("NUMBER"); | ||
fieldID.setSize(19); | ||
fieldID.setSubSize(0); | ||
fieldID.setIsPrimaryKey(true); | ||
fieldID.setIsIdentity(true); | ||
fieldID.setShouldAllowNull(false); | ||
table.addField(fieldID); | ||
|
||
FieldDefinition fieldCompany = new FieldDefinition(); | ||
fieldCompany.setName("COMPANY_ID"); | ||
fieldCompany.setTypeName("NUMBER"); | ||
fieldCompany.setSize(19); | ||
fieldCompany.setSubSize(0); | ||
fieldCompany.setIsPrimaryKey(false); | ||
fieldCompany.setIsIdentity(false); | ||
fieldCompany.setShouldAllowNull(false); | ||
fieldCompany.setForeignKeyFieldName("BATCH_IN_COMPANY.ID"); | ||
table.addField(fieldCompany); | ||
|
||
return table; | ||
|
||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
...lipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/batchfetch/Company.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* 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 | ||
*/ | ||
|
||
// Contributors: | ||
|
||
package org.eclipse.persistence.testing.models.jpa.batchfetch; | ||
|
||
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; | ||
|
||
import java.util.List; | ||
|
||
@Entity | ||
@Table(name = "BATCH_IN_COMPANY") | ||
public class Company { | ||
@Id | ||
private long id; | ||
|
||
public Company() { | ||
} | ||
|
||
public Company(long id) { | ||
this.id = id; | ||
} | ||
|
||
public long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(long id) { | ||
this.id = id; | ||
} | ||
} |
Oops, something went wrong.