diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/norevision/CollectionChangeNoRevisionTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/norevision/CollectionChangeNoRevisionTest.java index 767920a817..129406e164 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/norevision/CollectionChangeNoRevisionTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/norevision/CollectionChangeNoRevisionTest.java @@ -24,8 +24,8 @@ public class CollectionChangeNoRevisionTest extends AbstractSessionTest { @Override protected void initMappings() throws MappingException, URISyntaxException { - URL url = Thread.currentThread().getContextClassLoader().getResource("mappings/norevision/mappings.hbm.xml"); - config.addFile(new File(url.toURI())); + config.addAnnotatedClass(Person.class); + config.addAnnotatedClass(Name.class); config.setProperty("org.hibernate.envers.revision_on_collection_change", getCollectionChangeValue()); } diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/norevision/Name.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/norevision/Name.java index 8d48fc1ee7..0c03fe9643 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/norevision/Name.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/norevision/Name.java @@ -2,15 +2,19 @@ package org.hibernate.envers.test.integration.collection.norevision; import org.hibernate.envers.Audited; +import javax.persistence.*; import java.io.Serializable; @Audited +@Entity public class Name implements Serializable { - + @Id + @GeneratedValue private Integer id; private String name; - + @ManyToOne + @JoinColumn(name = "person_id", insertable = false, updatable = false) private Person person; public Integer getId() { diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/norevision/Person.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/norevision/Person.java index 0d4c3817d7..512b0a89e1 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/norevision/Person.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/collection/norevision/Person.java @@ -3,15 +3,19 @@ package org.hibernate.envers.test.integration.collection.norevision; import org.hibernate.envers.AuditMappedBy; import org.hibernate.envers.Audited; +import javax.persistence.*; import java.io.Serializable; import java.util.HashSet; import java.util.Set; @Audited +@Entity public class Person implements Serializable { - + @Id @GeneratedValue private Integer id; @AuditMappedBy(mappedBy = "person") + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "person_id") private Set names; public Person() { diff --git a/hibernate-envers/src/test/resources/mappings/norevision/mappings.hbm.xml b/hibernate-envers/src/test/resources/mappings/norevision/mappings.hbm.xml deleted file mode 100644 index dc3dd6b005..0000000000 --- a/hibernate-envers/src/test/resources/mappings/norevision/mappings.hbm.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file