-
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.
Browse files
Browse the repository at this point in the history
Signed-off-by: Radek Felcman <[email protected]>
- Loading branch information
Showing
5 changed files
with
244 additions
and
8 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
102 changes: 102 additions & 0 deletions
102
...jpa.test/src/it/java/org/eclipse/persistence/testing/models/jpa/advanced/EntityFloat.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,102 @@ | ||
/* | ||
* Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2024 IBM Corporation. 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 | ||
*/ | ||
package org.eclipse.persistence.testing.models.jpa.advanced; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
|
||
// Based on reproduction scenario from issue #2301 (https://github.com/eclipse-ee4j/eclipselink/issues/2301) | ||
@Entity | ||
@Table(name = EntityFloat.TABLE_NAME) | ||
public class EntityFloat { | ||
|
||
public static final String TABLE_NAME = "ADV_ENTITY_FLOAT"; | ||
|
||
@Id | ||
@Column(name = "ID") | ||
private int id; | ||
|
||
@Column(name = "HEIGHT") | ||
private float height; | ||
|
||
@Column(name = "LENGTH") | ||
private float length; | ||
|
||
@Column(name = "WIDTH") | ||
private float width; | ||
|
||
@Column(name = "DESCRIPTION") | ||
private String description; | ||
|
||
public EntityFloat() { | ||
this(-1, 0f, 0f, 0f, null); | ||
} | ||
|
||
public EntityFloat(int id, float length, float width, float height, String description) { | ||
this.id = id; | ||
this.length = length; | ||
this.width = width; | ||
this.height = height; | ||
this.description = description; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public void setId(int id) { | ||
this.id = id; | ||
} | ||
|
||
public float getHeight() { | ||
return height; | ||
} | ||
|
||
public void setHeight(float height) { | ||
this.height = height; | ||
} | ||
|
||
public float getLength() { | ||
return length; | ||
} | ||
|
||
public void setLength(float length) { | ||
this.length = length; | ||
} | ||
|
||
public float getWidth() { | ||
return width; | ||
} | ||
|
||
public void setWidth(float width) { | ||
this.width = width; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format( | ||
"EntityFloat{ id=%d, length=%f, width=%f, height=%f, description=\"%s\"}", | ||
id, length, width, height, description); | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
...src/it/java/org/eclipse/persistence/testing/models/jpa/advanced/EntityFloatPopulator.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,43 @@ | ||
/* | ||
* Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2024 IBM Corporation. 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 | ||
*/ | ||
package org.eclipse.persistence.testing.models.jpa.advanced; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.eclipse.persistence.sessions.Session; | ||
import org.eclipse.persistence.sessions.UnitOfWork; | ||
|
||
public class EntityFloatPopulator { | ||
|
||
private EntityFloatPopulator() { | ||
throw new UnsupportedOperationException("No instances of EntityFloatPopulator are allowed"); | ||
} | ||
|
||
static EntityFloat[] ENTITY_FLOAT = new EntityFloat[] { | ||
// Tallest and smallest length | ||
new EntityFloat(70071, 17.0f, 17.1f, 7.7f, "testOLGH28289#70071"), | ||
// Tallest and largest length | ||
new EntityFloat(70077, 77.0f, 17.7f, 7.7f, "testOLGH28289#70077"), | ||
new EntityFloat(70007, 70.0f, 10.7f, 0.7f, "testOLGH28289#70007") | ||
}; | ||
|
||
public static void populate(Session session) { | ||
List<Object> entities = Arrays.asList(ENTITY_FLOAT); | ||
UnitOfWork unitOfWork = session.acquireUnitOfWork(); | ||
unitOfWork.removeAllReadOnlyClasses(); | ||
unitOfWork.registerAllObjects(entities); | ||
unitOfWork.commit(); | ||
} | ||
|
||
} |
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