Hibernate SVN: r15577 - search/trunk/doc/reference/en/modules.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-11-17 08:22:20 -0500 (Mon, 17 Nov 2008)
New Revision: 15577
Modified:
search/trunk/doc/reference/en/modules/configuration.xml
Log:
HSEARCH-300 updated online doc regarding the compound file option
Modified: search/trunk/doc/reference/en/modules/configuration.xml
===================================================================
--- search/trunk/doc/reference/en/modules/configuration.xml 2008-11-17 13:19:01 UTC (rev 15576)
+++ search/trunk/doc/reference/en/modules/configuration.xml 2008-11-17 13:22:20 UTC (rev 15577)
@@ -811,7 +811,7 @@
default value for this option is
<literal>true</literal>.</para></entry>
- <entry>false</entry>
+ <entry>true</entry>
</row>
</tbody>
</tgroup>
16 years, 1 month
Hibernate SVN: r15576 - search/trunk.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-11-17 08:19:01 -0500 (Mon, 17 Nov 2008)
New Revision: 15576
Modified:
search/trunk/changelog.txt
Log:
Updated changelog for CR1
Modified: search/trunk/changelog.txt
===================================================================
--- search/trunk/changelog.txt 2008-11-17 13:14:01 UTC (rev 15575)
+++ search/trunk/changelog.txt 2008-11-17 13:19:01 UTC (rev 15576)
@@ -4,6 +4,31 @@
3.1.0.CR1 (17-10-2008)
------------------------
+** Bug
+ * [HSEARCH-250] - In ReaderStrategies, ensure that the reader is current AND that the directory returned by the DirectoryProvider are the same
+ * [HSEARCH-293] - AddLuceneWork is not being removed from the queue when DeleteLuceneWork is added for the same entity
+ * [HSEARCH-300] - Fix documentation on use_compound_file
+
+** Improvement
+ * [HSEARCH-213] - Use FieldSelector and doc(int, fieldSelector) to only select the necessary fields
+ * [HSEARCH-224] - Use MultiClassesQueryLoader in ProjectionLoader
+ * [HSEARCH-255] - Create a extensive Analyzer testing suite
+ * [HSEARCH-266] - Do not switch to the current directory in FSSlaveDirectoryProvider if no file has been copied
+ * [HSEARCH-274] - Use Lucene's new readonly IndexReader
+ * [HSEARCH-281] - Work should be Work<T>
+ * [HSEARCH-283] - Replace deprecated Classes and methods calls to Lucene 2.4
+
+** New Feature
+ * [HSEARCH-104] - Make @DocumentId optional and rely on @Id
+ * [HSEARCH-290] - Use IndexReader = readonly on Reader strategies (see Lucene 2.4)
+ * [HSEARCH-294] - Rename INSTANCE_AND_BITSETRESULTS to INSTANCE_AND_DOCIDSETRESULTS
+
+** Task
+ * [HSEARCH-288] - Evaluate changes in Lucene 2.4.0
+ * [HSEARCH-289] - Move to new Lucene Filter DocIdSet
+ * [HSEARCH-291] - improve documentation about thread safety requirements of Bridges.
+
+
3.1.0.Beta2 (27-10-2008)
------------------------
16 years, 1 month
Hibernate SVN: r15575 - search/trunk/doc/reference/en/modules.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-11-17 08:14:01 -0500 (Mon, 17 Nov 2008)
New Revision: 15575
Modified:
search/trunk/doc/reference/en/modules/configuration.xml
Log:
HSEARCH-300 updated online doc regarding the compound file option
Modified: search/trunk/doc/reference/en/modules/configuration.xml
===================================================================
--- search/trunk/doc/reference/en/modules/configuration.xml 2008-11-17 11:23:26 UTC (rev 15574)
+++ search/trunk/doc/reference/en/modules/configuration.xml 2008-11-17 13:14:01 UTC (rev 15575)
@@ -657,22 +657,28 @@
hibernate.search.Animals.2.indexwriter.transaction.merge_factor 20
hibernate.search.default.indexwriter.batch.max_merge_docs 100</programlisting>
This configuration will result in these settings applied to the second
- shard of Animals index:</para> <itemizedlist>
- <listitem><para><literal>transaction.max_merge_docs</literal> = 10</para>
- </listitem>
+ shard of Animals index:</para>
- <listitem><para><literal>batch.max_merge_docs</literal> = 100</para>
- </listitem>
+ <itemizedlist>
+ <listitem>
+ <para><literal>transaction.max_merge_docs</literal> = 10</para>
+ </listitem>
- <listitem><para><literal>transaction.merge_factor</literal> = 20</para></listitem>
+ <listitem>
+ <para><literal>batch.max_merge_docs</literal> = 100</para>
+ </listitem>
- <listitem><para><literal>batch.merge_factor</literal> = 20</para>
- </listitem>
- </itemizedlist>
+ <listitem>
+ <para><literal>transaction.merge_factor</literal> = 20</para>
+ </listitem>
- <para>All other values will use the defaults defined in
- Lucene.</para>
+ <listitem>
+ <para><literal>batch.merge_factor</literal> = 20</para>
+ </listitem>
+ </itemizedlist>
+ <para>All other values will use the defaults defined in Lucene.</para>
+
<para>The default for all values is to leave them at Lucene's own default,
so the listed values in the following table actually depend on the version
of Lucene you are using; values shown are relative to version
@@ -794,15 +800,16 @@
<row>
<entry><literal>hibernate.search.[default|<indexname>].indexwriter.[transaction|batch].use_compound_file</literal></entry>
- <entry><para>Leaving this value to false is generally the best
- performing option. You may need to enable it to have the index
- written to a single compound file to use less file handlers, but
- increasing the number of permitted file handlers is usually a
- preferred solution.</para> <para>Especially when synchronizing
- indexes using JMS avoid this option as it will copy the complete
- index each time.</para> <para>Boolean parameter, use
- "<literal>true</literal>" or
- "<literal>false</literal>".</para></entry>
+ <entry>The advantage of using the compound file format is that
+ less file descriptors are used. The disadvantage is that indexing
+ takes more time and temporary disk space. You can set this
+ paramter to <literal>false</literal> in an attempt to improve the
+ indexing time, but you risking running out of file descriptors if
+ <literal>mergeFactor</literal> is also
+ large.<para></para><para>Boolean parameter, use
+ "<literal>true</literal>" or "<literal>false</literal>". The
+ default value for this option is
+ <literal>true</literal>.</para></entry>
<entry>false</entry>
</row>
@@ -810,4 +817,4 @@
</tgroup>
</table>
</section>
-</chapter>
\ No newline at end of file
+</chapter>
16 years, 1 month
Hibernate SVN: r15574 - in search/trunk/src/java/org/hibernate/search/bridge: builtin and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-11-17 06:23:26 -0500 (Mon, 17 Nov 2008)
New Revision: 15574
Modified:
search/trunk/src/java/org/hibernate/search/bridge/StringBridge.java
search/trunk/src/java/org/hibernate/search/bridge/TwoWayStringBridge.java
search/trunk/src/java/org/hibernate/search/bridge/builtin/BigIntegerBridge.java
Log:
javadoc fixes
Modified: search/trunk/src/java/org/hibernate/search/bridge/StringBridge.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/bridge/StringBridge.java 2008-11-17 10:32:38 UTC (rev 15573)
+++ search/trunk/src/java/org/hibernate/search/bridge/StringBridge.java 2008-11-17 11:23:26 UTC (rev 15574)
@@ -4,8 +4,8 @@
/**
* Transform an object into a string representation.
*
- * All implementations are required to be threadsafe;
- * usually this is easily achieved avoiding the usage
+ * All implementations are required to be threadsafe.
+ * Usually this is easily achieved avoiding the usage
* of class fields, unless they are either immutable
* or needed to store parameters.
*
@@ -14,7 +14,11 @@
public interface StringBridge {
/**
- * {@inheritDoc}
+ * Converts the object representation to a string.
+ *
+ * @param object The object to transform into a string representation.
+ * @return String representation of the given object to be stored in Lucene index. The return string must not be
+ * <code>null</code>. It can be empty though.
*/
String objectToString(Object object);
}
Modified: search/trunk/src/java/org/hibernate/search/bridge/TwoWayStringBridge.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/bridge/TwoWayStringBridge.java 2008-11-17 10:32:38 UTC (rev 15573)
+++ search/trunk/src/java/org/hibernate/search/bridge/TwoWayStringBridge.java 2008-11-17 11:23:26 UTC (rev 15574)
@@ -2,21 +2,26 @@
package org.hibernate.search.bridge;
/**
- * StringBridge allowing a translation from the String back to the Object
- * objectToString( stringToObject( string ) ) and stringToObject( objectToString( object ) )
- * should be "idempotent". More precisely,
- *
- * objectToString( stringToObject( string ) ).equals(string) for string not null
- * stringToObject( objectToString( object ) ).equals(object) for object not null
+ * <code>StringBridge<code> allowing a translation from the string representation back to the <code>Object</code>.
+ * <code>objectToString( stringToObject( string ) )</code> and <code>stringToObject( objectToString( object ) )</code>
+ * should be "idempotent". More precisely:
+ * <ul>
+ * <li><code>objectToString( stringToObject( string ) ).equals(string)</code>, for non <code>null</code> string.</li>
+ * <li><code>stringToObject( objectToString( object ) ).equals(object)</code>, for non <code>null</code> object. </li>
+ * </ul>
*
- * As for all Bridges implementors must be threasafe.
+ * As for all Bridges implementations must be threasafe.
*
* @author Emmanuel Bernard
*/
public interface TwoWayStringBridge extends StringBridge {
/**
- * {@inheritDoc}
+ * Convert the index string representation to an object.
+ *
+ * @param stringValue The index value.
+ * @return Takes the string representation from the Lucene index and transforms it back into the original
+ * <code>Object</code>.
*/
Object stringToObject(String stringValue);
}
Modified: search/trunk/src/java/org/hibernate/search/bridge/builtin/BigIntegerBridge.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/bridge/builtin/BigIntegerBridge.java 2008-11-17 10:32:38 UTC (rev 15573)
+++ search/trunk/src/java/org/hibernate/search/bridge/builtin/BigIntegerBridge.java 2008-11-17 11:23:26 UTC (rev 15574)
@@ -6,13 +6,15 @@
import org.hibernate.util.StringHelper;
/**
- * Map a BigInteger element
+ * Map a <code>BigInteger</code> element.
*
* @author Emmanuel Bernard
*/
public class BigIntegerBridge extends NumberBridge {
public Object stringToObject(String stringValue) {
- if ( StringHelper.isEmpty( stringValue ) ) return null;
+ if ( StringHelper.isEmpty( stringValue ) ) {
+ return null;
+ }
return new BigInteger( stringValue );
}
}
16 years, 1 month
Hibernate SVN: r15573 - search/trunk.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-11-17 05:32:38 -0500 (Mon, 17 Nov 2008)
New Revision: 15573
Modified:
search/trunk/build.xml
search/trunk/common-build.xml
Log:
removed the ivy publish task
Modified: search/trunk/build.xml
===================================================================
--- search/trunk/build.xml 2008-11-17 07:34:10 UTC (rev 15572)
+++ search/trunk/build.xml 2008-11-17 10:32:38 UTC (rev 15573)
@@ -284,14 +284,9 @@
<attribute name="Implementation-Vendor-Id" value="hibernate.org"/>
<attribute name="Implementation-URL" value="http://search.hibernate.org"/>
</manifest>
- <antcall target="common-build.jar"/>
- <ivy:resolve conf="default"/>
- <ivy:publish artifactspattern="${dist.dir}/[artifact].[ext]"
- resolver="local"
- pubrevision="latest"
- pubdate="${now}"
- status="integration"
- />
+ <mkdir dir="${dist.dir}"/>
+ <jar filesetmanifest="merge" jarfile="${jar.file.name}"
+ basedir="${classes.dir}"/>
</target>
<!-- Some of this can probably be moved to common-build... -->
Modified: search/trunk/common-build.xml
===================================================================
--- search/trunk/common-build.xml 2008-11-17 07:34:10 UTC (rev 15572)
+++ search/trunk/common-build.xml 2008-11-17 10:32:38 UTC (rev 15573)
@@ -240,14 +240,7 @@
</fileset>
</copy>
</target>
-
- <target name="jar" depends="compile"
- description="Build the distribution .jar file">
- <mkdir dir="${dist.dir}"/>
- <jar filesetmanifest="merge" jarfile="${jar.file.name}"
- basedir="${classes.dir}"/>
- </target>
-
+
<target name="jartest" depends="compiletest"
description="Build the distribution .jar file">
<mkdir dir="${dist.dir}"/>
16 years, 1 month
Hibernate SVN: r15572 - core/trunk/documentation/envers/src/main/docbook/en-US/content.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2008-11-17 02:34:10 -0500 (Mon, 17 Nov 2008)
New Revision: 15572
Modified:
core/trunk/documentation/envers/src/main/docbook/en-US/content/exceptions.xml
core/trunk/documentation/envers/src/main/docbook/en-US/content/preface.xml
Log:
HHH-3564: updating the manual
Modified: core/trunk/documentation/envers/src/main/docbook/en-US/content/exceptions.xml
===================================================================
--- core/trunk/documentation/envers/src/main/docbook/en-US/content/exceptions.xml 2008-11-17 07:19:44 UTC (rev 15571)
+++ core/trunk/documentation/envers/src/main/docbook/en-US/content/exceptions.xml 2008-11-17 07:34:10 UTC (rev 15572)
@@ -76,11 +76,6 @@
relations in components
</para>
</listitem>
- <listitem>
- <para>
- joined and table-per-class inheritance
- </para>
- </listitem>
</orderedlist>
</sect1>
Modified: core/trunk/documentation/envers/src/main/docbook/en-US/content/preface.xml
===================================================================
--- core/trunk/documentation/envers/src/main/docbook/en-US/content/preface.xml 2008-11-17 07:19:44 UTC (rev 15571)
+++ core/trunk/documentation/envers/src/main/docbook/en-US/content/preface.xml 2008-11-17 07:34:10 UTC (rev 15572)
@@ -59,8 +59,7 @@
<orderedlist>
<listitem>
<para>
- auditing of all mappings defined by the JPA specification, except joined and
- table-per-class inheritance
+ auditing of all mappings defined by the JPA specification
</para>
</listitem>
<listitem>
16 years, 1 month
Hibernate SVN: r15571 - in core/trunk/envers/src: test/java/org/hibernate/envers/test/integration/inheritance and 5 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2008-11-17 02:19:44 -0500 (Mon, 17 Nov 2008)
New Revision: 15571
Added:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ChildAuditing.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ChildEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ParentAuditing.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ParentEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ChildIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ChildReferencing.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ParentNotIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ReferencedEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/Address.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/Contact.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/NotOwnedBidirectional.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/PersonalContact.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/ChildIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/ParentIngEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/PolymorphicCollection.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/ReferencedEntity.java
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
core/trunk/envers/src/test/resources/testng.xml
Log:
HHH-3564: support for joined inheritance with tests
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java 2008-11-16 16:48:22 UTC (rev 15570)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -293,8 +293,14 @@
break;
case JOINED:
- throw new MappingException("Joined inheritance strategy not supported for auditing!");
+ mappingData = generateInheritanceMappingData(pc, xmlMappingData, auditTableData, "joined-subclass");
+ // Adding the "key" element with all columns + the revision number column
+ Element keyMapping = mappingData.getFirst().addElement("key");
+ MetadataTools.addColumns(keyMapping, pc.getIdentifierProperty().getColumnIterator());
+ MetadataTools.addColumn(keyMapping, verEntCfg.getRevisionPropName(), null);
+ break;
+
case TABLE_PER_CLASS:
mappingData = generateInheritanceMappingData(pc, xmlMappingData, auditTableData, "union-subclass");
break;
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ChildAuditing.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ChildAuditing.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ChildAuditing.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,94 @@
+/*
+ * 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.envers.test.integration.inheritance.joined;
+
+import java.util.Arrays;
+import javax.persistence.EntityManager;
+
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.ejb.Ejb3Configuration;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class ChildAuditing extends AbstractEntityTest {
+ private Integer id1;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(ChildEntity.class);
+ cfg.addAnnotatedClass(ParentEntity.class);
+ }
+
+ @BeforeClass(dependsOnMethods = "init")
+ public void initData() {
+ EntityManager em = getEntityManager();
+
+ id1 = 1;
+
+ // Rev 1
+ em.getTransaction().begin();
+ ChildEntity ce = new ChildEntity(id1, "x", 1l);
+ em.persist(ce);
+ em.getTransaction().commit();
+
+ // Rev 2
+ em.getTransaction().begin();
+ ce = em.find(ChildEntity.class, id1);
+ ce.setData("y");
+ ce.setNumber(2l);
+ em.getTransaction().commit();
+ }
+
+ @Test
+ public void testRevisionsCounts() {
+ assert Arrays.asList(1, 2).equals(getAuditReader().getRevisions(ChildEntity.class, id1));
+ }
+
+ @Test
+ public void testHistoryOfChildId1() {
+ ChildEntity ver1 = new ChildEntity(id1, "x", 1l);
+ ChildEntity ver2 = new ChildEntity(id1, "y", 2l);
+
+ assert getAuditReader().find(ChildEntity.class, id1, 1).equals(ver1);
+ assert getAuditReader().find(ChildEntity.class, id1, 2).equals(ver2);
+
+ assert getAuditReader().find(ParentEntity.class, id1, 1).equals(ver1);
+ assert getAuditReader().find(ParentEntity.class, id1, 2).equals(ver2);
+ }
+
+ @Test
+ public void testPolymorphicQuery() {
+ ChildEntity childVer1 = new ChildEntity(id1, "x", 1l);
+
+ assert getAuditReader().createQuery().forEntitiesAtRevision(ChildEntity.class, 1).getSingleResult()
+ .equals(childVer1);
+
+ assert getAuditReader().createQuery().forEntitiesAtRevision(ParentEntity.class, 1).getSingleResult()
+ .equals(childVer1);
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ChildEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ChildEntity.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ChildEntity.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,78 @@
+/*
+ * 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.envers.test.integration.inheritance.joined;
+
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+public class ChildEntity extends ParentEntity {
+ @Basic
+ private Long number;
+
+ public ChildEntity() {
+ }
+
+ public ChildEntity(Integer id, String data, Long number) {
+ super(id, data);
+ this.number = number;
+ }
+
+ public Long getNumber() {
+ return number;
+ }
+
+ public void setNumber(Long number) {
+ this.number = number;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ChildEntity)) return false;
+ if (!super.equals(o)) return false;
+
+ ChildEntity childEntity = (ChildEntity) o;
+
+ if (number != null ? !number.equals(childEntity.number) : childEntity.number != null) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (number != null ? number.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "ChildEntity(id = " + getId() + ", data = " + getData() + ", number = " + number + ")";
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ParentAuditing.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ParentAuditing.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ParentAuditing.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,95 @@
+/*
+ * 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.envers.test.integration.inheritance.joined;
+
+import java.util.Arrays;
+import javax.persistence.EntityManager;
+
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.ejb.Ejb3Configuration;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class ParentAuditing extends AbstractEntityTest {
+ private Integer id1;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(ChildEntity.class);
+ cfg.addAnnotatedClass(ParentEntity.class);
+ }
+
+ @BeforeClass(dependsOnMethods = "init")
+ public void initData() {
+ EntityManager em = getEntityManager();
+
+ id1 = 1;
+
+ // Rev 1
+ em.getTransaction().begin();
+ ParentEntity pe = new ParentEntity(id1, "x");
+ em.persist(pe);
+ em.getTransaction().commit();
+
+ // Rev 2
+ em.getTransaction().begin();
+ pe = em.find(ParentEntity.class, id1);
+ pe.setData("y");
+ em.getTransaction().commit();
+ }
+
+ @Test
+ public void testRevisionsCounts() {
+ assert Arrays.asList(1, 2).equals(getAuditReader().getRevisions(ParentEntity.class, id1));
+ }
+
+ @Test
+ public void testHistoryOfChildId1() {
+ assert getAuditReader().find(ChildEntity.class, id1, 1) == null;
+ assert getAuditReader().find(ChildEntity.class, id1, 2) == null;
+ }
+
+ @Test
+ public void testHistoryOfParentId1() {
+ ParentEntity ver1 = new ParentEntity(id1, "x");
+ ParentEntity ver2 = new ParentEntity(id1, "y");
+
+ assert getAuditReader().find(ParentEntity.class, id1, 1).equals(ver1);
+ assert getAuditReader().find(ParentEntity.class, id1, 2).equals(ver2);
+ }
+
+ @Test
+ public void testPolymorphicQuery() {
+ ParentEntity parentVer1 = new ParentEntity(id1, "x");
+
+ assert getAuditReader().createQuery().forEntitiesAtRevision(ParentEntity.class, 1).getSingleResult()
+ .equals(parentVer1);
+ assert getAuditReader().createQuery().forEntitiesAtRevision(ChildEntity.class, 1)
+ .getResultList().size() == 0;
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ParentEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ParentEntity.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/ParentEntity.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,94 @@
+/*
+ * 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.envers.test.integration.inheritance.joined;
+
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Inheritance(strategy = InheritanceType.JOINED)
+@Audited
+public class ParentEntity {
+ @Id
+ private Integer id;
+
+ @Basic
+ private String data;
+
+ public ParentEntity() {
+ }
+
+ public ParentEntity(Integer id, String data) {
+ this.id = id;
+ this.data = data;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ParentEntity)) return false;
+
+ ParentEntity that = (ParentEntity) o;
+
+ if (data != null ? !data.equals(that.data) : that.data != null) return false;
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = (id != null ? id.hashCode() : 0);
+ result = 31 * result + (data != null ? data.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "ParentEntity(id = " + getId() + ", data = " + getData() + ")";
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ChildIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ChildIngEntity.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ChildIngEntity.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,90 @@
+/*
+ * 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.envers.test.integration.inheritance.joined.childrelation;
+
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+import javax.persistence.ManyToOne;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+public class ChildIngEntity extends ParentNotIngEntity {
+ @Basic
+ private Long number;
+
+ @ManyToOne
+ private ReferencedEntity referenced;
+
+ public ChildIngEntity() {
+ }
+
+ public ChildIngEntity(Integer id, String data, Long number) {
+ super(id, data);
+ this.number = number;
+ }
+
+ public Long getNumber() {
+ return number;
+ }
+
+ public void setNumber(Long number) {
+ this.number = number;
+ }
+
+ public ReferencedEntity getReferenced() {
+ return referenced;
+ }
+
+ public void setReferenced(ReferencedEntity referenced) {
+ this.referenced = referenced;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ChildIngEntity)) return false;
+ if (!super.equals(o)) return false;
+
+ ChildIngEntity childEntity = (ChildIngEntity) o;
+
+ if (number != null ? !number.equals(childEntity.number) : childEntity.number != null) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (number != null ? number.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "ChildIngEntity(id = " + getId() + ", data = " + getData() + ", number = " + number + ")";
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ChildReferencing.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ChildReferencing.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ChildReferencing.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,124 @@
+/*
+ * 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.envers.test.integration.inheritance.joined.childrelation;
+
+import java.util.Arrays;
+import javax.persistence.EntityManager;
+
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.hibernate.envers.test.tools.TestTools;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.ejb.Ejb3Configuration;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class ChildReferencing extends AbstractEntityTest {
+ private Integer re_id1;
+ private Integer re_id2;
+ private Integer c_id;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(ChildIngEntity.class);
+ cfg.addAnnotatedClass(ParentNotIngEntity.class);
+ cfg.addAnnotatedClass(ReferencedEntity.class);
+ }
+
+ @BeforeClass(dependsOnMethods = "init")
+ public void initData() {
+ EntityManager em = getEntityManager();
+
+ re_id1 = 1;
+ re_id2 = 10;
+ c_id = 100;
+
+ // Rev 1
+ em.getTransaction().begin();
+
+ ReferencedEntity re1 = new ReferencedEntity(re_id1);
+ em.persist(re1);
+
+ ReferencedEntity re2 = new ReferencedEntity(re_id2);
+ em.persist(re2);
+
+ em.getTransaction().commit();
+
+ // Rev 2
+ em.getTransaction().begin();
+
+ re1 = em.find(ReferencedEntity.class, re_id1);
+
+ ChildIngEntity cie = new ChildIngEntity(c_id, "y", 1l);
+ cie.setReferenced(re1);
+ em.persist(cie);
+ c_id = cie.getId();
+
+ em.getTransaction().commit();
+
+ // Rev 3
+ em.getTransaction().begin();
+
+ re2 = em.find(ReferencedEntity.class, re_id2);
+ cie = em.find(ChildIngEntity.class, c_id);
+
+ cie.setReferenced(re2);
+
+ em.getTransaction().commit();
+ }
+
+ @Test
+ public void testRevisionsCounts() {
+ assert Arrays.asList(1, 2, 3).equals(getAuditReader().getRevisions(ReferencedEntity.class, re_id1));
+ assert Arrays.asList(1, 3).equals(getAuditReader().getRevisions(ReferencedEntity.class, re_id2));
+ assert Arrays.asList(2, 3).equals(getAuditReader().getRevisions(ChildIngEntity.class, c_id));
+ }
+
+ @Test
+ public void testHistoryOfReferencedCollection1() {
+ assert getAuditReader().find(ReferencedEntity.class, re_id1, 1).getReferencing().size() == 0;
+ assert getAuditReader().find(ReferencedEntity.class, re_id1, 2).getReferencing().equals(
+ TestTools.makeSet(new ChildIngEntity(c_id, "y", 1l)));
+ assert getAuditReader().find(ReferencedEntity.class, re_id1, 3).getReferencing().size() == 0;
+ }
+
+ @Test
+ public void testHistoryOfReferencedCollection2() {
+ assert getAuditReader().find(ReferencedEntity.class, re_id2, 1).getReferencing().size() == 0;
+ assert getAuditReader().find(ReferencedEntity.class, re_id2, 2).getReferencing().size() == 0;
+ assert getAuditReader().find(ReferencedEntity.class, re_id2, 3).getReferencing().equals(
+ TestTools.makeSet(new ChildIngEntity(c_id, "y", 1l)));
+ }
+
+ @Test
+ public void testChildHistory() {
+ assert getAuditReader().find(ChildIngEntity.class, c_id, 1) == null;
+ assert getAuditReader().find(ChildIngEntity.class, c_id, 2).getReferenced().equals(
+ new ReferencedEntity(re_id1));
+ assert getAuditReader().find(ChildIngEntity.class, c_id, 3).getReferenced().equals(
+ new ReferencedEntity(re_id2));
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ParentNotIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ParentNotIngEntity.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ParentNotIngEntity.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,94 @@
+/*
+ * 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.envers.test.integration.inheritance.joined.childrelation;
+
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Inheritance(strategy = InheritanceType.JOINED)
+@Audited
+public class ParentNotIngEntity {
+ @Id
+ private Integer id;
+
+ @Basic
+ private String data;
+
+ public ParentNotIngEntity() {
+ }
+
+ public ParentNotIngEntity(Integer id, String data) {
+ this.id = id;
+ this.data = data;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ParentNotIngEntity)) return false;
+
+ ParentNotIngEntity that = (ParentNotIngEntity) o;
+
+ if (data != null ? !data.equals(that.data) : that.data != null) return false;
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = (id != null ? id.hashCode() : 0);
+ result = 31 * result + (data != null ? data.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "ParentNotIngEntity(id = " + getId() + ", data = " + getData() + ")";
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ReferencedEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ReferencedEntity.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/childrelation/ReferencedEntity.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,87 @@
+/*
+ * 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.envers.test.integration.inheritance.joined.childrelation;
+
+import java.util.Set;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+public class ReferencedEntity {
+ @Id
+ private Integer id;
+
+ @OneToMany(mappedBy = "referenced")
+ private Set<ChildIngEntity> referencing;
+
+ public ReferencedEntity(Integer id) {
+ this.id = id;
+ }
+
+ public ReferencedEntity() {
+ }
+
+ public Set<ChildIngEntity> getReferencing() {
+ return referencing;
+ }
+
+ public void setReferencing(Set<ChildIngEntity> referencing) {
+ this.referencing = referencing;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ReferencedEntity)) return false;
+
+ ReferencedEntity that = (ReferencedEntity) o;
+
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ return id;
+ }
+
+ public String toString() {
+ return "ReferencedEntity(id = " + getId() + ")";
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/Address.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/Address.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/Address.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,100 @@
+/*
+ * 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.envers.test.integration.inheritance.joined.notownedrelation;
+
+import org.hibernate.envers.Audited;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+@Entity
+@Audited
+public class Address implements Serializable {
+ @Id
+ private Long id;
+
+ private String address1;
+
+ @ManyToOne
+ private Contact contact;
+
+ public Address() {
+ }
+
+ public Address(Long id, String address1) {
+ this.id = id;
+ this.address1 = address1;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getAddress1() {
+ return address1;
+ }
+
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ public Contact getContact() {
+ return contact;
+ }
+
+ public void setContact(Contact contact) {
+ this.contact = contact;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Address)) return false;
+
+ Address address = (Address) o;
+
+ if (address1 != null ? !address1.equals(address.address1) : address.address1 != null) return false;
+ if (id != null ? !id.equals(address.id) : address.id != null) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = (id != null ? id.hashCode() : 0);
+ result = 31 * result + (address1 != null ? address1.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "Address(id = " + getId() + ", address1 = " + getAddress1() + ")";
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/Contact.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/Contact.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/Contact.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,77 @@
+/*
+ * 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.envers.test.integration.inheritance.joined.notownedrelation;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.OneToMany;
+
+import org.hibernate.envers.Audited;
+
+@Entity
+(a)Inheritance(strategy=InheritanceType.JOINED)
+@Audited
+public class Contact implements Serializable {
+ @Id
+ private Long id;
+
+ private String email;
+
+ @OneToMany(mappedBy="contact")
+ private Set<Address> addresses;
+
+ public Contact() {
+ }
+
+ public Contact(Long id, String email) {
+ this.id = id;
+ this.email = email;
+ }
+
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public String getEmail() {
+ return email;
+ }
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public Set<Address> getAddresses() {
+ return addresses;
+ }
+ public void setAddresses(Set<Address> addresses) {
+ this.addresses = addresses;
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/NotOwnedBidirectional.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/NotOwnedBidirectional.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/NotOwnedBidirectional.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,115 @@
+/*
+ * 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.envers.test.integration.inheritance.joined.notownedrelation;
+
+import java.util.Arrays;
+import javax.persistence.EntityManager;
+
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.hibernate.envers.test.tools.TestTools;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.ejb.Ejb3Configuration;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class NotOwnedBidirectional extends AbstractEntityTest {
+ private Long pc_id;
+ private Long a1_id;
+ private Long a2_id;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(Address.class);
+ cfg.addAnnotatedClass(Contact.class);
+ cfg.addAnnotatedClass(PersonalContact.class);
+ }
+
+ @BeforeClass(dependsOnMethods = "init")
+ public void initData() {
+ EntityManager em = getEntityManager();
+
+ pc_id = 1l;
+ a1_id = 10l;
+ a2_id = 100l;
+
+ // Rev 1
+ em.getTransaction().begin();
+
+ PersonalContact pc = new PersonalContact(pc_id, "e", "f");
+
+ Address a1 = new Address(a1_id, "a1");
+ a1.setContact(pc);
+
+ em.persist(pc);
+ em.persist(a1);
+
+ em.getTransaction().commit();
+
+ // Rev 2
+ em.getTransaction().begin();
+
+ pc = em.find(PersonalContact.class, pc_id);
+
+ Address a2 = new Address(a2_id, "a2");
+ a2.setContact(pc);
+
+ em.persist(a2);
+
+ em.getTransaction().commit();
+ }
+
+ @Test
+ public void testRevisionsCounts() {
+ assert Arrays.asList(1, 2).equals(getAuditReader().getRevisions(Contact.class, pc_id));
+ assert Arrays.asList(1, 2).equals(getAuditReader().getRevisions(PersonalContact.class, pc_id));
+
+ assert Arrays.asList(1).equals(getAuditReader().getRevisions(Address.class, a1_id));
+ assert Arrays.asList(1).equals(getAuditReader().getRevisions(Address.class, a1_id));
+
+ assert Arrays.asList(2).equals(getAuditReader().getRevisions(Address.class, a2_id));
+ assert Arrays.asList(2).equals(getAuditReader().getRevisions(Address.class, a2_id));
+ }
+
+ @Test
+ public void testHistoryOfContact() {
+ assert getAuditReader().find(Contact.class, pc_id, 1).getAddresses().equals(
+ TestTools.makeSet(new Address(a1_id, "a1")));
+
+ assert getAuditReader().find(Contact.class, pc_id, 2).getAddresses().equals(
+ TestTools.makeSet(new Address(a1_id, "a1"), new Address(a2_id, "a2")));
+ }
+
+ @Test
+ public void testHistoryOfPersonalContact() {
+ System.out.println(getAuditReader().find(PersonalContact.class, pc_id, 1).getAddresses());
+ assert getAuditReader().find(PersonalContact.class, pc_id, 1).getAddresses().equals(
+ TestTools.makeSet(new Address(a1_id, "a1")));
+
+ assert getAuditReader().find(PersonalContact.class, pc_id, 2).getAddresses().equals(
+ TestTools.makeSet(new Address(a1_id, "a1"), new Address(a2_id, "a2")));
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/PersonalContact.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/PersonalContact.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/notownedrelation/PersonalContact.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,51 @@
+/*
+ * 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.envers.test.integration.inheritance.joined.notownedrelation;
+
+import javax.persistence.Entity;
+
+import org.hibernate.envers.Audited;
+
+@Entity
+@Audited
+public class PersonalContact extends Contact {
+ private String firstname;
+
+ public PersonalContact() {
+ }
+
+ public PersonalContact(Long id, String email, String firstname) {
+ super(id, email);
+ this.firstname = firstname;
+ }
+
+ public String getFirstname() {
+ return firstname;
+ }
+
+ public void setFirstname(String firstname) {
+ this.firstname = firstname;
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/ChildIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/ChildIngEntity.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/ChildIngEntity.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,78 @@
+/*
+ * 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.envers.test.integration.inheritance.joined.relation;
+
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+public class ChildIngEntity extends ParentIngEntity {
+ @Basic
+ private Long number;
+
+ public ChildIngEntity() {
+ }
+
+ public ChildIngEntity(Integer id, String data, Long number) {
+ super(id, data);
+ this.number = number;
+ }
+
+ public Long getNumber() {
+ return number;
+ }
+
+ public void setNumber(Long number) {
+ this.number = number;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ChildIngEntity)) return false;
+ if (!super.equals(o)) return false;
+
+ ChildIngEntity childEntity = (ChildIngEntity) o;
+
+ if (number != null ? !number.equals(childEntity.number) : childEntity.number != null) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (number != null ? number.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "ChildIngEntity(id = " + getId() + ", data = " + getData() + ", number = " + number + ")";
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/ParentIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/ParentIngEntity.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/ParentIngEntity.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,106 @@
+/*
+ * 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.envers.test.integration.inheritance.joined.relation;
+
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.ManyToOne;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Inheritance(strategy = InheritanceType.JOINED)
+@Audited
+public class ParentIngEntity {
+ @Id
+ private Integer id;
+
+ @Basic
+ private String data;
+
+ @ManyToOne
+ private ReferencedEntity referenced;
+
+ public ParentIngEntity() {
+ }
+
+ public ParentIngEntity(Integer id, String data) {
+ this.id = id;
+ this.data = data;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ public ReferencedEntity getReferenced() {
+ return referenced;
+ }
+
+ public void setReferenced(ReferencedEntity referenced) {
+ this.referenced = referenced;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ParentIngEntity)) return false;
+
+ ParentIngEntity that = (ParentIngEntity) o;
+
+ if (data != null ? !data.equals(that.data) : that.data != null) return false;
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = (id != null ? id.hashCode() : 0);
+ result = 31 * result + (data != null ? data.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "ParentIngEntity(id = " + getId() + ", data = " + getData() + ")";
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/PolymorphicCollection.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/PolymorphicCollection.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/PolymorphicCollection.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,107 @@
+/*
+ * 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.envers.test.integration.inheritance.joined.relation;
+
+import java.util.Arrays;
+import javax.persistence.EntityManager;
+
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.hibernate.envers.test.tools.TestTools;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.ejb.Ejb3Configuration;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class PolymorphicCollection extends AbstractEntityTest {
+ private Integer ed_id1;
+ private Integer c_id;
+ private Integer p_id;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(ChildIngEntity.class);
+ cfg.addAnnotatedClass(ParentIngEntity.class);
+ cfg.addAnnotatedClass(ReferencedEntity.class);
+ }
+
+ @BeforeClass(dependsOnMethods = "init")
+ public void initData() {
+ EntityManager em = getEntityManager();
+
+ ed_id1 = 1;
+ p_id = 10;
+ c_id = 100;
+
+ // Rev 1
+ em.getTransaction().begin();
+
+ ReferencedEntity re = new ReferencedEntity(ed_id1);
+ em.persist(re);
+
+ em.getTransaction().commit();
+
+ // Rev 2
+ em.getTransaction().begin();
+
+ re = em.find(ReferencedEntity.class, ed_id1);
+
+ ParentIngEntity pie = new ParentIngEntity(p_id,"x");
+ pie.setReferenced(re);
+ em.persist(pie);
+ p_id = pie.getId();
+
+ em.getTransaction().commit();
+
+ // Rev 3
+ em.getTransaction().begin();
+
+ re = em.find(ReferencedEntity.class, ed_id1);
+
+ ChildIngEntity cie = new ChildIngEntity(c_id, "y", 1l);
+ cie.setReferenced(re);
+ em.persist(cie);
+ c_id = cie.getId();
+
+ em.getTransaction().commit();
+ }
+
+ @Test
+ public void testRevisionsCounts() {
+ assert Arrays.asList(1, 2, 3).equals(getAuditReader().getRevisions(ReferencedEntity.class, ed_id1));
+ assert Arrays.asList(2).equals(getAuditReader().getRevisions(ParentIngEntity.class, p_id));
+ assert Arrays.asList(3).equals(getAuditReader().getRevisions(ChildIngEntity.class, c_id));
+ }
+
+ @Test
+ public void testHistoryOfReferencedCollection() {
+ assert getAuditReader().find(ReferencedEntity.class, ed_id1, 1).getReferencing().size() == 0;
+ assert getAuditReader().find(ReferencedEntity.class, ed_id1, 2).getReferencing().equals(
+ TestTools.makeSet(new ParentIngEntity(p_id, "x")));
+ assert getAuditReader().find(ReferencedEntity.class, ed_id1, 3).getReferencing().equals(
+ TestTools.makeSet(new ParentIngEntity(p_id, "x"), new ChildIngEntity(c_id, "y", 1l)));
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/ReferencedEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/ReferencedEntity.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/ReferencedEntity.java 2008-11-17 07:19:44 UTC (rev 15571)
@@ -0,0 +1,87 @@
+/*
+ * 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.envers.test.integration.inheritance.joined.relation;
+
+import java.util.Set;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+public class ReferencedEntity {
+ @Id
+ private Integer id;
+
+ @OneToMany(mappedBy = "referenced")
+ private Set<ParentIngEntity> referencing;
+
+ public ReferencedEntity() {
+ }
+
+ public ReferencedEntity(Integer id) {
+ this.id = id;
+ }
+
+ public Set<ParentIngEntity> getReferencing() {
+ return referencing;
+ }
+
+ public void setReferencing(Set<ParentIngEntity> referencing) {
+ this.referencing = referencing;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ReferencedEntity)) return false;
+
+ ReferencedEntity that = (ReferencedEntity) o;
+
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ return id;
+ }
+
+ public String toString() {
+ return "ReferencedEntity(id = " + getId() + ")";
+ }
+}
\ No newline at end of file
Modified: core/trunk/envers/src/test/resources/testng.xml
===================================================================
--- core/trunk/envers/src/test/resources/testng.xml 2008-11-16 16:48:22 UTC (rev 15570)
+++ core/trunk/envers/src/test/resources/testng.xml 2008-11-17 07:19:44 UTC (rev 15571)
@@ -13,6 +13,10 @@
<package name="org.hibernate.envers.test.integration.data" />
<package name="org.hibernate.envers.test.integration.flush" />
<package name="org.hibernate.envers.test.integration.ids" />
+ <package name="org.hibernate.envers.test.integration.inheritance.joined" />
+ <package name="org.hibernate.envers.test.integration.inheritance.joined.childrelation" />
+ <package name="org.hibernate.envers.test.integration.inheritance.joined.notownedrelation" />
+ <package name="org.hibernate.envers.test.integration.inheritance.joined.relation" />
<package name="org.hibernate.envers.test.integration.inheritance.single" />
<package name="org.hibernate.envers.test.integration.inheritance.single.childrelation" />
<package name="org.hibernate.envers.test.integration.inheritance.single.notownedrelation" />
16 years, 1 month
Hibernate SVN: r15570 - search/trunk/src/java/org/hibernate/search.
by hibernate-commits@lists.jboss.org
Author: sannegrinovero
Date: 2008-11-16 11:48:22 -0500 (Sun, 16 Nov 2008)
New Revision: 15570
Modified:
search/trunk/src/java/org/hibernate/search/FullTextSession.java
Log:
more javadoc fixes
Modified: search/trunk/src/java/org/hibernate/search/FullTextSession.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/FullTextSession.java 2008-11-16 16:46:22 UTC (rev 15569)
+++ search/trunk/src/java/org/hibernate/search/FullTextSession.java 2008-11-16 16:48:22 UTC (rev 15570)
@@ -42,7 +42,7 @@
/**
* Remove the entity with the type <code>entityType</code> and the identifier <code>id</code> from the index.
* If <code>id == null</code> all indexed entities of this type and its indexed subclasses are deleted. In this
- * case this method behaves like {@link #purgeAll(Class<?>)}.
+ * case this method behaves like {@link #purgeAll(Class)}.
*
* @param entityType The type of the entity to delete.
* @param id The id of the entity to delete.
16 years, 1 month
Hibernate SVN: r15569 - search/trunk/src/java/org/hibernate/search/reader.
by hibernate-commits@lists.jboss.org
Author: sannegrinovero
Date: 2008-11-16 11:46:22 -0500 (Sun, 16 Nov 2008)
New Revision: 15569
Modified:
search/trunk/src/java/org/hibernate/search/reader/SharedReaderProvider.java
Log:
HSEARCH-211 warn about bug; avoid using wrong javadoc tag
Modified: search/trunk/src/java/org/hibernate/search/reader/SharedReaderProvider.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/reader/SharedReaderProvider.java 2008-11-16 15:28:52 UTC (rev 15568)
+++ search/trunk/src/java/org/hibernate/search/reader/SharedReaderProvider.java 2008-11-16 16:46:22 UTC (rev 15569)
@@ -24,11 +24,11 @@
/**
* Share readers per <code>SearchFactory</code>, reusing them if they are still valid.
+ * This class contains several bugs including HSEARCH-211. Since it is deprecated we are not going to
+ * fix them right now.
*
* @deprecated replaced by SharingBufferReaderProvider
* @author Emmanuel Bernard
- * @todo This class contains several bugs including HSEARCH-250. Since it is deprecated we are not going to
- * fix them right now.
*/
@Deprecated
public class SharedReaderProvider implements ReaderProvider {
16 years, 1 month