<name>Mark Robinson</name>
<email>mark@mrobinson.ca</email>
</contributor>
+ <contributor>
+ <name>Claus Graf</name>
+ <email>clausgraf@gmail.com</email>
+ </contributor>
</contributors>
<distributionManagement>
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>de.cege</groupId>
+ <artifactId>dependent</artifactId>
+ <version>0.0.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>7.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-envers</artifactId>
+ <version>4.3.5.Final</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </properties>
+</project>
\ No newline at end of file
--- /dev/null
+package dependent;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import org.hibernate.envers.Audited;
+
+@Entity
+@Audited
+public class DependentEntity {
+ @Id
+ @GeneratedValue
+ long id;
+
+ String name;
+}
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>de.cege</groupId>
+ <artifactId>h4mp</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <name>h4mp</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>7.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-envers</artifactId>
+ <version>4.3.5.Final</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.10.1.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>4.3.5.Final</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.5.8</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>de.cege</groupId>
+ <artifactId>dependent</artifactId>
+ <version>0.0.1</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>de.juplo</groupId>
+ <artifactId>hibernate4-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>export</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <target>NONE</target>
+ <envers>true</envers>
+ <format>true</format>
+ <delimiter>;</delimiter>
+ <force>true</force>
+ <type>CREATE</type>
+ <hibernateDialect>org.hibernate.dialect.PostgreSQL9Dialect</hibernateDialect>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+package h4mp;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+import org.hibernate.envers.Audited;
+
+import dependent.DependentEntity;
+
+@Entity
+@Audited
+public class MainEntity {
+ @Id
+ @GeneratedValue
+ long id;
+
+ @ManyToOne
+ DependentEntity dependentEntity;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.0"
+ xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/persistence
+ http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+ <persistence-unit name="primary">
+ <jta-data-source>java:jboss/datasources/PostgreSQLDS</jta-data-source>
+
+ <class>dependent.DependentEntity</class>
+
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop" />
+ <property name="hibernate.show_sql" value="true" />
+ </properties>
+ </persistence-unit>
+</persistence>
--- /dev/null
+package h4mp;
+
+import static org.junit.Assert.*;
+import static org.hamcrest.core.Is.*;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityTransaction;
+import javax.persistence.Persistence;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import dependent.DependentEntity;
+
+public class MainEntityTest {
+
+ private EntityManager em;
+ private EntityTransaction transaction;
+
+ @Before
+ public void initializeDependencies() {
+ em = Persistence.createEntityManagerFactory("jpaIntegrationTest")
+ .createEntityManager();
+ transaction = em.getTransaction();
+ }
+
+ @SuppressWarnings({ "rawtypes" })
+ @Test
+ public void test() {
+ DependentEntity entity = new DependentEntity();
+
+ transaction.begin();
+ em.persist(entity);
+ transaction.commit();
+
+ List resultList = em.createNativeQuery(
+ "select * from dependententity_aud").getResultList();
+ assertThat(resultList.size(), is(1));
+ }
+
+ @After
+ public void after() {
+ em.close();
+ }
+
+}
--- /dev/null
+<persistence version="2.0"
+ xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/persistence
+ http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+
+ <persistence-unit name="jpaIntegrationTest"
+ transaction-type="RESOURCE_LOCAL">
+
+ <class>dependent.DependentEntity</class>
+ <class>h4mp.MainEntity</class>
+ <!-- <exclude-unlisted-classes>true</exclude-unlisted-classes> -->
+
+ <properties>
+ <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:testDB;create=true" />
+ <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
+ <!-- Properties for Hibernate -->
+ <property name="hibernate.hbm2ddl.auto" value="create-drop" />
+ <property name="hibernate.show_sql" value="false" />
+ </properties>
+ </persistence-unit>
+</persistence>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>de.juplo</groupId>
+ <artifactId>dependency-test</artifactId>
+ <name>Hibernate 4 Dependency-Test</name>
+ <version>0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>dependent</module>
+ <module>h4mp</module>
+ </modules>
+</project>