Author: epbernard
Date: 2008-06-06 11:51:05 -0400 (Fri, 06 Jun 2008)
New Revision: 14750
Modified:
annotations/trunk/src/test/org/hibernate/test/annotations/onetoone/primarykey/Address.java
annotations/trunk/src/test/org/hibernate/test/annotations/onetoone/primarykey/NullablePrimaryKeyTest.java
Log:
ANN-742 fixed the flawed test by using mappedBy
Modified:
annotations/trunk/src/test/org/hibernate/test/annotations/onetoone/primarykey/Address.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/onetoone/primarykey/Address.java 2008-06-06
11:42:54 UTC (rev 14749)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/onetoone/primarykey/Address.java 2008-06-06
15:51:05 UTC (rev 14750)
@@ -6,6 +6,7 @@
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToOne;
+import javax.persistence.Transient;
@Entity
public class Address {
@@ -13,12 +14,8 @@
@Id
private long id;
- @OneToOne
- @JoinTable(
- name = "personAddress",
- joinColumns = @JoinColumn(name = "address_id", insertable = false, updatable
= false),
- inverseJoinColumns = @JoinColumn(name = "person_id", insertable = false,
updatable = false)
- )
+ @OneToOne(mappedBy = "address")
+
private Person person;
public long getId() {
Modified:
annotations/trunk/src/test/org/hibernate/test/annotations/onetoone/primarykey/NullablePrimaryKeyTest.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/onetoone/primarykey/NullablePrimaryKeyTest.java 2008-06-06
11:42:54 UTC (rev 14749)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/onetoone/primarykey/NullablePrimaryKeyTest.java 2008-06-06
15:51:05 UTC (rev 14750)
@@ -29,8 +29,8 @@
for (String s : schema) {
log.debug(s);
}
- String expectedMappingTableSql = "create table personAddress (person_id
numeric(19,0) not null, " +
- "address_id numeric(19,0) not null, primary key (person_id))";
+ String expectedMappingTableSql = "create table personAddress (address_id
numeric(19,0) null, " +
+ "person_id numeric(19,0) not null, primary key (address_id))";
assertEquals("Wrong SQL", expectedMappingTableSql, schema[2]);
} catch (Exception e) {
fail(e.getMessage());
Show replies by date