From ebb7924e483b0c819b96da1eb60f9ecb7e4dd260 Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Wed, 12 Jun 2024 17:51:40 +0200 Subject: [PATCH] [jakartaee/persistence#637] TCK should not set version on entity manually --- .../tck/persistence/core/annotations/version/Client1.java | 4 ++-- .../tck/persistence/core/annotations/version/Client2.java | 4 ++-- .../tck/persistence/core/annotations/version/Client3.java | 4 ++-- .../tck/persistence/core/annotations/version/Client4.java | 5 ++--- .../persistence/core/annotations/version/Integer_Field.java | 6 ------ .../core/annotations/version/Integer_Property.java | 6 ------ .../core/annotations/version/LongClass_Field.java | 6 ------ .../core/annotations/version/LongClass_Property.java | 6 ------ .../core/annotations/version/ShortClass_Field.java | 6 ------ .../core/annotations/version/ShortClass_Property.java | 6 ------ .../core/annotations/version/Timestamp_Field.java | 6 ------ .../core/annotations/version/Timestamp_Property.java | 6 ------ 12 files changed, 8 insertions(+), 57 deletions(-) diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client1.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client1.java index 363777046e..37827ce176 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client1.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client1.java @@ -266,8 +266,8 @@ public void createIntTestData() { getEntityTransaction().begin(); getEntityManager().persist(new Int_Field("1")); getEntityManager().persist(new Int_Property("2")); - getEntityManager().persist(new Integer_Field("3", new Integer(0))); - getEntityManager().persist(new Integer_Property("4", new Integer(0))); + getEntityManager().persist(new Integer_Field("3")); + getEntityManager().persist(new Integer_Property("4")); getEntityTransaction().commit(); } catch (Exception e) { diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client2.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client2.java index 0aab00e14b..0157e74710 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client2.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client2.java @@ -264,8 +264,8 @@ public void createShortTestData() { getEntityTransaction().begin(); getEntityManager().persist(new Short_Field("1")); getEntityManager().persist(new Short_Property("2")); - getEntityManager().persist(new ShortClass_Field("3", new Short((short) 0))); - getEntityManager().persist(new ShortClass_Property("4", new Short((short) 0))); + getEntityManager().persist(new ShortClass_Field("3")); + getEntityManager().persist(new ShortClass_Property("4")); getEntityTransaction().commit(); } catch (Exception e) { logger.log(Logger.Level.ERROR, "Unexpected Exception in createShortTestData:", e); diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client3.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client3.java index da437cb0e8..5e501db63d 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client3.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client3.java @@ -264,8 +264,8 @@ public void createLongTestData() { getEntityTransaction().begin(); getEntityManager().persist(new Long_Field("1")); getEntityManager().persist(new Long_Property("2")); - getEntityManager().persist(new LongClass_Field("3", new Long(0))); - getEntityManager().persist(new LongClass_Property("4", new Long(0))); + getEntityManager().persist(new LongClass_Field("3")); + getEntityManager().persist(new LongClass_Property("4")); getEntityTransaction().commit(); } catch (Exception e) { logger.log(Logger.Level.ERROR, "Unexpected Exception in createLongTestData:", e); diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client4.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client4.java index 177590f92f..99b0f31eb6 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client4.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Client4.java @@ -175,9 +175,8 @@ public void createTimestampTestData() { try { getEntityTransaction().begin(); - Timestamp currentTime = new Timestamp(new Date().getTime()); - getEntityManager().persist(new Timestamp_Field("1", currentTime)); - getEntityManager().persist(new Timestamp_Property("2", currentTime)); + getEntityManager().persist(new Timestamp_Field("1")); + getEntityManager().persist(new Timestamp_Property("2")); getEntityTransaction().commit(); } catch (Exception e) { logger.log(Logger.Level.ERROR, "Unexpected Exception in createTimestampTestData:", e); diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Integer_Field.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Integer_Field.java index 6a9b3ff990..1a797b1b84 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Integer_Field.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Integer_Field.java @@ -45,12 +45,6 @@ public Integer_Field(String id) { this.id = id; } - public Integer_Field(String id, Integer basicInteger) { - - this.id = id; - this.basicInteger = basicInteger; - } - public String getId() { return id; } diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Integer_Property.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Integer_Property.java index b2c4e8bb7a..744ea5797c 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Integer_Property.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Integer_Property.java @@ -39,12 +39,6 @@ public Integer_Property(String id) { this.id = id; } - public Integer_Property(String id, Integer basicInteger) { - - this.id = id; - this.basicInteger = basicInteger; - } - @Id public String getId() { return id; diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/LongClass_Field.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/LongClass_Field.java index 42adfdc99d..25bc06a255 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/LongClass_Field.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/LongClass_Field.java @@ -50,12 +50,6 @@ public LongClass_Field(String id) { this.id = id; } - public LongClass_Field(String id, Long value) { - - this.id = id; - this.basicLong = value; - } - public String getId() { return id; } diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/LongClass_Property.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/LongClass_Property.java index 1d03e89f7f..c76003f116 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/LongClass_Property.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/LongClass_Property.java @@ -44,12 +44,6 @@ public LongClass_Property(String id) { this.id = id; } - public LongClass_Property(String id, Long value) { - - this.id = id; - this.basicLong = value; - } - @Id public String getId() { return id; diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/ShortClass_Field.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/ShortClass_Field.java index eb61dbca49..483efadd46 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/ShortClass_Field.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/ShortClass_Field.java @@ -50,12 +50,6 @@ public ShortClass_Field(String id) { this.id = id; } - public ShortClass_Field(String id, Short value) { - - this.id = id; - this.basicShort = value; - } - public String getId() { return id; } diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/ShortClass_Property.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/ShortClass_Property.java index 0a8be851eb..38bd8c94d5 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/ShortClass_Property.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/ShortClass_Property.java @@ -44,12 +44,6 @@ public ShortClass_Property(String id) { this.id = id; } - public ShortClass_Property(String id, Short value) { - - this.id = id; - this.basicShort = value; - } - @Id public String getId() { return id; diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Timestamp_Field.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Timestamp_Field.java index f32011a7f6..fe7cd0a631 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Timestamp_Field.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Timestamp_Field.java @@ -47,12 +47,6 @@ public Timestamp_Field(String id) { this.id = id; } - public Timestamp_Field(String id, Timestamp basicTimestamp) { - - this.id = id; - this.basicTimestamp = basicTimestamp; - } - public String getId() { return id; } diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Timestamp_Property.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Timestamp_Property.java index f187913a40..b2321f1e18 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Timestamp_Property.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/version/Timestamp_Property.java @@ -41,12 +41,6 @@ public Timestamp_Property(String id) { this.id = id; } - public Timestamp_Property(String id, Timestamp basicTimestamp) { - - this.id = id; - this.basicTimestamp = basicTimestamp; - } - @Id public String getId() { return id;