forked from eclipse-ee4j/eclipselink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ClassWeaver refresh - code generated by weaving (eclipse-ee4j#2049)
Contains following main changes: - Replacement of deprecated e.g. new Integer(...) by Integer.valueOf(...) - Generated _persistence_shallow_clone content is wrapped by try/catch - Remove dependency to JPA module (org.eclipse.persistence.internal.jpa.EntityManagerImpl class) in generated _persistence_checkFetched and _persistence_checkFetchedForSet There are some extensions in weaving test to more deeply check methods/logic generated by ClassWeaver. Signed-off-by: Radek Felcman <[email protected]>
- Loading branch information
Showing
7 changed files
with
473 additions
and
55 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
31 changes: 31 additions & 0 deletions
31
jpa/eclipselink.jpa.testapps/jpa.test.weaving/src/main/resources/META-INF/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,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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 version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"> | ||
|
||
<persistence-unit name="weaving-dir-test-pu" transaction-type="RESOURCE_LOCAL"> | ||
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> | ||
<class>org.eclipse.persistence.testing.models.jpa.weaving.WeavingEntityInDir</class> | ||
<exclude-unlisted-classes>true</exclude-unlisted-classes> | ||
<properties> | ||
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" /> | ||
<property name="eclipselink.ddl-generation.output-mode" value="database" /> | ||
<property name="eclipselink.logging.level" value="${eclipselink.logging.level}"/> | ||
<property name="eclipselink.logging.level.sql" value="${eclipselink.logging.sql.level}"/> | ||
<property name="eclipselink.logging.parameters" value="${eclipselink.logging.parameters}"/> | ||
<property name="eclipse.weaving" value="static"/> | ||
</properties> | ||
</persistence-unit> | ||
</persistence> |
32 changes: 32 additions & 0 deletions
32
...c/test/java/org/eclipse/persistence/testing/models/jpa/weaving/WeavingChangeListener.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,32 @@ | ||
/* | ||
* 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: | ||
// Oracle - initial API and implementation | ||
package org.eclipse.persistence.testing.models.jpa.weaving; | ||
|
||
import java.beans.PropertyChangeEvent; | ||
import java.beans.PropertyChangeListener; | ||
|
||
public class WeavingChangeListener implements PropertyChangeListener { | ||
|
||
private boolean listenerInvoked = false; | ||
|
||
@Override | ||
public void propertyChange(PropertyChangeEvent evt) { | ||
listenerInvoked = true; | ||
} | ||
|
||
public boolean isListenerInvoked() { | ||
return listenerInvoked; | ||
} | ||
} |
135 changes: 135 additions & 0 deletions
135
.../src/test/java/org/eclipse/persistence/testing/models/jpa/weaving/WeavingEntityInDir.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,135 @@ | ||
/* | ||
* 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: | ||
// Oracle - initial API and implementation | ||
package org.eclipse.persistence.testing.models.jpa.weaving; | ||
|
||
import jakarta.persistence.Basic; | ||
import jakarta.persistence.Cacheable; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Lob; | ||
import org.eclipse.persistence.annotations.FetchAttribute; | ||
import org.eclipse.persistence.annotations.FetchGroup; | ||
|
||
@Entity | ||
@FetchGroup(name="FloatingPointFieldsOnly", | ||
attributes={ | ||
@FetchAttribute(name="floatField"), | ||
@FetchAttribute(name="doubleField")}) | ||
@Cacheable(false) | ||
public class WeavingEntityInDir { | ||
private int id; | ||
private boolean booleanField; | ||
private byte byteField; | ||
private short shortField; | ||
private int intField; | ||
private long longField; | ||
private float floatField; | ||
private double doubleField; | ||
private String stringField; | ||
private byte[] blobField; | ||
|
||
public WeavingEntityInDir() { | ||
} | ||
|
||
public WeavingEntityInDir(int id) { | ||
this.id = id; | ||
} | ||
|
||
@Id | ||
public int getId() { | ||
return this.id; | ||
} | ||
|
||
public void setId(int id) { | ||
this.id = id; | ||
} | ||
|
||
public boolean isBooleanField() { | ||
return booleanField; | ||
} | ||
|
||
public void setBooleanField(boolean booleanField) { | ||
this.booleanField = booleanField; | ||
} | ||
|
||
public byte getByteField() { | ||
return byteField; | ||
} | ||
|
||
public void setByteField(byte byteField) { | ||
this.byteField = byteField; | ||
} | ||
|
||
public short getShortField() { | ||
return shortField; | ||
} | ||
|
||
public void setShortField(short shortFiled) { | ||
this.shortField = shortFiled; | ||
} | ||
|
||
public int getIntField() { | ||
return intField; | ||
} | ||
|
||
public void setIntField(int intField) { | ||
this.intField = intField; | ||
} | ||
|
||
public long getLongField() { | ||
return longField; | ||
} | ||
|
||
public void setLongField(long longField) { | ||
this.longField = longField; | ||
} | ||
|
||
public float getFloatField() { | ||
return floatField; | ||
} | ||
|
||
public void setFloatField(float floatField) { | ||
this.floatField = floatField; | ||
} | ||
|
||
public double getDoubleField() { | ||
return doubleField; | ||
} | ||
|
||
public void setDoubleField(double doubleField) { | ||
this.doubleField = doubleField; | ||
} | ||
|
||
public String getStringField() { | ||
return stringField; | ||
} | ||
|
||
public void setStringField(String stringField) { | ||
this.stringField = stringField; | ||
} | ||
|
||
@Lob | ||
@Column(length=4800) | ||
@Basic(fetch= FetchType.LAZY) | ||
public byte[] getBlobField() { | ||
return blobField; | ||
} | ||
|
||
public void setBlobField(byte[] blobField) { | ||
this.blobField = blobField; | ||
} | ||
} |
Oops, something went wrong.