diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Father.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Father.java index ce2e5f239b..60ff534e62 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Father.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Father.java @@ -24,7 +24,6 @@ */ package org.hibernate.test.annotations.onetoone; - /** * @author Hardy Ferentschik */ @@ -32,7 +31,7 @@ public class Father { private int id; private String name; - + public int getId() { return id; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OptionalOneToOneMappedByTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OptionalOneToOneMappedByTest.java index cb754fae1c..4d484af10c 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OptionalOneToOneMappedByTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OptionalOneToOneMappedByTest.java @@ -29,6 +29,7 @@ import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.criterion.Restrictions; import org.hibernate.id.IdentifierGenerationException; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import static org.junit.Assert.assertEquals; @@ -40,6 +41,7 @@ import static org.junit.Assert.fail; * @author Emmanuel Bernard * @author Gail Badner */ +@FailureExpectedWithNewMetamodel(message = "Needs one to one mapping support. See Binder#bindSingularAttribute") public class OptionalOneToOneMappedByTest extends BaseCoreFunctionalTestCase { // @OneToOne(mappedBy="address") with foreign generator diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OptionalOneToOnePKJCTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OptionalOneToOnePKJCTest.java index 5ad331897c..e2ef96d92c 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OptionalOneToOnePKJCTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OptionalOneToOnePKJCTest.java @@ -29,6 +29,7 @@ import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.criterion.Restrictions; import org.hibernate.id.IdentifierGenerationException; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; @@ -41,10 +42,11 @@ import static org.junit.Assert.fail; * @author Emmanuel Bernard * @author Gail Badner */ +@FailureExpectedWithNewMetamodel(message = "Needs one to one mapping support. See Binder#bindSingularAttribute") public class OptionalOneToOnePKJCTest extends BaseCoreFunctionalTestCase { @Test - @TestForIssue( jiraKey = "HHH-4982") + @TestForIssue(jiraKey = "HHH-4982") public void testNullBidirForeignIdGenerator() { Session s = openSession(); Transaction tx = s.beginTransaction(); @@ -53,7 +55,7 @@ public class OptionalOneToOnePKJCTest extends BaseCoreFunctionalTestCase { try { s.persist( person ); s.flush(); - fail( "should have thrown IdentifierGenerationException."); + fail( "should have thrown IdentifierGenerationException." ); } catch ( IdentifierGenerationException ex ) { // expected @@ -65,7 +67,7 @@ public class OptionalOneToOnePKJCTest extends BaseCoreFunctionalTestCase { } @Test - @TestForIssue( jiraKey = "HHH-4982") + @TestForIssue(jiraKey = "HHH-4982") public void testNotFoundBidirForeignIdGenerator() { Session s = openSession(); Transaction tx = s.beginTransaction(); @@ -76,7 +78,7 @@ public class OptionalOneToOnePKJCTest extends BaseCoreFunctionalTestCase { // Hibernate resets the ID to null before executing the foreign generator s.persist( person ); s.flush(); - fail( "should have thrown IdentifierGenerationException."); + fail( "should have thrown IdentifierGenerationException." ); } catch ( IdentifierGenerationException ex ) { // expected @@ -89,7 +91,7 @@ public class OptionalOneToOnePKJCTest extends BaseCoreFunctionalTestCase { // @PrimaryKeyJoinColumn @OneToOne(optional=true) non-foreign generator @Test - @TestForIssue( jiraKey = "HHH-4982") + @TestForIssue(jiraKey = "HHH-4982") public void testNotFoundBidirDefaultIdGenerator() { Session s = openSession(); s.getTransaction().begin(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Owner.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Owner.java index 69209aebdd..76f7a3f203 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Owner.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Owner.java @@ -1,5 +1,28 @@ -//$Id$ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Middleware LLC. + * + * This copyrighted material is made available to anyone wishing to use, modify, + * copy, or redistribute it subject to the terms and conditions of the GNU + * Lesser General Public License, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this distribution; if not, write to: + * Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301 USA + */ package org.hibernate.test.annotations.onetoone; + import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -12,9 +35,13 @@ import javax.persistence.PrimaryKeyJoinColumn; */ @Entity public class Owner { - @Id @GeneratedValue private Integer id; + @Id + @GeneratedValue + private Integer id; - @OneToOne(cascade = CascadeType.ALL) @PrimaryKeyJoinColumn private OwnerAddress address; + @OneToOne(cascade = CascadeType.ALL) + @PrimaryKeyJoinColumn + private OwnerAddress address; public OwnerAddress getAddress() { return address; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OwnerAddress.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OwnerAddress.java index 2ba8e9f0ba..0eb647f87c 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OwnerAddress.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OwnerAddress.java @@ -1,5 +1,28 @@ -//$Id$ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Middleware LLC. + * + * This copyrighted material is made available to anyone wishing to use, modify, + * copy, or redistribute it subject to the terms and conditions of the GNU + * Lesser General Public License, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this distribution; if not, write to: + * Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301 USA + */ package org.hibernate.test.annotations.onetoone; + import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -13,11 +36,12 @@ import org.hibernate.annotations.Parameter; */ @Entity public class OwnerAddress { - @Id @GeneratedValue(generator = "fk") - @GenericGenerator(strategy = "foreign", name = "fk", parameters = @Parameter(name="property", value="owner")) + @Id + @GeneratedValue(generator = "fk") + @GenericGenerator(strategy = "foreign", name = "fk", parameters = @Parameter(name = "property", value = "owner")) private Integer id; - @OneToOne(mappedBy="address") + @OneToOne(mappedBy = "address") private Owner owner; public Integer getId() { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Person.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Person.java index 1bfcc27155..b866c82911 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Person.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Person.java @@ -38,12 +38,15 @@ import org.hibernate.annotations.Parameter; */ @Entity public class Person { - @Id @GeneratedValue(generator = "fk") - @GenericGenerator(strategy = "foreign", name = "fk", parameters = @Parameter(name="property", value="personAddress")) + @Id + @GeneratedValue(generator = "fk") + @GenericGenerator(strategy = "foreign", + name = "fk", + parameters = @Parameter(name = "property", value = "personAddress")) private Integer id; @PrimaryKeyJoinColumn - @OneToOne(optional=true) + @OneToOne(optional = true) private PersonAddress personAddress; public Integer getId() { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/PersonAddress.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/PersonAddress.java index b8566f9dc7..4b1101fb88 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/PersonAddress.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/PersonAddress.java @@ -37,7 +37,7 @@ public class PersonAddress { @GeneratedValue private Integer id; - @OneToOne(mappedBy="personAddress") + @OneToOne(mappedBy = "personAddress") private Person person; public Integer getId() { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Son.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Son.java index 85715bad39..93a42b13b8 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Son.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/Son.java @@ -1,4 +1,3 @@ -// $Id$ /* * Hibernate, Relational Persistence for Idiomatic Java * @@ -24,12 +23,11 @@ */ package org.hibernate.test.annotations.onetoone; - /** * @author Hardy Ferentschik */ public class Son { - private int id; + private int id; private String name; diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/onetoone/orm.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/onetoone/orm.xml index 825e613de2..0e0de5776c 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/onetoone/orm.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/onetoone/orm.xml @@ -1,7 +1,6 @@ org.hibernate.test.annotations.onetoone