Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HHH-6813 Corrected EntityType#getRHSUniqueKeyPropertyName() and added
regression test.
- Loading branch information
Showing
4 changed files
with
183 additions
and
2 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
77 changes: 77 additions & 0 deletions
77
.../src/test/java/org/hibernate/test/annotations/derivedidentities/bidirectional/Person.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,77 @@ | ||
package org.hibernate.test.annotations.derivedidentities.bidirectional; | ||
|
||
import java.io.Serializable; | ||
import javax.persistence.Basic; | ||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.NamedQuery; | ||
import javax.persistence.OneToOne; | ||
|
||
@Entity | ||
@NamedQuery(name="PersonQuery", query="SELECT p FROM Person p") | ||
public class Person | ||
implements Serializable | ||
{ | ||
private static final long serialVersionUID = 1L; | ||
|
||
@Id | ||
@GeneratedValue(strategy=GenerationType.AUTO) | ||
private Integer id; | ||
|
||
@Basic | ||
private String name; | ||
|
||
@OneToOne(mappedBy="id") | ||
private PersonInfo personInfo; | ||
|
||
public Integer getId() | ||
{ | ||
return this.id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return this.name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public int hashCode() | ||
{ | ||
int hash = 0; | ||
hash += (this.id != null ? this.id.hashCode() : 0); | ||
return hash; | ||
} | ||
|
||
public boolean equals(Object object) | ||
{ | ||
if (!(object instanceof Person)) { | ||
return false; | ||
} | ||
Person other = (Person)object; | ||
|
||
return ((this.id != null) || (other.id == null)) && ((this.id == null) || (this.id.equals(other.id))); | ||
} | ||
|
||
public String toString() | ||
{ | ||
return "nogroup.hibertest.Person[ id=" + this.id + " ]"; | ||
} | ||
|
||
public PersonInfo getPersonInfo() | ||
{ | ||
return this.personInfo; | ||
} | ||
|
||
public void setPersonInfo(PersonInfo personInfo) | ||
{ | ||
this.personInfo = personInfo; | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
.../test/java/org/hibernate/test/annotations/derivedidentities/bidirectional/PersonInfo.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,60 @@ | ||
package org.hibernate.test.annotations.derivedidentities.bidirectional; | ||
|
||
import java.io.Serializable; | ||
import javax.persistence.Basic; | ||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
import javax.persistence.OneToOne; | ||
|
||
@Entity | ||
public class PersonInfo | ||
implements Serializable | ||
{ | ||
private static final long serialVersionUID = 1L; | ||
|
||
@Id | ||
@OneToOne | ||
private Person id; | ||
|
||
@Basic | ||
private String info; | ||
|
||
public Person getId() | ||
{ | ||
return this.id; | ||
} | ||
|
||
public void setId(Person id) { | ||
this.id = id; | ||
} | ||
|
||
public String getInfo() { | ||
return this.info; | ||
} | ||
|
||
public void setInfo(String info) { | ||
this.info = info; | ||
} | ||
|
||
public int hashCode() | ||
{ | ||
int hash = 0; | ||
hash += (this.id != null ? this.id.hashCode() : 0); | ||
return hash; | ||
} | ||
|
||
public boolean equals(Object object) | ||
{ | ||
if (!(object instanceof PersonInfo)) { | ||
return false; | ||
} | ||
PersonInfo other = (PersonInfo)object; | ||
|
||
return ((this.id != null) || (other.id == null)) && ((this.id == null) || (this.id.equals(other.id))); | ||
} | ||
|
||
public String toString() | ||
{ | ||
return "nogroup.hibertest.PersonInfo[ id=" + this.id + " ]"; | ||
} | ||
} |