Skip to content

Commit

Permalink
recreate #28925
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAure committed Jul 23, 2024
1 parent 2292f9a commit b1961a2
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*******************************************************************************
* Copyright (c) 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package io.openliberty.jpa.data.tests.models;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import jakarta.persistence.Embedded;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;

/**
* Recreate from io.openliberty.data.internal_fat_jpa
*
* The problem here is with the entity itself
* TODO: uncomment @Entity
* TODO: remove constructor from Point
*/
//@Entity
public class Segment {

@GeneratedValue
@Id
public Long id;

@Embedded
@Column(nullable = false)
public Point pointA;

@Embedded
@Column(nullable = false)
public Point pointB;

@Embeddable
public static record Point(int x, int y) {
/**
* Recreate
* Exception Description: The instance creation method [io.openliberty.jpa.data.tests.models.Segment$Point.<Default Constructor>],
* with no parameters, does not exist, or is not accessible.
*/
public Point() {
this(0, 0);
}
}

public static Segment of(int x1, int y1, int x2, int y2) {
Segment inst = new Segment();
inst.pointA = new Point(x1, y1);
inst.pointB = new Point(x2, y2);
return inst;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import io.openliberty.jpa.data.tests.models.Prime;
import io.openliberty.jpa.data.tests.models.Rebate;
import io.openliberty.jpa.data.tests.models.Rebate.Status;
import io.openliberty.jpa.data.tests.models.Segment;
import jakarta.annotation.Resource;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
Expand Down Expand Up @@ -382,4 +383,19 @@ public void testOLGH28925() throws Exception {
assertEquals(4, primes.size());
}

@Test
@Ignore("Reference issue: https://github.com/OpenLiberty/open-liberty/issues/28925")
public void testOLGH29117() throws Exception {
Segment unitRadius = Segment.of(0, 0, 0, 1);

tx.begin();
try {
em.persist(unitRadius);
tx.commit();
} catch (Exception e) {
tx.rollback();
throw e;
}
}

}

0 comments on commit b1961a2

Please sign in to comment.