-
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.
IdentifiableTypeImpl throws IllegalArgumentException with EmbeddedId …
…and relations - bugfix + unit test Because there are four new objects (java classes) in org.eclipse.persistence.testing.models.jpa.metamodel package MetamodelMetamodelTest.METAMODEL_ALL_TYPES is increased into 56. These four objects have eights new attributes. This is why MetamodelMetamodelTest.METAMODEL_ALL_ATTRIBUTES_SIZE is increased into 158. fixes #1228 Signed-off-by: Radek Felcman <[email protected]>
- Loading branch information
Showing
8 changed files
with
328 additions
and
10 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
36 changes: 36 additions & 0 deletions
36
jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/metamodel/Bar.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,36 @@ | ||
/* | ||
* Copyright (c) 2021 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 from Oracle | ||
package org.eclipse.persistence.testing.models.jpa.metamodel; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
|
||
@Entity | ||
@Table(name="CMP3_MM_BAR") | ||
public class Bar { | ||
|
||
@Id | ||
private Long id; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/metamodel/Foo.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,49 @@ | ||
/* | ||
* Copyright (c) 2021 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 from Oracle | ||
package org.eclipse.persistence.testing.models.jpa.metamodel; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
import javax.persistence.OneToMany; | ||
import javax.persistence.Table; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Table(name="CMP3_MM_FOO") | ||
public class Foo { | ||
|
||
@Id | ||
private Long id; | ||
|
||
@OneToMany(mappedBy = "foo") | ||
private List<FooBar> fooBars; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public List<FooBar> getFooBars() { | ||
return fooBars; | ||
} | ||
|
||
public void setFooBars(List<FooBar> fooBars) { | ||
this.fooBars = fooBars; | ||
} | ||
|
||
} |
65 changes: 65 additions & 0 deletions
65
...eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/metamodel/FooBar.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,65 @@ | ||
/* | ||
* Copyright (c) 2021 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 from Oracle | ||
package org.eclipse.persistence.testing.models.jpa.metamodel; | ||
|
||
import javax.persistence.EmbeddedId; | ||
import javax.persistence.Entity; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import javax.persistence.MapsId; | ||
import javax.persistence.Table; | ||
|
||
@Entity | ||
@Table(name="CMP3_MM_FOOBAR") | ||
public class FooBar { | ||
|
||
@EmbeddedId | ||
private FooBarId id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "bar_id") | ||
@MapsId("barId") | ||
private Bar bar; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "foo_id") | ||
@MapsId("fooId") | ||
private Foo foo; | ||
|
||
public FooBarId getId() { | ||
return id; | ||
} | ||
|
||
public void setId(FooBarId id) { | ||
this.id = id; | ||
} | ||
|
||
public Bar getBar() { | ||
return bar; | ||
} | ||
|
||
public void setBar(Bar bar) { | ||
this.bar = bar; | ||
} | ||
|
||
public Foo getFoo() { | ||
return foo; | ||
} | ||
|
||
public void setFoo(Foo foo) { | ||
this.foo = foo; | ||
} | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
...lipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/metamodel/FooBarId.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,59 @@ | ||
/* | ||
* Copyright (c) 2021 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 from Oracle | ||
package org.eclipse.persistence.testing.models.jpa.metamodel; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Embeddable; | ||
import java.io.Serializable; | ||
import java.util.Objects; | ||
|
||
@Embeddable | ||
public class FooBarId implements Serializable { | ||
|
||
@Column(name = "foo_id") | ||
private Long fooId; | ||
|
||
@Column(name = "bar_id") | ||
private Long barId; | ||
|
||
public Long getFooId() { | ||
return fooId; | ||
} | ||
|
||
public void setFooId(Long fooId) { | ||
this.fooId = fooId; | ||
} | ||
|
||
public Long getBarId() { | ||
return barId; | ||
} | ||
|
||
public void setBarId(Long barId) { | ||
this.barId = barId; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
FooBarId fooBarId = (FooBarId) o; | ||
return fooId.equals(fooBarId.fooId) && barId.equals(fooBarId.barId); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(fooId, barId); | ||
} | ||
} |
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
Oops, something went wrong.