HHH-7944 - Separation of Envers API, SPI and internal packages

This commit is contained in:
Lukasz Antoniak 2013-04-08 14:43:29 +02:00
parent 2b2f333593
commit 5cc051e1df
285 changed files with 2279 additions and 2325 deletions

View File

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8' ?>
<?xml version='1.0' encoding='utf-8'?>
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" >
<info>
@ -40,7 +40,7 @@
which stores the historical data, whenever you commit a transaction. Envers automatically creates audit
tables if <literal>hibernate.hbm2ddl.auto</literal> option is set to <literal>create</literal>,
<literal>create-drop</literal> or <literal>update</literal>. Otherwise, to export complete database schema
programatically, use <literal>org.hibernate.tool.EnversSchemaGenerator</literal>. Appropriate DDL
programatically, use <literal>org.hibernate.envers.tools.hbm2ddl.EnversSchemaGenerator</literal>. Appropriate DDL
statements can be also generated with Ant task described later in this manual.
</para>
@ -58,7 +58,7 @@
</para>
</section>
<section>
<section xml:id="envers-configuration">
<title>Configuration</title>
<para>
It is possible to configure various aspects of Hibernate Envers behavior, such as table names, etc.
@ -300,7 +300,7 @@
When set to false, such column can be added to selected entities or properties using the
<literal>@Audited</literal> annotation.
For more information refer to <xref linkend="envers-tracking-properties-changes"/>
and <xref linkend="envers-envers-tracking-properties-changes-queries"/>.
and <xref linkend="envers-tracking-properties-changes-queries"/>.
</entry>
</row>
<row>
@ -480,7 +480,7 @@
class is inaccessible from <interfacename>@RevisionEntity</interfacename> (e.g. exists in a different
module), set <property>org.hibernate.envers.revision_listener</property> property to it's fully
qualified name. Class name defined by the configuration parameter overrides revision entity's
<methodname>value</methodname> attribute.
<methodname>value</methodname> attribute.
</para>
</listitem>
</orderedlist>
@ -621,7 +621,7 @@ public class AnnotatedTrackingRevisionEntity {
<interfacename>EntityTrackingRevisionListener</interfacename> interface exposes one method that notifies
whenever audited entity instance has been added, modified or removed within current revision boundaries.
</para>
<example>
<title>Custom implementation of tracking entity classes modified during revisions</title>
<programlisting>
@ -735,7 +735,7 @@ Set<ModifiedEntityTypeEntity> modifiedEntityTypes = revEntity.getModifiedEntityT
</para>
<para>
To see how "Modified Flags" can be utilized, check out the very
simple query API that uses them: <xref linkend="envers-envers-tracking-properties-changes-queries"/>.
simple query API that uses them: <xref linkend="envers-tracking-properties-changes-queries"/>.
</para>
</section>
@ -771,7 +771,7 @@ Set<ModifiedEntityTypeEntity> modifiedEntityTypes = revEntity.getModifiedEntityT
<para>
In the future, queries will be improved both in terms of speed and possibilities, when using the valid-time
audit strategy, that is when storing both start and end revisions for entities. See
<xref linkend="configuration"/>.
<xref linkend="envers-configuration"/>.
</para>
<section xml:id="entities-at-revision">
@ -929,7 +929,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
</section>
<section xml:id="envers-envers-tracking-properties-changes-queries">
<section xml:id="envers-tracking-properties-changes-queries">
<title>Querying for revisions of entity that modified given property</title>
@ -948,11 +948,10 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
Let's have a look at following examples:
</para>
<programlisting><![CDATA[
AuditQuery query = getAuditReader().createQuery()
.forRevisionsOfEntity(MyEntity.class, false, true)
.add(AuditEntity.id().eq(id));
.add(AuditEntity.property("actualDate").hasChanged())]]>
<programlisting><![CDATA[AuditQuery query = getAuditReader().createQuery()
.forRevisionsOfEntity(MyEntity.class, false, true)
.add(AuditEntity.id().eq(id));
.add(AuditEntity.property("actualDate").hasChanged())]]>
</programlisting>
<para>
@ -967,11 +966,10 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
can be used here in a normal way.
</para>
<programlisting><![CDATA[
AuditQuery query = getAuditReader().createQuery()
.forEntitiesAtRevision(MyEntity.class, revisionNumber)
.add(AuditEntity.property("prop1").hasChanged())
.add(AuditEntity.property("prop2").hasNotChanged());]]>
<programlisting><![CDATA[AuditQuery query = getAuditReader().createQuery()
.forEntitiesAtRevision(MyEntity.class, revisionNumber)
.add(AuditEntity.property("prop1").hasChanged())
.add(AuditEntity.property("prop2").hasNotChanged());]]>
</programlisting>
<para>
@ -991,11 +989,10 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
<literal>forEntitiesModifiedAtRevision</literal> query:
</para>
<programlisting><![CDATA[
AuditQuery query = getAuditReader().createQuery()
.forEntitiesModifiedAtRevision(MyEntity.class, revisionNumber)
.add(AuditEntity.property("prop1").hasChanged())
.add(AuditEntity.property("prop2").hasNotChanged());]]>
<programlisting><![CDATA[AuditQuery query = getAuditReader().createQuery()
.forEntitiesModifiedAtRevision(MyEntity.class, revisionNumber)
.add(AuditEntity.property("prop1").hasChanged())
.add(AuditEntity.property("prop2").hasNotChanged());]]>
</programlisting>
</section>
@ -1049,7 +1046,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
<title>Conditional auditing</title>
<para>
Envers persists audit data in reaction to various Hibernate events (e.g. post update, post insert, and
so on), using a series of even listeners from the <literal>org.hibernate.envers.event</literal>
so on), using a series of even listeners from the <literal>org.hibernate.envers.event.spi</literal>
package. By default, if the Envers jar is in the classpath, the event listeners are auto-registered with
Hibernate.
</para>
@ -1062,13 +1059,13 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
Turn off automatic Envers event listeners registration by setting the
<literal>hibernate.listeners.envers.autoRegister</literal> Hibernate property to
<literal>false</literal>.
</para>
</para>
</listitem>
<listitem>
<para>
Create subclasses for appropriate event listeners. For example, if you want to
conditionally audit entity insertions, extend the
<literal>org.hibernate.envers.eventEnversPostInsertEventListenerImpl</literal>
<literal>org.hibernate.envers.event.spi.EnversPostInsertEventListenerImpl</literal>
class. Place the conditional-auditing logic in the subclasses, call the super method if
auditing should be performed.
</para>
@ -1076,7 +1073,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
<listitem>
<para>
Create your own implementation of <literal>org.hibernate.integrator.spi.Integrator</literal>,
similar to <literal>org.hibernate.envers.event.EnversIntegrator</literal>. Use your event
similar to <literal>org.hibernate.envers.event.spi.EnversIntegrator</literal>. Use your event
listener classes instead of the default ones.
</para>
</listitem>
@ -1398,7 +1395,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
</para>
<para>
Optionally, you can also override the default values following properties:
Optionally, you can also override the default values using following properties:
</para>
<para>
<literal>org.hibernate.envers.audit_strategy_validity_end_rev_field_name</literal>
@ -1408,7 +1405,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
</para>
<para>
For more information, see <xref linkend="configuration"/>.
For more information, see <xref linkend="envers-configuration"/>.
</para>
</note>
</para>

View File

@ -27,9 +27,9 @@ import javax.persistence.EntityManager;
import org.hibernate.Session;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.event.EnversListener;
import org.hibernate.envers.event.spi.EnversListener;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.reader.AuditReaderImpl;
import org.hibernate.envers.internal.reader.AuditReaderImpl;
import org.hibernate.event.service.spi.EventListenerRegistry;
import org.hibernate.event.spi.EventType;
import org.hibernate.event.spi.PostInsertEventListener;

View File

@ -1,38 +0,0 @@
/*
* 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.ant;
import org.hibernate.cfg.Configuration;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.tool.ant.AnnotationConfigurationTask;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class AnnotationConfigurationTaskWithEnvers extends AnnotationConfigurationTask {
protected void doConfiguration(Configuration configuration) {
super.doConfiguration(configuration);
configuration.buildMappings();
AuditConfiguration.getFor(configuration);
}
}

View File

@ -1,38 +0,0 @@
/*
* 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.ant;
import org.hibernate.cfg.Configuration;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.tool.ant.ConfigurationTask;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ConfigurationTaskWithEnvers extends ConfigurationTask {
protected void doConfiguration(Configuration configuration) {
AuditConfiguration.getFor(configuration);
super.doConfiguration(configuration);
}
}

View File

@ -1,38 +0,0 @@
/*
* 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.ant;
import org.hibernate.cfg.Configuration;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.tool.ant.JPAConfigurationTask;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class JPAConfigurationTaskWithEnvers extends JPAConfigurationTask {
protected void doConfiguration(Configuration configuration) {
AuditConfiguration.getFor(configuration);
super.doConfiguration(configuration);
}
}

View File

@ -1,185 +0,0 @@
/*
* 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.configuration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.hibernate.envers.strategy.DefaultAuditStrategy;
import static org.hibernate.envers.tools.Tools.getProperty;
/**
* Configuration of versions entities - names of fields, entities and tables created to store versioning information.
* @author Adam Warski (adam at warski dot org)
* @author Stephanie Pau at Markit Group Plc
*/
public class AuditEntitiesConfiguration {
private final String auditTablePrefix;
private final String auditTableSuffix;
private final String auditStrategyName;
private final String originalIdPropName;
private final String revisionFieldName;
private final String revisionNumberPath;
private final String revisionPropBasePath;
private final String revisionTypePropName;
private final String revisionTypePropType;
private final String revisionInfoEntityName;
private final Map<String, String> customAuditTablesNames;
private final String revisionEndFieldName;
private final boolean revisionEndTimestampEnabled;
private final String revisionEndTimestampFieldName;
public AuditEntitiesConfiguration(Properties properties, String revisionInfoEntityName) {
this.revisionInfoEntityName = revisionInfoEntityName;
auditTablePrefix = getProperty(properties,
"org.hibernate.envers.audit_table_prefix",
"org.hibernate.envers.auditTablePrefix",
"");
auditTableSuffix = getProperty(properties,
"org.hibernate.envers.audit_table_suffix",
"org.hibernate.envers.auditTableSuffix",
"_AUD");
auditStrategyName = getProperty(properties,
"org.hibernate.envers.audit_strategy",
"org.hibernate.envers.audit_strategy",
DefaultAuditStrategy.class.getName());
originalIdPropName = "originalId";
revisionFieldName = getProperty(properties,
"org.hibernate.envers.revision_field_name",
"org.hibernate.envers.revisionFieldName",
"REV");
revisionTypePropName = getProperty(properties,
"org.hibernate.envers.revision_type_field_name",
"org.hibernate.envers.revisionTypeFieldName",
"REVTYPE");
revisionTypePropType = "byte";
revisionEndFieldName = getProperty(properties,
"org.hibernate.envers.audit_strategy_validity_end_rev_field_name",
"org.hibernate.envers.audit_strategy_valid_time_end_name",
"REVEND");
String revisionEndTimestampEnabledStr = getProperty(properties,
"org.hibernate.envers.audit_strategy_validity_store_revend_timestamp",
"org.hibernate.envers.audit_strategy_validity_store_revend_timestamp",
"false");
revisionEndTimestampEnabled = Boolean.parseBoolean(revisionEndTimestampEnabledStr);
if (revisionEndTimestampEnabled) {
revisionEndTimestampFieldName = getProperty(properties,
"org.hibernate.envers.audit_strategy_validity_revend_timestamp_field_name",
"org.hibernate.envers.audit_strategy_validity_revend_timestamp_field_name",
"REVEND_TSTMP");
} else {
revisionEndTimestampFieldName = null;
}
customAuditTablesNames = new HashMap<String, String>();
revisionNumberPath = originalIdPropName + "." + revisionFieldName + ".id";
revisionPropBasePath = originalIdPropName + "." + revisionFieldName + ".";
}
public String getOriginalIdPropName() {
return originalIdPropName;
}
public String getRevisionFieldName() {
return revisionFieldName;
}
public boolean isRevisionEndTimestampEnabled() {
return revisionEndTimestampEnabled;
}
public String getRevisionEndTimestampFieldName() {
return revisionEndTimestampFieldName;
}
public String getRevisionNumberPath() {
return revisionNumberPath;
}
/**
* @param propertyName Property of the revision entity.
* @return A path to the given property of the revision entity associated with an audit entity.
*/
public String getRevisionPropPath(String propertyName) {
return revisionPropBasePath + propertyName;
}
public String getRevisionTypePropName() {
return revisionTypePropName;
}
public String getRevisionTypePropType() {
return revisionTypePropType;
}
public String getRevisionInfoEntityName() {
return revisionInfoEntityName;
}
//
public void addCustomAuditTableName(String entityName, String tableName) {
customAuditTablesNames.put(entityName, tableName);
}
//
public String getAuditEntityName(String entityName) {
return auditTablePrefix + entityName + auditTableSuffix;
}
public String getAuditTableName(String entityName, String tableName) {
String customHistoryTableName = customAuditTablesNames.get(entityName);
if (customHistoryTableName == null) {
return auditTablePrefix + tableName + auditTableSuffix;
}
return customHistoryTableName;
}
public String getAuditStrategyName() {
return auditStrategyName;
}
public String getRevisionEndFieldName() {
return revisionEndFieldName;
}
}

View File

@ -0,0 +1,102 @@
package org.hibernate.envers.configuration;
import org.hibernate.envers.strategy.DefaultAuditStrategy;
/**
* Configuration property names.
*
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
public interface EnversSettings {
/**
* Triggers revision generation when not-owned relation field changes. Defaults to {@code true}.
*/
public static final String REVISION_ON_COLLECTION_CHANGE = "org.hibernate.envers.revision_on_collection_change";
/**
* Treats optimistic locking properties as unversioned. Defaults to {@code true}.
*/
public static final String DO_NOT_AUDIT_OPTIMISTIC_LOCKING_FIELD = "org.hibernate.envers.do_not_audit_optimistic_locking_field";
/**
* Indicates whether entity data should be stored during removal. Defaults to {@code false}.
*/
public static final String STORE_DATA_AT_DELETE = "org.hibernate.envers.store_data_at_delete";
/**
* Default name of the schema containing audit tables.
*/
public static final String DEFAULT_SCHEMA = "org.hibernate.envers.default_schema";
/**
* Default name of the catalog containing audit tables.
*/
public static final String DEFAULT_CATALOG = "org.hibernate.envers.default_catalog";
/**
* Track entity names that have been changed during each revision. Defaults to {@code false}.
*/
public static final String TRACK_ENTITIES_CHANGED_IN_REVISION = "org.hibernate.envers.track_entities_changed_in_revision";
/**
* Use revision entity with native identifier generator. Defaults to {@code true} for backward compatibility.
*/
public static final String USE_REVISION_ENTITY_WITH_NATIVE_ID = "org.hibernate.envers.use_revision_entity_with_native_id";
/**
* Globally activates modified properties flag feature. Defaults to {@code false}.
*/
public static final String GLOBAL_WITH_MODIFIED_FLAG = "org.hibernate.envers.global_with_modified_flag";
/**
* Suffix of modified flag columns. Defaults to {@literal _MOD}.
*/
public static final String MODIFIED_FLAG_SUFFIX = "org.hibernate.envers.modified_flag_suffix";
/**
* Fully qualified class name of user defined revision listener.
*/
public static final String REVISION_LISTENER = "org.hibernate.envers.revision_listener";
/**
* Audit table prefix. Empty by default.
*/
public static final String AUDIT_TABLE_PREFIX = "org.hibernate.envers.audit_table_prefix";
/**
* Audit table suffix. Defaults to {@literal _AUD}.
*/
public static final String AUDIT_TABLE_SUFFIX = "org.hibernate.envers.audit_table_suffix";
/**
* Audit strategy. Defaults to {@link DefaultAuditStrategy}.
*/
public static final String AUDIT_STRATEGY = "org.hibernate.envers.audit_strategy";
/**
* Revision field name. Defaults to {@literal REV}.
*/
public static final String REVISION_FIELD_NAME = "org.hibernate.envers.revision_field_name";
/**
* Revision type field name. Defaults to {@literal REVTYPE}.
*/
public static final String REVISION_TYPE_FIELD_NAME = "org.hibernate.envers.revision_type_field_name";
/**
* Column name that will hold the end revision number in audit entities. Defaults to {@literal REVEND}.
*/
public static final String AUDIT_STRATEGY_VALIDITY_END_REV_FIELD_NAME = "org.hibernate.envers.audit_strategy_validity_end_rev_field_name";
/**
* Store the timestamp of the end revision, until which the data was valid,
* in addition to the end revision itself. Defaults to {@code false}.
*/
public static final String AUDIT_STRATEGY_VALIDITY_STORE_REVEND_TIMESTAMP = "org.hibernate.envers.audit_strategy_validity_store_revend_timestamp";
/**
* Column name of the timestamp of the end revision until which the data was valid.
* Defaults to {@literal REVEND_TSTMP}.
*/
public static final String AUDIT_STRATEGY_VALIDITY_REVEND_TIMESTAMP_FIELD_NAME = "org.hibernate.envers.audit_strategy_validity_revend_timestamp_field_name";
}

View File

@ -1,198 +0,0 @@
/*
* 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.configuration;
import static org.hibernate.envers.tools.Tools.getProperty;
import java.util.Properties;
import org.hibernate.MappingException;
import org.hibernate.envers.RevisionListener;
import org.hibernate.internal.util.ReflectHelper;
/**
* @author Adam Warski (adam at warski dot org)
* @author Nicolas Doroskevich
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
* @author Michal Skowronek (mskowr at o2 dot pl)
*/
public class GlobalConfiguration {
public static final String GLOBAL_WITH_MODIFIED_FLAG_PROPERTY = "org.hibernate.envers.global_with_modified_flag";
public static final String MODIFIED_FLAG_SUFFIX_PROPERTY = "org.hibernate.envers.modified_flag_suffix";
public static final String DEFAULT_MODIFIED_FLAG_SUFFIX = "_MOD";
// Should a revision be generated when a not-owned relation field changes
private final boolean generateRevisionsForCollections;
// Should the optimistic locking property of an entity be considered unversioned
private final boolean doNotAuditOptimisticLockingField;
// Should entity data be stored when it is deleted
private final boolean storeDataAtDelete;
// The default name of the schema of audit tables.
private final String defaultSchemaName;
// The default name of the catalog of the audit tables.
private final String defaultCatalogName;
// Should Envers track (persist) entity names that have been changed during each revision.
private boolean trackEntitiesChangedInRevisionEnabled;
// Revision listener class name.
private final Class<? extends RevisionListener> revisionListenerClass;
// Should Envers use modified property flags by default
private boolean globalWithModifiedFlag;
// Indicates that user defined global behavior for modified flags feature
private boolean hasGlobalSettingForWithModifiedFlag;
// Suffix to be used for modified flags columns
private String modifiedFlagSuffix;
// Use revision entity with native id generator
private final boolean useRevisionEntityWithNativeId;
/*
Which operator to use in correlated subqueries (when we want a property to be equal to the result of
a correlated subquery, for example: e.p <operator> (select max(e2.p) where e2.p2 = e.p2 ...).
Normally, this should be "=". However, HSQLDB has an issue related to that, so as a workaround,
"in" is used. See {@link org.hibernate.envers.test.various.HsqlTest}.
*/
private final String correlatedSubqueryOperator;
public GlobalConfiguration(Properties properties) {
String generateRevisionsForCollectionsStr = getProperty(properties,
"org.hibernate.envers.revision_on_collection_change",
"org.hibernate.envers.revisionOnCollectionChange",
"true");
generateRevisionsForCollections = Boolean.parseBoolean(generateRevisionsForCollectionsStr);
String ignoreOptimisticLockingPropertyStr = getProperty(properties,
"org.hibernate.envers.do_not_audit_optimistic_locking_field",
"org.hibernate.envers.doNotAuditOptimisticLockingField",
"true");
doNotAuditOptimisticLockingField = Boolean.parseBoolean(ignoreOptimisticLockingPropertyStr);
String storeDataDeletedEntityStr = getProperty(properties,
"org.hibernate.envers.store_data_at_delete",
"org.hibernate.envers.storeDataAtDelete",
"false");
storeDataAtDelete = Boolean.parseBoolean(storeDataDeletedEntityStr);
defaultSchemaName = properties.getProperty("org.hibernate.envers.default_schema", null);
defaultCatalogName = properties.getProperty("org.hibernate.envers.default_catalog", null);
correlatedSubqueryOperator = "org.hibernate.dialect.HSQLDialect".equals(
properties.getProperty("hibernate.dialect")) ? "in" : "=";
String trackEntitiesChangedInRevisionEnabledStr = getProperty(properties,
"org.hibernate.envers.track_entities_changed_in_revision",
"org.hibernate.envers.track_entities_changed_in_revision",
"false");
trackEntitiesChangedInRevisionEnabled = Boolean.parseBoolean(trackEntitiesChangedInRevisionEnabledStr);
String useRevisionEntityWithNativeIdStr = getProperty(properties,
"org.hibernate.envers.use_revision_entity_with_native_id",
"org.hibernate.envers.use_revision_entity_with_native_id",
"true");
useRevisionEntityWithNativeId = Boolean.parseBoolean(useRevisionEntityWithNativeIdStr);
hasGlobalSettingForWithModifiedFlag =
properties.getProperty(GLOBAL_WITH_MODIFIED_FLAG_PROPERTY) != null;
String usingModifiedFlagStr = getProperty(properties,
GLOBAL_WITH_MODIFIED_FLAG_PROPERTY,
GLOBAL_WITH_MODIFIED_FLAG_PROPERTY,
"false");
globalWithModifiedFlag = Boolean.parseBoolean(usingModifiedFlagStr);
modifiedFlagSuffix =
getProperty(properties, MODIFIED_FLAG_SUFFIX_PROPERTY,
MODIFIED_FLAG_SUFFIX_PROPERTY,
DEFAULT_MODIFIED_FLAG_SUFFIX);
String revisionListenerClassName = properties.getProperty("org.hibernate.envers.revision_listener", null);
if (revisionListenerClassName != null) {
try {
revisionListenerClass = (Class<? extends RevisionListener>) ReflectHelper.classForName(revisionListenerClassName);
} catch (ClassNotFoundException e) {
throw new MappingException("Revision listener class not found: " + revisionListenerClassName + ".", e);
}
} else {
revisionListenerClass = null;
}
}
public boolean isGenerateRevisionsForCollections() {
return generateRevisionsForCollections;
}
public boolean isDoNotAuditOptimisticLockingField() {
return doNotAuditOptimisticLockingField;
}
public String getCorrelatedSubqueryOperator() {
return correlatedSubqueryOperator;
}
public boolean isStoreDataAtDelete() {
return storeDataAtDelete;
}
public String getDefaultSchemaName() {
return defaultSchemaName;
}
public String getDefaultCatalogName() {
return defaultCatalogName;
}
public boolean isTrackEntitiesChangedInRevisionEnabled() {
return trackEntitiesChangedInRevisionEnabled;
}
public void setTrackEntitiesChangedInRevisionEnabled(boolean trackEntitiesChangedInRevisionEnabled) {
this.trackEntitiesChangedInRevisionEnabled = trackEntitiesChangedInRevisionEnabled;
}
public Class<? extends RevisionListener> getRevisionListenerClass() {
return revisionListenerClass;
}
public boolean hasSettingForUsingModifiedFlag() {
return hasGlobalSettingForWithModifiedFlag;
}
public boolean isGlobalWithModifiedFlag() {
return globalWithModifiedFlag;
}
public String getModifiedFlagSuffix() {
return modifiedFlagSuffix;
}
public boolean isUseRevisionEntityWithNativeId() {
return useRevisionEntityWithNativeId;
}
}

View File

@ -0,0 +1,170 @@
/*
* 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.configuration.internal;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.hibernate.envers.configuration.EnversSettings;
import org.hibernate.envers.strategy.DefaultAuditStrategy;
import org.hibernate.internal.util.config.ConfigurationHelper;
/**
* Configuration of versions entities - names of fields, entities and tables created to store versioning information.
*
* @author Adam Warski (adam at warski dot org)
* @author Stephanie Pau at Markit Group Plc
*/
public class AuditEntitiesConfiguration {
private final String auditTablePrefix;
private final String auditTableSuffix;
private final String auditStrategyName;
private final String originalIdPropName;
private final String revisionFieldName;
private final String revisionNumberPath;
private final String revisionPropBasePath;
private final String revisionTypePropName;
private final String revisionTypePropType;
private final String revisionInfoEntityName;
private final Map<String, String> customAuditTablesNames;
private final String revisionEndFieldName;
private final boolean revisionEndTimestampEnabled;
private final String revisionEndTimestampFieldName;
public AuditEntitiesConfiguration(Properties properties, String revisionInfoEntityName) {
this.revisionInfoEntityName = revisionInfoEntityName;
auditTablePrefix = ConfigurationHelper.getString( EnversSettings.AUDIT_TABLE_PREFIX, properties, "" );
auditTableSuffix = ConfigurationHelper.getString( EnversSettings.AUDIT_TABLE_SUFFIX, properties, "_AUD" );
auditStrategyName = ConfigurationHelper.getString(
EnversSettings.AUDIT_STRATEGY, properties, DefaultAuditStrategy.class.getName()
);
originalIdPropName = "originalId";
revisionFieldName = ConfigurationHelper.getString( EnversSettings.REVISION_FIELD_NAME, properties, "REV" );
revisionTypePropName = ConfigurationHelper.getString(
EnversSettings.REVISION_TYPE_FIELD_NAME, properties, "REVTYPE"
);
revisionTypePropType = "byte";
revisionEndFieldName = ConfigurationHelper.getString(
EnversSettings.AUDIT_STRATEGY_VALIDITY_END_REV_FIELD_NAME, properties, "REVEND"
);
revisionEndTimestampEnabled = ConfigurationHelper.getBoolean(
EnversSettings.AUDIT_STRATEGY_VALIDITY_STORE_REVEND_TIMESTAMP, properties, false
);
if ( revisionEndTimestampEnabled ) {
revisionEndTimestampFieldName = ConfigurationHelper.getString(
EnversSettings.AUDIT_STRATEGY_VALIDITY_REVEND_TIMESTAMP_FIELD_NAME, properties, "REVEND_TSTMP"
);
}
else {
revisionEndTimestampFieldName = null;
}
customAuditTablesNames = new HashMap<String, String>();
revisionNumberPath = originalIdPropName + "." + revisionFieldName + ".id";
revisionPropBasePath = originalIdPropName + "." + revisionFieldName + ".";
}
public String getOriginalIdPropName() {
return originalIdPropName;
}
public String getRevisionFieldName() {
return revisionFieldName;
}
public boolean isRevisionEndTimestampEnabled() {
return revisionEndTimestampEnabled;
}
public String getRevisionEndTimestampFieldName() {
return revisionEndTimestampFieldName;
}
public String getRevisionNumberPath() {
return revisionNumberPath;
}
/**
* @param propertyName Property of the revision entity.
*
* @return A path to the given property of the revision entity associated with an audit entity.
*/
public String getRevisionPropPath(String propertyName) {
return revisionPropBasePath + propertyName;
}
public String getRevisionTypePropName() {
return revisionTypePropName;
}
public String getRevisionTypePropType() {
return revisionTypePropType;
}
public String getRevisionInfoEntityName() {
return revisionInfoEntityName;
}
public void addCustomAuditTableName(String entityName, String tableName) {
customAuditTablesNames.put( entityName, tableName );
}
public String getAuditEntityName(String entityName) {
return auditTablePrefix + entityName + auditTableSuffix;
}
public String getAuditTableName(String entityName, String tableName) {
final String customHistoryTableName = customAuditTablesNames.get( entityName );
if ( customHistoryTableName == null ) {
return auditTablePrefix + tableName + auditTableSuffix;
}
return customHistoryTableName;
}
public String getAuditStrategyName() {
return auditStrategyName;
}
public String getRevisionEndFieldName() {
return revisionEndFieldName;
}
}

View File

@ -1,4 +1,4 @@
package org.hibernate.envers.configuration;
package org.hibernate.envers.configuration.internal;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
@ -7,10 +7,10 @@ import java.util.Map;
import org.jboss.logging.Logger;
import org.hibernate.MappingException;
import org.hibernate.envers.configuration.metadata.reader.ClassAuditingData;
import org.hibernate.envers.configuration.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.configuration.internal.metadata.reader.ClassAuditingData;
import org.hibernate.envers.configuration.internal.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.internal.EnversMessageLogger;
import org.hibernate.envers.tools.MappingTools;
import org.hibernate.envers.internal.tools.MappingTools;
import org.hibernate.mapping.PersistentClass;
/**

View File

@ -21,7 +21,8 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration;
package org.hibernate.envers.configuration.internal;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
@ -39,16 +40,17 @@ import org.dom4j.io.XMLWriter;
import org.hibernate.MappingException;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.cfg.Configuration;
import org.hibernate.envers.configuration.metadata.AuditEntityNameRegister;
import org.hibernate.envers.configuration.metadata.AuditMetadataGenerator;
import org.hibernate.envers.configuration.metadata.EntityXmlMappingData;
import org.hibernate.envers.configuration.metadata.reader.AnnotationsMetadataReader;
import org.hibernate.envers.configuration.metadata.reader.ClassAuditingData;
import org.hibernate.envers.entities.EntitiesConfigurations;
import org.hibernate.envers.configuration.internal.metadata.AuditEntityNameRegister;
import org.hibernate.envers.configuration.internal.metadata.AuditMetadataGenerator;
import org.hibernate.envers.configuration.internal.metadata.EntityXmlMappingData;
import org.hibernate.envers.configuration.internal.metadata.reader.AnnotationsMetadataReader;
import org.hibernate.envers.configuration.internal.metadata.reader.ClassAuditingData;
import org.hibernate.envers.internal.entities.EntitiesConfigurations;
import org.hibernate.envers.internal.tools.StringTools;
import org.hibernate.envers.internal.tools.graph.GraphTopologicalSort;
import org.hibernate.envers.strategy.AuditStrategy;
import org.hibernate.envers.tools.StringTools;
import org.hibernate.envers.tools.graph.GraphTopologicalSort;
import org.hibernate.mapping.PersistentClass;
/**
@ -57,7 +59,7 @@ import org.hibernate.mapping.PersistentClass;
public class EntitiesConfigurator {
public EntitiesConfigurations configure(Configuration cfg, ReflectionManager reflectionManager,
GlobalConfiguration globalCfg, AuditEntitiesConfiguration verEntCfg,
AuditStrategy auditStrategy,
AuditStrategy auditStrategy, ClassLoaderService classLoaderService,
Document revisionInfoXmlMapping, Element revisionInfoRelationMapping) {
// Creating a name register to capture all audit entity names created.
AuditEntityNameRegister auditEntityNameRegister = new AuditEntityNameRegister();
@ -85,7 +87,7 @@ public class EntitiesConfigurator {
classesAuditingData.updateCalculatedFields();
AuditMetadataGenerator auditMetaGen = new AuditMetadataGenerator(cfg, globalCfg, verEntCfg, auditStrategy,
revisionInfoRelationMapping, auditEntityNameRegister);
classLoaderService, revisionInfoRelationMapping, auditEntityNameRegister);
// First pass
for (Map.Entry<PersistentClass, ClassAuditingData> pcDatasEntry : classesAuditingData.getAllClassAuditedData()) {

View File

@ -0,0 +1,184 @@
/*
* 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.configuration.internal;
import java.util.Properties;
import org.hibernate.MappingException;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.HSQLDialect;
import org.hibernate.envers.RevisionListener;
import org.hibernate.envers.configuration.EnversSettings;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.internal.util.config.ConfigurationHelper;
/**
* @author Adam Warski (adam at warski dot org)
* @author Nicolas Doroskevich
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
* @author Michal Skowronek (mskowr at o2 dot pl)
*/
public class GlobalConfiguration {
// Should a revision be generated when a not-owned relation field changes
private final boolean generateRevisionsForCollections;
// Should the optimistic locking property of an entity be considered unversioned
private final boolean doNotAuditOptimisticLockingField;
// Should entity data be stored when it is deleted
private final boolean storeDataAtDelete;
// The default name of the schema of audit tables.
private final String defaultSchemaName;
// The default name of the catalog of the audit tables.
private final String defaultCatalogName;
// Should Envers track (persist) entity names that have been changed during each revision.
private boolean trackEntitiesChangedInRevision;
// Revision listener class name.
private final Class<? extends RevisionListener> revisionListenerClass;
// Should Envers use modified property flags by default
private boolean globalWithModifiedFlag;
// Indicates that user defined global behavior for modified flags feature
private boolean hasGlobalSettingForWithModifiedFlag;
// Suffix to be used for modified flags columns
private String modifiedFlagSuffix;
// Use revision entity with native id generator
private final boolean useRevisionEntityWithNativeId;
/*
Which operator to use in correlated subqueries (when we want a property to be equal to the result of
a correlated subquery, for example: e.p <operator> (select max(e2.p) where e2.p2 = e.p2 ...).
Normally, this should be "=". However, HSQLDB has an issue related to that, so as a workaround,
"in" is used. See {@link org.hibernate.envers.test.various.HsqlTest}.
*/
private final String correlatedSubqueryOperator;
public GlobalConfiguration(Properties properties, ClassLoaderService classLoaderService) {
generateRevisionsForCollections = ConfigurationHelper.getBoolean(
EnversSettings.REVISION_ON_COLLECTION_CHANGE, properties, true
);
doNotAuditOptimisticLockingField = ConfigurationHelper.getBoolean(
EnversSettings.DO_NOT_AUDIT_OPTIMISTIC_LOCKING_FIELD, properties, true
);
storeDataAtDelete = ConfigurationHelper.getBoolean( EnversSettings.STORE_DATA_AT_DELETE, properties, false );
defaultSchemaName = properties.getProperty( EnversSettings.DEFAULT_SCHEMA, null );
defaultCatalogName = properties.getProperty( EnversSettings.DEFAULT_CATALOG, null );
correlatedSubqueryOperator = HSQLDialect.class.getName()
.equals( properties.get( Environment.DIALECT ) ) ? "in" : "=";
trackEntitiesChangedInRevision = ConfigurationHelper.getBoolean(
EnversSettings.TRACK_ENTITIES_CHANGED_IN_REVISION, properties, false
);
useRevisionEntityWithNativeId = ConfigurationHelper.getBoolean(
EnversSettings.USE_REVISION_ENTITY_WITH_NATIVE_ID, properties, true
);
hasGlobalSettingForWithModifiedFlag = properties.get( EnversSettings.GLOBAL_WITH_MODIFIED_FLAG ) != null;
globalWithModifiedFlag = ConfigurationHelper.getBoolean(
EnversSettings.GLOBAL_WITH_MODIFIED_FLAG, properties, false
);
modifiedFlagSuffix = ConfigurationHelper.getString(
EnversSettings.MODIFIED_FLAG_SUFFIX, properties, "_MOD"
);
String revisionListenerClassName = properties.getProperty( EnversSettings.REVISION_LISTENER, null );
if ( revisionListenerClassName != null ) {
try {
revisionListenerClass = ReflectionTools.loadClass( revisionListenerClassName, classLoaderService );
}
catch ( ClassLoadingException e ) {
throw new MappingException( "Revision listener class not found: " + revisionListenerClassName + ".", e );
}
}
else {
revisionListenerClass = null;
}
}
public boolean isGenerateRevisionsForCollections() {
return generateRevisionsForCollections;
}
public boolean isDoNotAuditOptimisticLockingField() {
return doNotAuditOptimisticLockingField;
}
public String getCorrelatedSubqueryOperator() {
return correlatedSubqueryOperator;
}
public boolean isStoreDataAtDelete() {
return storeDataAtDelete;
}
public String getDefaultSchemaName() {
return defaultSchemaName;
}
public String getDefaultCatalogName() {
return defaultCatalogName;
}
public boolean isTrackEntitiesChangedInRevision() {
return trackEntitiesChangedInRevision;
}
public void setTrackEntitiesChangedInRevision(boolean trackEntitiesChangedInRevision) {
this.trackEntitiesChangedInRevision = trackEntitiesChangedInRevision;
}
public Class<? extends RevisionListener> getRevisionListenerClass() {
return revisionListenerClass;
}
public boolean hasSettingForUsingModifiedFlag() {
return hasGlobalSettingForWithModifiedFlag;
}
public boolean isGlobalWithModifiedFlag() {
return globalWithModifiedFlag;
}
public String getModifiedFlagSuffix() {
return modifiedFlagSuffix;
}
public boolean isUseRevisionEntityWithNativeId() {
return useRevisionEntityWithNativeId;
}
}

View File

@ -21,14 +21,14 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration;
package org.hibernate.envers.configuration.internal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.hibernate.cfg.Configuration;
import org.hibernate.envers.tools.Tools;
import org.hibernate.envers.tools.graph.GraphDefiner;
import org.hibernate.envers.internal.tools.Tools;
import org.hibernate.envers.internal.tools.graph.GraphDefiner;
import org.hibernate.mapping.PersistentClass;
/**

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration;
package org.hibernate.envers.configuration.internal;
import java.util.Date;
import java.util.Iterator;
import java.util.Set;
@ -43,18 +43,18 @@ import org.hibernate.envers.RevisionEntity;
import org.hibernate.envers.RevisionListener;
import org.hibernate.envers.RevisionNumber;
import org.hibernate.envers.RevisionTimestamp;
import org.hibernate.envers.configuration.metadata.AuditTableData;
import org.hibernate.envers.configuration.metadata.MetadataTools;
import org.hibernate.envers.configuration.internal.metadata.AuditTableData;
import org.hibernate.envers.configuration.internal.metadata.MetadataTools;
import org.hibernate.envers.enhanced.SequenceIdRevisionEntity;
import org.hibernate.envers.enhanced.SequenceIdTrackingModifiedEntitiesRevisionEntity;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.revisioninfo.DefaultRevisionInfoGenerator;
import org.hibernate.envers.revisioninfo.DefaultTrackingModifiedEntitiesRevisionInfoGenerator;
import org.hibernate.envers.revisioninfo.ModifiedEntityNamesReader;
import org.hibernate.envers.revisioninfo.RevisionInfoGenerator;
import org.hibernate.envers.revisioninfo.RevisionInfoNumberReader;
import org.hibernate.envers.revisioninfo.RevisionInfoQueryCreator;
import org.hibernate.envers.tools.MutableBoolean;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.revisioninfo.DefaultRevisionInfoGenerator;
import org.hibernate.envers.internal.revisioninfo.DefaultTrackingModifiedEntitiesRevisionInfoGenerator;
import org.hibernate.envers.internal.revisioninfo.ModifiedEntityNamesReader;
import org.hibernate.envers.internal.revisioninfo.RevisionInfoGenerator;
import org.hibernate.envers.internal.revisioninfo.RevisionInfoNumberReader;
import org.hibernate.envers.internal.revisioninfo.RevisionInfoQueryCreator;
import org.hibernate.envers.internal.tools.MutableBoolean;
import org.hibernate.internal.util.xml.XMLHelper;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.type.LongType;
@ -106,7 +106,7 @@ public class RevisionInfoConfiguration {
revisionInfoTimestampType.getName(), true, false);
MetadataTools.addColumn(timestampProperty, "REVTSTMP", null, null, null, null, null, null, false);
if (globalCfg.isTrackEntitiesChangedInRevisionEnabled()) {
if (globalCfg.isTrackEntitiesChangedInRevision()) {
generateEntityNamesTrackingTableMapping(class_mapping, "modifiedEntityNames",
globalCfg.getDefaultSchemaName(), globalCfg.getDefaultCatalogName(),
"REVCHANGES", "REV", "ENTITYNAME", "string");
@ -297,7 +297,7 @@ public class RevisionInfoConfiguration {
revisionInfoClass = pc.getMappedClass();
Class<? extends RevisionListener> revisionListenerClass = getRevisionListenerClass(revisionEntity.value());
revisionInfoTimestampType = pc.getProperty(revisionInfoTimestampData.getName()).getType();
if (globalCfg.isTrackEntitiesChangedInRevisionEnabled()
if (globalCfg.isTrackEntitiesChangedInRevision()
|| (globalCfg.isUseRevisionEntityWithNativeId() && DefaultTrackingModifiedEntitiesRevisionEntity.class.isAssignableFrom(revisionInfoClass))
|| (!globalCfg.isUseRevisionEntityWithNativeId() && SequenceIdTrackingModifiedEntitiesRevisionEntity.class.isAssignableFrom(revisionInfoClass))
|| modifiedEntityNamesFound.isSet()) {
@ -306,7 +306,7 @@ public class RevisionInfoConfiguration {
revisionInfoGenerator = new DefaultTrackingModifiedEntitiesRevisionInfoGenerator(revisionInfoEntityName,
revisionInfoClass, revisionListenerClass, revisionInfoTimestampData, isTimestampAsDate(),
modifiedEntityNamesData);
globalCfg.setTrackEntitiesChangedInRevisionEnabled(true);
globalCfg.setTrackEntitiesChangedInRevision(true);
} else {
revisionInfoGenerator = new DefaultRevisionInfoGenerator(revisionInfoEntityName, revisionInfoClass,
revisionListenerClass, revisionInfoTimestampData, isTimestampAsDate());
@ -320,7 +320,7 @@ public class RevisionInfoConfiguration {
Class<? extends RevisionListener> revisionListenerClass = getRevisionListenerClass(RevisionListener.class);
if (revisionInfoGenerator == null) {
if (globalCfg.isTrackEntitiesChangedInRevisionEnabled()) {
if (globalCfg.isTrackEntitiesChangedInRevision()) {
revisionInfoClass = globalCfg.isUseRevisionEntityWithNativeId() ? DefaultTrackingModifiedEntitiesRevisionEntity.class
: SequenceIdTrackingModifiedEntitiesRevisionEntity.class;
revisionInfoEntityName = revisionInfoClass.getName();
@ -341,8 +341,8 @@ public class RevisionInfoConfiguration {
revisionInfoTimestampData.getName(), isTimestampAsDate()),
generateRevisionInfoRelationMapping(),
new RevisionInfoNumberReader(revisionInfoClass, revisionInfoIdData),
globalCfg.isTrackEntitiesChangedInRevisionEnabled() ? new ModifiedEntityNamesReader(revisionInfoClass, modifiedEntityNamesData)
: null,
globalCfg.isTrackEntitiesChangedInRevision() ? new ModifiedEntityNamesReader(revisionInfoClass, modifiedEntityNamesData)
: null,
revisionInfoEntityName, revisionInfoClass, revisionInfoTimestampData);
}
@ -363,67 +363,3 @@ public class RevisionInfoConfiguration {
return defaultListener;
}
}
class RevisionInfoConfigurationResult {
private final RevisionInfoGenerator revisionInfoGenerator;
private final Document revisionInfoXmlMapping;
private final RevisionInfoQueryCreator revisionInfoQueryCreator;
private final Element revisionInfoRelationMapping;
private final RevisionInfoNumberReader revisionInfoNumberReader;
private final ModifiedEntityNamesReader modifiedEntityNamesReader;
private final String revisionInfoEntityName;
private final Class<?> revisionInfoClass;
private final PropertyData revisionInfoTimestampData;
RevisionInfoConfigurationResult(RevisionInfoGenerator revisionInfoGenerator,
Document revisionInfoXmlMapping, RevisionInfoQueryCreator revisionInfoQueryCreator,
Element revisionInfoRelationMapping, RevisionInfoNumberReader revisionInfoNumberReader,
ModifiedEntityNamesReader modifiedEntityNamesReader, String revisionInfoEntityName,
Class<?> revisionInfoClass, PropertyData revisionInfoTimestampData) {
this.revisionInfoGenerator = revisionInfoGenerator;
this.revisionInfoXmlMapping = revisionInfoXmlMapping;
this.revisionInfoQueryCreator = revisionInfoQueryCreator;
this.revisionInfoRelationMapping = revisionInfoRelationMapping;
this.revisionInfoNumberReader = revisionInfoNumberReader;
this.modifiedEntityNamesReader = modifiedEntityNamesReader;
this.revisionInfoEntityName = revisionInfoEntityName;
this.revisionInfoClass = revisionInfoClass;
this.revisionInfoTimestampData = revisionInfoTimestampData;
}
public RevisionInfoGenerator getRevisionInfoGenerator() {
return revisionInfoGenerator;
}
public Document getRevisionInfoXmlMapping() {
return revisionInfoXmlMapping;
}
public RevisionInfoQueryCreator getRevisionInfoQueryCreator() {
return revisionInfoQueryCreator;
}
public Element getRevisionInfoRelationMapping() {
return revisionInfoRelationMapping;
}
public RevisionInfoNumberReader getRevisionInfoNumberReader() {
return revisionInfoNumberReader;
}
public String getRevisionInfoEntityName() {
return revisionInfoEntityName;
}
public Class<?> getRevisionInfoClass() {
return revisionInfoClass;
}
public PropertyData getRevisionInfoTimestampData() {
return revisionInfoTimestampData;
}
public ModifiedEntityNamesReader getModifiedEntityNamesReader() {
return modifiedEntityNamesReader;
}
}

View File

@ -0,0 +1,77 @@
package org.hibernate.envers.configuration.internal;
import org.dom4j.Document;
import org.dom4j.Element;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.revisioninfo.ModifiedEntityNamesReader;
import org.hibernate.envers.internal.revisioninfo.RevisionInfoGenerator;
import org.hibernate.envers.internal.revisioninfo.RevisionInfoNumberReader;
import org.hibernate.envers.internal.revisioninfo.RevisionInfoQueryCreator;
/**
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
public class RevisionInfoConfigurationResult {
private final RevisionInfoGenerator revisionInfoGenerator;
private final Document revisionInfoXmlMapping;
private final RevisionInfoQueryCreator revisionInfoQueryCreator;
private final Element revisionInfoRelationMapping;
private final RevisionInfoNumberReader revisionInfoNumberReader;
private final ModifiedEntityNamesReader modifiedEntityNamesReader;
private final String revisionInfoEntityName;
private final Class<?> revisionInfoClass;
private final PropertyData revisionInfoTimestampData;
RevisionInfoConfigurationResult(RevisionInfoGenerator revisionInfoGenerator,
Document revisionInfoXmlMapping, RevisionInfoQueryCreator revisionInfoQueryCreator,
Element revisionInfoRelationMapping, RevisionInfoNumberReader revisionInfoNumberReader,
ModifiedEntityNamesReader modifiedEntityNamesReader, String revisionInfoEntityName,
Class<?> revisionInfoClass, PropertyData revisionInfoTimestampData) {
this.revisionInfoGenerator = revisionInfoGenerator;
this.revisionInfoXmlMapping = revisionInfoXmlMapping;
this.revisionInfoQueryCreator = revisionInfoQueryCreator;
this.revisionInfoRelationMapping = revisionInfoRelationMapping;
this.revisionInfoNumberReader = revisionInfoNumberReader;
this.modifiedEntityNamesReader = modifiedEntityNamesReader;
this.revisionInfoEntityName = revisionInfoEntityName;
this.revisionInfoClass = revisionInfoClass;
this.revisionInfoTimestampData = revisionInfoTimestampData;
}
public RevisionInfoGenerator getRevisionInfoGenerator() {
return revisionInfoGenerator;
}
public Document getRevisionInfoXmlMapping() {
return revisionInfoXmlMapping;
}
public RevisionInfoQueryCreator getRevisionInfoQueryCreator() {
return revisionInfoQueryCreator;
}
public Element getRevisionInfoRelationMapping() {
return revisionInfoRelationMapping;
}
public RevisionInfoNumberReader getRevisionInfoNumberReader() {
return revisionInfoNumberReader;
}
public String getRevisionInfoEntityName() {
return revisionInfoEntityName;
}
public Class<?> getRevisionInfoClass() {
return revisionInfoClass;
}
public PropertyData getRevisionInfoTimestampData() {
return revisionInfoTimestampData;
}
public ModifiedEntityNamesReader getModifiedEntityNamesReader() {
return modifiedEntityNamesReader;
}
}

View File

@ -1,4 +1,4 @@
package org.hibernate.envers.configuration.metadata;
package org.hibernate.envers.configuration.internal.metadata;
import java.util.HashSet;
import java.util.Set;

View File

@ -21,7 +21,8 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration.metadata;
package org.hibernate.envers.configuration.internal.metadata;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@ -30,23 +31,24 @@ import org.dom4j.Element;
import org.jboss.logging.Logger;
import org.hibernate.MappingException;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.cfg.Configuration;
import org.hibernate.envers.RelationTargetAuditMode;
import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.configuration.GlobalConfiguration;
import org.hibernate.envers.configuration.metadata.reader.ClassAuditingData;
import org.hibernate.envers.configuration.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.entities.EntityConfiguration;
import org.hibernate.envers.entities.IdMappingData;
import org.hibernate.envers.entities.mapper.CompositeMapperBuilder;
import org.hibernate.envers.entities.mapper.ExtendedPropertyMapper;
import org.hibernate.envers.entities.mapper.MultiPropertyMapper;
import org.hibernate.envers.entities.mapper.SubclassPropertyMapper;
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
import org.hibernate.envers.configuration.internal.GlobalConfiguration;
import org.hibernate.envers.configuration.internal.metadata.reader.ClassAuditingData;
import org.hibernate.envers.configuration.internal.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.internal.EnversMessageLogger;
import org.hibernate.envers.internal.entities.EntityConfiguration;
import org.hibernate.envers.internal.entities.IdMappingData;
import org.hibernate.envers.internal.entities.mapper.CompositeMapperBuilder;
import org.hibernate.envers.internal.entities.mapper.ExtendedPropertyMapper;
import org.hibernate.envers.internal.entities.mapper.MultiPropertyMapper;
import org.hibernate.envers.internal.entities.mapper.SubclassPropertyMapper;
import org.hibernate.envers.internal.tools.StringTools;
import org.hibernate.envers.internal.tools.Triple;
import org.hibernate.envers.strategy.AuditStrategy;
import org.hibernate.envers.strategy.ValidityAuditStrategy;
import org.hibernate.envers.tools.StringTools;
import org.hibernate.envers.tools.Triple;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Join;
import org.hibernate.mapping.OneToOne;
@ -78,6 +80,7 @@ public final class AuditMetadataGenerator {
private final GlobalConfiguration globalCfg;
private final AuditEntitiesConfiguration verEntCfg;
private final AuditStrategy auditStrategy;
private final ClassLoaderService classLoaderService;
private final Element revisionInfoRelationMapping;
/*
@ -101,13 +104,14 @@ public final class AuditMetadataGenerator {
public AuditMetadataGenerator(Configuration cfg, GlobalConfiguration globalCfg,
AuditEntitiesConfiguration verEntCfg,
AuditStrategy auditStrategy,
AuditStrategy auditStrategy, ClassLoaderService classLoaderService,
Element revisionInfoRelationMapping,
AuditEntityNameRegister auditEntityNameRegister) {
this.cfg = cfg;
this.globalCfg = globalCfg;
this.verEntCfg = verEntCfg;
this.auditStrategy = auditStrategy;
this.classLoaderService = classLoaderService;
this.revisionInfoRelationMapping = revisionInfoRelationMapping;
this.basicMetadataGenerator = new BasicMetadataGenerator();
@ -143,7 +147,7 @@ public final class AuditMetadataGenerator {
void addRevisionType(Element any_mapping, Element any_mapping_end) {
Element revTypeProperty = MetadataTools.addProperty(any_mapping, verEntCfg.getRevisionTypePropName(),
verEntCfg.getRevisionTypePropType(), true, false);
revTypeProperty.addAttribute("type", "org.hibernate.envers.entities.RevisionTypeType");
revTypeProperty.addAttribute("type", "org.hibernate.envers.internal.entities.RevisionTypeType");
// Adding the end revision, if appropriate
addEndRevision(any_mapping_end);
@ -549,6 +553,10 @@ public final class AuditMetadataGenerator {
return auditStrategy;
}
ClassLoaderService getClassLoaderService() {
return classLoaderService;
}
AuditEntityNameRegister getAuditEntityNameRegister() {
return auditEntityNameRegister;
}

View File

@ -22,7 +22,7 @@
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration.metadata;
package org.hibernate.envers.configuration.internal.metadata;
/**

View File

@ -21,14 +21,14 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration.metadata;
package org.hibernate.envers.configuration.internal.metadata;
import java.util.Properties;
import org.dom4j.Element;
import org.hibernate.envers.configuration.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.entities.mapper.SimpleMapperBuilder;
import org.hibernate.envers.configuration.internal.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.internal.entities.mapper.SimpleMapperBuilder;
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Value;
import org.hibernate.type.BasicType;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration.metadata;
package org.hibernate.envers.configuration.internal.metadata;
import java.util.ArrayList;
import java.util.HashMap;
@ -41,45 +41,46 @@ import org.hibernate.MappingException;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.envers.ModificationStore;
import org.hibernate.envers.RelationTargetAuditMode;
import org.hibernate.envers.configuration.metadata.reader.AuditedPropertiesReader;
import org.hibernate.envers.configuration.metadata.reader.ComponentAuditedPropertiesReader;
import org.hibernate.envers.configuration.metadata.reader.ComponentAuditingData;
import org.hibernate.envers.configuration.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.entities.EntityConfiguration;
import org.hibernate.envers.entities.IdMappingData;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.entities.mapper.CompositeMapperBuilder;
import org.hibernate.envers.entities.mapper.MultiPropertyMapper;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.SinglePropertyMapper;
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.entities.mapper.relation.BasicCollectionMapper;
import org.hibernate.envers.entities.mapper.relation.CommonCollectionMapperData;
import org.hibernate.envers.entities.mapper.relation.ListCollectionMapper;
import org.hibernate.envers.entities.mapper.relation.MapCollectionMapper;
import org.hibernate.envers.entities.mapper.relation.MiddleComponentData;
import org.hibernate.envers.entities.mapper.relation.MiddleIdData;
import org.hibernate.envers.entities.mapper.relation.SortedMapCollectionMapper;
import org.hibernate.envers.entities.mapper.relation.SortedSetCollectionMapper;
import org.hibernate.envers.entities.mapper.relation.ToOneIdMapper;
import org.hibernate.envers.entities.mapper.relation.component.MiddleDummyComponentMapper;
import org.hibernate.envers.entities.mapper.relation.component.MiddleEmbeddableComponentMapper;
import org.hibernate.envers.entities.mapper.relation.component.MiddleMapKeyIdComponentMapper;
import org.hibernate.envers.entities.mapper.relation.component.MiddleMapKeyPropertyComponentMapper;
import org.hibernate.envers.entities.mapper.relation.component.MiddleRelatedComponentMapper;
import org.hibernate.envers.entities.mapper.relation.component.MiddleSimpleComponentMapper;
import org.hibernate.envers.entities.mapper.relation.component.MiddleStraightComponentMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.proxy.ListProxy;
import org.hibernate.envers.entities.mapper.relation.lazy.proxy.MapProxy;
import org.hibernate.envers.entities.mapper.relation.lazy.proxy.SetProxy;
import org.hibernate.envers.entities.mapper.relation.lazy.proxy.SortedMapProxy;
import org.hibernate.envers.entities.mapper.relation.lazy.proxy.SortedSetProxy;
import org.hibernate.envers.entities.mapper.relation.query.OneAuditEntityQueryGenerator;
import org.hibernate.envers.entities.mapper.relation.query.RelationQueryGenerator;
import org.hibernate.envers.configuration.internal.metadata.reader.AuditedPropertiesReader;
import org.hibernate.envers.configuration.internal.metadata.reader.ComponentAuditedPropertiesReader;
import org.hibernate.envers.configuration.internal.metadata.reader.ComponentAuditingData;
import org.hibernate.envers.configuration.internal.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.internal.EnversMessageLogger;
import org.hibernate.envers.tools.MappingTools;
import org.hibernate.envers.tools.StringTools;
import org.hibernate.envers.tools.Tools;
import org.hibernate.envers.internal.entities.EntityConfiguration;
import org.hibernate.envers.internal.entities.IdMappingData;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.entities.mapper.CompositeMapperBuilder;
import org.hibernate.envers.internal.entities.mapper.MultiPropertyMapper;
import org.hibernate.envers.internal.entities.mapper.PropertyMapper;
import org.hibernate.envers.internal.entities.mapper.SinglePropertyMapper;
import org.hibernate.envers.internal.entities.mapper.id.IdMapper;
import org.hibernate.envers.internal.entities.mapper.relation.BasicCollectionMapper;
import org.hibernate.envers.internal.entities.mapper.relation.CommonCollectionMapperData;
import org.hibernate.envers.internal.entities.mapper.relation.ListCollectionMapper;
import org.hibernate.envers.internal.entities.mapper.relation.MapCollectionMapper;
import org.hibernate.envers.internal.entities.mapper.relation.MiddleComponentData;
import org.hibernate.envers.internal.entities.mapper.relation.MiddleIdData;
import org.hibernate.envers.internal.entities.mapper.relation.SortedMapCollectionMapper;
import org.hibernate.envers.internal.entities.mapper.relation.SortedSetCollectionMapper;
import org.hibernate.envers.internal.entities.mapper.relation.ToOneIdMapper;
import org.hibernate.envers.internal.entities.mapper.relation.component.MiddleDummyComponentMapper;
import org.hibernate.envers.internal.entities.mapper.relation.component.MiddleEmbeddableComponentMapper;
import org.hibernate.envers.internal.entities.mapper.relation.component.MiddleMapKeyIdComponentMapper;
import org.hibernate.envers.internal.entities.mapper.relation.component.MiddleMapKeyPropertyComponentMapper;
import org.hibernate.envers.internal.entities.mapper.relation.component.MiddleRelatedComponentMapper;
import org.hibernate.envers.internal.entities.mapper.relation.component.MiddleSimpleComponentMapper;
import org.hibernate.envers.internal.entities.mapper.relation.component.MiddleStraightComponentMapper;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.proxy.ListProxy;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.proxy.MapProxy;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.proxy.SetProxy;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.proxy.SortedMapProxy;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.proxy.SortedSetProxy;
import org.hibernate.envers.internal.entities.mapper.relation.query.OneAuditEntityQueryGenerator;
import org.hibernate.envers.internal.entities.mapper.relation.query.RelationQueryGenerator;
import org.hibernate.envers.internal.tools.MappingTools;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.envers.internal.tools.StringTools;
import org.hibernate.envers.internal.tools.Tools;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.IndexedCollection;
@ -125,8 +126,7 @@ public final class CollectionMetadataGenerator {
/**
* @param mainGenerator Main generator, giving access to configuration and the basic mapper.
* @param propertyValue Value of the collection, as mapped by Hibernate.
* @param currentMapper Mapper, to which the appropriate {@link org.hibernate.envers.entities.mapper.PropertyMapper}
* will be added.
* @param currentMapper Mapper, to which the appropriate {@link PropertyMapper} will be added.
* @param referencingEntityName Name of the entity that owns this collection.
* @param xmlMappingData In case this collection requires a middle table, additional mapping documents will
* be created using this object.
@ -474,7 +474,8 @@ public final class CollectionMetadataGenerator {
} else if ( type instanceof ComponentType ) {
// Collection of embeddable elements.
final Component component = (Component) value;
final MiddleEmbeddableComponentMapper componentMapper = new MiddleEmbeddableComponentMapper( new MultiPropertyMapper(), component.getComponentClassName() );
final Class componentClass = ReflectionTools.loadClass( component.getComponentClassName(), mainGenerator.getClassLoaderService() );
final MiddleEmbeddableComponentMapper componentMapper = new MiddleEmbeddableComponentMapper( new MultiPropertyMapper(), componentClass );
final Element parentXmlMapping = xmlMapping.getParent();
final ComponentAuditingData auditData = new ComponentAuditingData();

View File

@ -1,11 +1,13 @@
package org.hibernate.envers.configuration.metadata;
package org.hibernate.envers.configuration.internal.metadata;
import java.util.Iterator;
import org.dom4j.Element;
import org.hibernate.envers.configuration.metadata.reader.ComponentAuditingData;
import org.hibernate.envers.configuration.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.entities.mapper.CompositeMapperBuilder;
import org.hibernate.envers.configuration.internal.metadata.reader.ComponentAuditingData;
import org.hibernate.envers.configuration.internal.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.internal.entities.mapper.CompositeMapperBuilder;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Value;
@ -27,8 +29,8 @@ public final class ComponentMetadataGenerator {
EntityXmlMappingData xmlMappingData, boolean firstPass) {
Component prop_component = (Component) value;
CompositeMapperBuilder componentMapper = mapper.addComponent(propertyAuditingData.getPropertyData(),
prop_component.getComponentClassName());
Class componentClass = ReflectionTools.loadClass( prop_component.getComponentClassName(), mainGenerator.getClassLoaderService() );
CompositeMapperBuilder componentMapper = mapper.addComponent( propertyAuditingData.getPropertyData(), componentClass );
// The property auditing data must be for a component.
ComponentAuditingData componentAuditingData = (ComponentAuditingData) propertyAuditingData;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration.metadata;
package org.hibernate.envers.configuration.internal.metadata;
import java.util.ArrayList;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration.metadata;
package org.hibernate.envers.configuration.internal.metadata;
import java.util.Iterator;
import org.dom4j.Element;
@ -30,14 +30,15 @@ import org.dom4j.tree.DefaultElement;
import org.hibernate.MappingException;
import org.hibernate.envers.ModificationStore;
import org.hibernate.envers.RelationTargetAuditMode;
import org.hibernate.envers.configuration.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.entities.IdMappingData;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.entities.mapper.SimpleMapperBuilder;
import org.hibernate.envers.entities.mapper.id.EmbeddedIdMapper;
import org.hibernate.envers.entities.mapper.id.MultipleIdMapper;
import org.hibernate.envers.entities.mapper.id.SimpleIdMapperBuilder;
import org.hibernate.envers.entities.mapper.id.SingleIdMapper;
import org.hibernate.envers.configuration.internal.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.internal.entities.IdMappingData;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.entities.mapper.SimpleMapperBuilder;
import org.hibernate.envers.internal.entities.mapper.id.EmbeddedIdMapper;
import org.hibernate.envers.internal.entities.mapper.id.MultipleIdMapper;
import org.hibernate.envers.internal.entities.mapper.id.SimpleIdMapperBuilder;
import org.hibernate.envers.internal.entities.mapper.id.SingleIdMapper;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
@ -108,7 +109,10 @@ public final class IdMetadataGenerator {
if (id_mapper != null) {
// Multiple id
mapper = new MultipleIdMapper(((Component) pc.getIdentifier()).getComponentClassName());
Class componentClass = ReflectionTools.loadClass(
( (Component) pc.getIdentifier() ).getComponentClassName(), mainGenerator.getClassLoaderService()
);
mapper = new MultipleIdMapper( componentClass );
if (!addIdProperties(rel_id_mapping, (Iterator<Property>) id_mapper.getPropertyIterator(), mapper, false, audited)) {
return null;
}
@ -121,8 +125,10 @@ public final class IdMetadataGenerator {
// Embedded id
Component id_component = (Component) id_prop.getValue();
mapper = new EmbeddedIdMapper(getIdPropertyData(id_prop), id_component.getComponentClassName());
Class embeddableClass = ReflectionTools.loadClass(
id_component.getComponentClassName(), mainGenerator.getClassLoaderService()
);
mapper = new EmbeddedIdMapper( getIdPropertyData(id_prop), embeddableClass );
if (!addIdProperties(rel_id_mapping, (Iterator<Property>) id_component.getPropertyIterator(), mapper, false, audited)) {
return null;
}

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration.metadata;
package org.hibernate.envers.configuration.internal.metadata;
import org.hibernate.MappingException;
import org.hibernate.mapping.JoinedSubclass;
import org.hibernate.mapping.PersistentClass;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration.metadata;
package org.hibernate.envers.configuration.internal.metadata;
import java.util.Iterator;
import javax.persistence.JoinColumn;
@ -29,7 +29,7 @@ import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.Element;
import org.hibernate.envers.tools.StringTools;
import org.hibernate.envers.internal.tools.StringTools;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Formula;

View File

@ -21,20 +21,20 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration.metadata;
package org.hibernate.envers.configuration.internal.metadata;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.MappingException;
import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.configuration.GlobalConfiguration;
import org.hibernate.envers.entities.mapper.relation.MiddleComponentData;
import org.hibernate.envers.entities.mapper.relation.MiddleIdData;
import org.hibernate.envers.entities.mapper.relation.query.OneEntityQueryGenerator;
import org.hibernate.envers.entities.mapper.relation.query.RelationQueryGenerator;
import org.hibernate.envers.entities.mapper.relation.query.ThreeEntityQueryGenerator;
import org.hibernate.envers.entities.mapper.relation.query.TwoEntityOneAuditedQueryGenerator;
import org.hibernate.envers.entities.mapper.relation.query.TwoEntityQueryGenerator;
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
import org.hibernate.envers.configuration.internal.GlobalConfiguration;
import org.hibernate.envers.internal.entities.mapper.relation.MiddleComponentData;
import org.hibernate.envers.internal.entities.mapper.relation.MiddleIdData;
import org.hibernate.envers.internal.entities.mapper.relation.query.OneEntityQueryGenerator;
import org.hibernate.envers.internal.entities.mapper.relation.query.RelationQueryGenerator;
import org.hibernate.envers.internal.entities.mapper.relation.query.ThreeEntityQueryGenerator;
import org.hibernate.envers.internal.entities.mapper.relation.query.TwoEntityOneAuditedQueryGenerator;
import org.hibernate.envers.internal.entities.mapper.relation.query.TwoEntityQueryGenerator;
import org.hibernate.envers.strategy.AuditStrategy;
/**

View File

@ -21,20 +21,20 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration.metadata;
package org.hibernate.envers.configuration.internal.metadata;
import org.dom4j.Element;
import org.hibernate.MappingException;
import org.hibernate.envers.configuration.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.entities.EntityConfiguration;
import org.hibernate.envers.entities.IdMappingData;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.entities.mapper.CompositeMapperBuilder;
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.entities.mapper.relation.OneToOneNotOwningMapper;
import org.hibernate.envers.entities.mapper.relation.OneToOnePrimaryKeyJoinColumnMapper;
import org.hibernate.envers.entities.mapper.relation.ToOneIdMapper;
import org.hibernate.envers.tools.MappingTools;
import org.hibernate.envers.configuration.internal.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.internal.entities.EntityConfiguration;
import org.hibernate.envers.internal.entities.IdMappingData;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.entities.mapper.CompositeMapperBuilder;
import org.hibernate.envers.internal.entities.mapper.id.IdMapper;
import org.hibernate.envers.internal.entities.mapper.relation.OneToOneNotOwningMapper;
import org.hibernate.envers.internal.entities.mapper.relation.OneToOnePrimaryKeyJoinColumnMapper;
import org.hibernate.envers.internal.entities.mapper.relation.ToOneIdMapper;
import org.hibernate.envers.internal.tools.MappingTools;
import org.hibernate.mapping.OneToOne;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration.metadata.reader;
package org.hibernate.envers.configuration.internal.metadata.reader;
import java.lang.annotation.Annotation;
import java.util.Iterator;
@ -33,7 +33,7 @@ import org.hibernate.envers.Audited;
import org.hibernate.envers.ModificationStore;
import org.hibernate.envers.SecondaryAuditTable;
import org.hibernate.envers.SecondaryAuditTables;
import org.hibernate.envers.configuration.GlobalConfiguration;
import org.hibernate.envers.configuration.internal.GlobalConfiguration;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;

View File

@ -1,4 +1,4 @@
package org.hibernate.envers.configuration.metadata.reader;
package org.hibernate.envers.configuration.internal.metadata.reader;
/**

View File

@ -1,4 +1,5 @@
package org.hibernate.envers.configuration.metadata.reader;
package org.hibernate.envers.configuration.internal.metadata.reader;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.Collections;
@ -23,24 +24,22 @@ import org.hibernate.envers.Audited;
import org.hibernate.envers.ModificationStore;
import org.hibernate.envers.NotAudited;
import org.hibernate.envers.RelationTargetAuditMode;
import org.hibernate.envers.configuration.GlobalConfiguration;
import org.hibernate.envers.configuration.metadata.MetadataTools;
import org.hibernate.envers.tools.MappingTools;
import org.hibernate.envers.tools.StringTools;
import org.hibernate.envers.tools.Tools;
import org.hibernate.envers.configuration.internal.GlobalConfiguration;
import org.hibernate.envers.configuration.internal.metadata.MetadataTools;
import org.hibernate.envers.internal.tools.MappingTools;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.envers.internal.tools.StringTools;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Value;
import static org.hibernate.envers.tools.Tools.newHashMap;
import static org.hibernate.envers.tools.Tools.newHashSet;
import static org.hibernate.envers.internal.tools.Tools.newHashMap;
import static org.hibernate.envers.internal.tools.Tools.newHashSet;
/**
* Reads persistent properties form a
* {@link org.hibernate.envers.configuration.metadata.reader.PersistentPropertiesSource}
* and adds the ones that are audited to a
* {@link org.hibernate.envers.configuration.metadata.reader.AuditedPropertiesHolder},
* filling all the auditing data.
* Reads persistent properties form a {@link PersistentPropertiesSource} and adds the ones that are audited to a
* {@link AuditedPropertiesHolder}, filling all the auditing data.
*
* @author Adam Warski (adam at warski dot org)
* @author Erik-Berndt Scheper
* @author Hern&aacut;n Chanfreau
@ -201,7 +200,7 @@ public class AuditedPropertiesReader {
* @return Property object.
*/
private XProperty getProperty(XClass clazz, String propertyName) {
XProperty property = Tools.getProperty(clazz, propertyName);
XProperty property = ReflectionTools.getProperty(clazz, propertyName);
if (property == null) {
throw new MappingException("Property '" + propertyName + "' not found in class " + clazz.getName() + ". " +
"Please revise Envers annotations applied to class " + persistentPropertiesSource.getXClass() + ".");
@ -478,7 +477,7 @@ public class AuditedPropertiesReader {
}
/***
* Add the {@link org.hibernate.envers.AuditOverride} annotations.
* Add the {@link AuditOverride} annotations.
*
* @param property the property being processed
* @param propertyData the Envers auditing data for this property
@ -495,10 +494,10 @@ public class AuditedPropertiesReader {
}
/**
* Process the {@link org.hibernate.envers.AuditOverride} annotations for this property.
* Process the {@link AuditOverride} annotations for this property.
*
* @param property
* the property for which the {@link org.hibernate.envers.AuditOverride}
* the property for which the {@link AuditOverride}
* annotations are being processed
* @param propertyData
* the Envers auditing data for this property

View File

@ -21,12 +21,12 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration.metadata.reader;
package org.hibernate.envers.configuration.internal.metadata.reader;
import java.util.Map;
import org.hibernate.envers.AuditTable;
import static org.hibernate.envers.tools.Tools.newHashMap;
import static org.hibernate.envers.internal.tools.Tools.newHashMap;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -1,9 +1,9 @@
package org.hibernate.envers.configuration.metadata.reader;
package org.hibernate.envers.configuration.internal.metadata.reader;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XProperty;
import org.hibernate.envers.Audited;
import org.hibernate.envers.ModificationStore;
import org.hibernate.envers.configuration.GlobalConfiguration;
import org.hibernate.envers.configuration.internal.GlobalConfiguration;
/**
* Reads the audited properties for components.

View File

@ -22,11 +22,11 @@
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.envers.configuration.metadata.reader;
package org.hibernate.envers.configuration.internal.metadata.reader;
import java.util.Map;
import java.util.Set;
import static org.hibernate.envers.tools.Tools.newHashMap;
import static org.hibernate.envers.internal.tools.Tools.newHashMap;
/**
* Audit mapping meta-data for component.

View File

@ -1,4 +1,4 @@
package org.hibernate.envers.configuration.metadata.reader;
package org.hibernate.envers.configuration.internal.metadata.reader;
import java.util.Iterator;
import org.hibernate.annotations.common.reflection.XClass;

View File

@ -22,7 +22,7 @@
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.envers.configuration.metadata.reader;
package org.hibernate.envers.configuration.internal.metadata.reader;
import java.util.ArrayList;
import java.util.List;
@ -31,7 +31,7 @@ import org.hibernate.envers.AuditOverride;
import org.hibernate.envers.AuditOverrides;
import org.hibernate.envers.ModificationStore;
import org.hibernate.envers.RelationTargetAuditMode;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.internal.entities.PropertyData;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.configuration;
package org.hibernate.envers.configuration.spi;
import java.util.Map;
import java.util.Properties;
@ -29,19 +29,24 @@ import java.util.WeakHashMap;
import org.hibernate.MappingException;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.cfg.Configuration;
import org.hibernate.envers.entities.EntitiesConfigurations;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.revisioninfo.ModifiedEntityNamesReader;
import org.hibernate.envers.revisioninfo.RevisionInfoNumberReader;
import org.hibernate.envers.revisioninfo.RevisionInfoQueryCreator;
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
import org.hibernate.envers.configuration.internal.EntitiesConfigurator;
import org.hibernate.envers.configuration.internal.GlobalConfiguration;
import org.hibernate.envers.configuration.internal.RevisionInfoConfiguration;
import org.hibernate.envers.configuration.internal.RevisionInfoConfigurationResult;
import org.hibernate.envers.internal.entities.EntitiesConfigurations;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.revisioninfo.ModifiedEntityNamesReader;
import org.hibernate.envers.internal.revisioninfo.RevisionInfoNumberReader;
import org.hibernate.envers.internal.revisioninfo.RevisionInfoQueryCreator;
import org.hibernate.envers.internal.synchronization.AuditProcessManager;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.envers.strategy.AuditStrategy;
import org.hibernate.envers.strategy.ValidityAuditStrategy;
import org.hibernate.envers.synchronization.AuditProcessManager;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.property.Getter;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
/**
* @author Adam Warski (adam at warski dot org)
@ -90,6 +95,10 @@ public class AuditConfiguration {
return auditStrategy;
}
public ClassLoaderService getClassLoaderService() {
return classLoaderService;
}
public AuditConfiguration(Configuration cfg) {
this( cfg, null );
}
@ -98,7 +107,7 @@ public class AuditConfiguration {
Properties properties = cfg.getProperties();
ReflectionManager reflectionManager = cfg.getReflectionManager();
globalCfg = new GlobalConfiguration( properties );
globalCfg = new GlobalConfiguration( properties, classLoaderService );
RevisionInfoConfiguration revInfoCfg = new RevisionInfoConfiguration( globalCfg );
RevisionInfoConfigurationResult revInfoCfgResult = revInfoCfg.configure( cfg, reflectionManager );
auditEntCfg = new AuditEntitiesConfiguration( properties, revInfoCfgResult.getRevisionInfoEntityName() );
@ -112,7 +121,7 @@ public class AuditConfiguration {
revInfoCfgResult.getRevisionInfoTimestampData()
);
entCfg = new EntitiesConfigurator().configure(
cfg, reflectionManager, globalCfg, auditEntCfg, auditStrategy,
cfg, reflectionManager, globalCfg, auditEntCfg, auditStrategy, classLoaderService,
revInfoCfgResult.getRevisionInfoXmlMapping(), revInfoCfgResult.getRevisionInfoRelationMapping()
);
}
@ -121,15 +130,7 @@ public class AuditConfiguration {
AuditStrategy strategy;
try {
Class<?> auditStrategyClass = null;
if ( classLoaderService != null ) {
auditStrategyClass = classLoaderService.classForName( auditEntCfg.getAuditStrategyName() );
}
else {
auditStrategyClass = ReflectHelper.classForName( auditEntCfg.getAuditStrategyName() );
}
Class<?> auditStrategyClass = ReflectionTools.loadClass( auditEntCfg.getAuditStrategyName(), classLoaderService );
strategy = (AuditStrategy) ReflectHelper.getDefaultConstructor(auditStrategyClass).newInstance();
}
catch ( Exception e ) {
@ -150,8 +151,7 @@ public class AuditConfiguration {
//
private static Map<Configuration, AuditConfiguration> cfgs
= new WeakHashMap<Configuration, AuditConfiguration>();
private static Map<Configuration, AuditConfiguration> cfgs = new WeakHashMap<Configuration, AuditConfiguration>();
public synchronized static AuditConfiguration getFor(Configuration cfg) {
return getFor( cfg, null );

View File

@ -23,18 +23,18 @@
*/
package org.hibernate.envers.enhanced;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.envers.RevisionNumber;
import org.hibernate.envers.RevisionTimestamp;
import java.io.Serializable;
import java.text.DateFormat;
import java.util.Date;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import java.io.Serializable;
import java.text.DateFormat;
import java.util.Date;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.envers.RevisionNumber;
import org.hibernate.envers.RevisionTimestamp;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -23,14 +23,19 @@
*/
package org.hibernate.envers.enhanced;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.MappedSuperclass;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.envers.ModifiedEntityNames;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
/**
* Extension of standard {@link SequenceIdRevisionEntity} that allows tracking entity names changed in each revision.
* This revision entity is implicitly used when {@code org.hibernate.envers.track_entities_changed_in_revision}

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.event;
package org.hibernate.envers.event.spi;
import java.io.Serializable;
import java.util.List;
@ -30,16 +30,16 @@ import java.util.Set;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.CollectionEntry;
import org.hibernate.envers.RevisionType;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.EntityConfiguration;
import org.hibernate.envers.entities.RelationDescription;
import org.hibernate.envers.entities.mapper.PersistentCollectionChangeData;
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.synchronization.AuditProcess;
import org.hibernate.envers.synchronization.work.AuditWorkUnit;
import org.hibernate.envers.synchronization.work.CollectionChangeWorkUnit;
import org.hibernate.envers.synchronization.work.FakeBidirectionalRelationWorkUnit;
import org.hibernate.envers.synchronization.work.PersistentCollectionChangeWorkUnit;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.entities.EntityConfiguration;
import org.hibernate.envers.internal.entities.RelationDescription;
import org.hibernate.envers.internal.entities.mapper.PersistentCollectionChangeData;
import org.hibernate.envers.internal.entities.mapper.id.IdMapper;
import org.hibernate.envers.internal.synchronization.AuditProcess;
import org.hibernate.envers.internal.synchronization.work.AuditWorkUnit;
import org.hibernate.envers.internal.synchronization.work.CollectionChangeWorkUnit;
import org.hibernate.envers.internal.synchronization.work.FakeBidirectionalRelationWorkUnit;
import org.hibernate.envers.internal.synchronization.work.PersistentCollectionChangeWorkUnit;
import org.hibernate.event.spi.AbstractCollectionEvent;
import org.hibernate.persister.collection.AbstractCollectionPersister;

View File

@ -21,20 +21,20 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.event;
package org.hibernate.envers.event.spi;
import java.io.Serializable;
import java.util.Set;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.RelationDescription;
import org.hibernate.envers.entities.RelationType;
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.synchronization.AuditProcess;
import org.hibernate.envers.synchronization.work.CollectionChangeWorkUnit;
import org.hibernate.envers.tools.Tools;
import org.hibernate.envers.internal.entities.RelationDescription;
import org.hibernate.envers.internal.entities.RelationType;
import org.hibernate.envers.internal.entities.mapper.id.IdMapper;
import org.hibernate.envers.internal.synchronization.AuditProcess;
import org.hibernate.envers.internal.synchronization.work.CollectionChangeWorkUnit;
import org.hibernate.envers.internal.tools.EntityTools;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.proxy.HibernateProxy;
@ -84,7 +84,7 @@ public abstract class BaseEnversEventListener implements EnversListener {
Object oldValue = oldState == null ? null : oldState[i];
Object newValue = newState == null ? null : newState[i];
if (!Tools.entitiesEqual( session, relDesc.getToEntityName(), oldValue, newValue )) {
if (!EntityTools.entitiesEqual( session, relDesc.getToEntityName(), oldValue, newValue )) {
// We have to generate changes both in the old collection (size decreses) and new collection
// (size increases).
if (newValue != null) {
@ -111,7 +111,7 @@ public abstract class BaseEnversEventListener implements EnversListener {
toEntityName = session.bestGuessEntityName(value);
id = hibernateProxy.getHibernateLazyInitializer().getIdentifier();
// We've got to initialize the object from the proxy to later read its state.
value = Tools.getTargetFromProxy(session.getFactory(), hibernateProxy);
value = EntityTools.getTargetFromProxy(session.getFactory(), hibernateProxy);
} else {
toEntityName = session.guessEntityName(value);

View File

@ -21,20 +21,20 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.event;
package org.hibernate.envers.event.spi;
import org.jboss.logging.Logger;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.cfg.Configuration;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.event.service.spi.EventListenerRegistry;
import org.hibernate.event.spi.EventType;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
/**

View File

@ -21,9 +21,9 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.event;
package org.hibernate.envers.event.spi;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
/**
* Marker interface for Envers listeners for duplication handling.

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.event;
package org.hibernate.envers.event.spi;
import org.hibernate.event.service.spi.DuplicationStrategy;

View File

@ -21,10 +21,10 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.event;
package org.hibernate.envers.event.spi;
import org.hibernate.engine.spi.CollectionEntry;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.event.spi.PostCollectionRecreateEvent;
import org.hibernate.event.spi.PostCollectionRecreateEventListener;

View File

@ -21,12 +21,12 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.event;
package org.hibernate.envers.event.spi;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.synchronization.AuditProcess;
import org.hibernate.envers.synchronization.work.AuditWorkUnit;
import org.hibernate.envers.synchronization.work.DelWorkUnit;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.synchronization.AuditProcess;
import org.hibernate.envers.internal.synchronization.work.AuditWorkUnit;
import org.hibernate.envers.internal.synchronization.work.DelWorkUnit;
import org.hibernate.event.spi.PostDeleteEvent;
import org.hibernate.event.spi.PostDeleteEventListener;
import org.hibernate.persister.entity.EntityPersister;

View File

@ -21,12 +21,12 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.event;
package org.hibernate.envers.event.spi;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.synchronization.AuditProcess;
import org.hibernate.envers.synchronization.work.AddWorkUnit;
import org.hibernate.envers.synchronization.work.AuditWorkUnit;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.synchronization.AuditProcess;
import org.hibernate.envers.internal.synchronization.work.AddWorkUnit;
import org.hibernate.envers.internal.synchronization.work.AuditWorkUnit;
import org.hibernate.event.spi.PostInsertEvent;
import org.hibernate.event.spi.PostInsertEventListener;
import org.hibernate.persister.entity.EntityPersister;

View File

@ -21,12 +21,12 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.event;
package org.hibernate.envers.event.spi;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.synchronization.AuditProcess;
import org.hibernate.envers.synchronization.work.AuditWorkUnit;
import org.hibernate.envers.synchronization.work.ModWorkUnit;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.synchronization.AuditProcess;
import org.hibernate.envers.internal.synchronization.work.AuditWorkUnit;
import org.hibernate.envers.internal.synchronization.work.ModWorkUnit;
import org.hibernate.event.spi.PostUpdateEvent;
import org.hibernate.event.spi.PostUpdateEventListener;
import org.hibernate.persister.entity.EntityPersister;

View File

@ -21,12 +21,12 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.event;
package org.hibernate.envers.event.spi;
import java.io.Serializable;
import org.hibernate.engine.spi.CollectionEntry;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.event.spi.PreCollectionRemoveEvent;
import org.hibernate.event.spi.PreCollectionRemoveEventListener;

View File

@ -21,10 +21,10 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.event;
package org.hibernate.envers.event.spi;
import org.hibernate.engine.spi.CollectionEntry;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.event.spi.PreCollectionUpdateEvent;
import org.hibernate.event.spi.PreCollectionUpdateEventListener;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities;
package org.hibernate.envers.internal.entities;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;

View File

@ -21,13 +21,13 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities;
package org.hibernate.envers.internal.entities;
import java.util.HashMap;
import java.util.Map;
import org.hibernate.envers.entities.mapper.ExtendedPropertyMapper;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.internal.entities.mapper.ExtendedPropertyMapper;
import org.hibernate.envers.internal.entities.mapper.PropertyMapper;
import org.hibernate.envers.internal.entities.mapper.id.IdMapper;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,23 +21,24 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities;
import org.hibernate.envers.RevisionType;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.ToOneDelegateSessionImplementor;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.LazyInitializer;
package org.hibernate.envers.internal.entities;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.hibernate.envers.RevisionType;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.internal.entities.mapper.id.IdMapper;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.ToOneDelegateSessionImplementor;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.LazyInitializer;
/**
* @author Adam Warski (adam at warski dot org)
* @author Hern&aacute;n Chanfreau
@ -96,7 +97,7 @@ public class EntityInstantiator {
entCfg = verCfg.getEntCfg().getNotVersionEntityConfiguration(entityName);
}
Class<?> cls = ReflectHelper.classForName(entCfg.getEntityClassName());
Class<?> cls = ReflectionTools.loadClass( entCfg.getEntityClassName(), verCfg.getClassLoaderService() );
ret = ReflectHelper.getDefaultConstructor(cls).newInstance();
} catch (Exception e) {
throw new AuditException(e);
@ -128,13 +129,7 @@ public class EntityInstantiator {
final Serializable entityId = initializer.getIdentifier();
if (verCfg.getEntCfg().isVersioned(entityName)) {
final String entityClassName = verCfg.getEntCfg().get(entityName).getEntityClassName();
Class entityClass;
try {
entityClass = ReflectHelper.classForName(entityClassName);
}
catch ( ClassNotFoundException e ) {
throw new AuditException( e );
}
final Class entityClass = ReflectionTools.loadClass( entityClassName, verCfg.getClassLoaderService() );
final ToOneDelegateSessionImplementor delegate = new ToOneDelegateSessionImplementor(
versionsReader, entityClass, entityId, revision,
RevisionType.DEL.equals( versionsEntity.get( verCfg.getAuditEntCfg().getRevisionTypePropName() ) ),

View File

@ -21,10 +21,10 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities;
package org.hibernate.envers.internal.entities;
import org.dom4j.Element;
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.internal.entities.mapper.id.IdMapper;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities;
package org.hibernate.envers.internal.entities;
import org.hibernate.envers.ModificationStore;
/**

View File

@ -21,9 +21,9 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.id.IdMapper;
package org.hibernate.envers.internal.entities;
import org.hibernate.envers.internal.entities.mapper.PropertyMapper;
import org.hibernate.envers.internal.entities.mapper.id.IdMapper;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities;
package org.hibernate.envers.internal.entities;
/**

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities;
package org.hibernate.envers.internal.entities;
import java.io.Serializable;
import java.sql.PreparedStatement;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper;
package org.hibernate.envers.internal.entities.mapper;
import java.io.Serializable;
import java.util.HashMap;
@ -30,11 +30,11 @@ import java.util.Map;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.property.Setter;
@ -45,20 +45,20 @@ import org.hibernate.property.Setter;
public class ComponentPropertyMapper implements PropertyMapper, CompositeMapperBuilder {
private final PropertyData propertyData;
private final MultiPropertyMapper delegate;
private final String componentClassName;
private final Class componentClass;
public ComponentPropertyMapper(PropertyData propertyData, String componentClassName) {
public ComponentPropertyMapper(PropertyData propertyData, Class componentClass) {
this.propertyData = propertyData;
this.delegate = new MultiPropertyMapper();
this.componentClassName = componentClassName;
this.componentClass = componentClass;
}
public void add(PropertyData propertyData) {
delegate.add(propertyData);
}
public CompositeMapperBuilder addComponent(PropertyData propertyData, String componentClassName) {
return delegate.addComponent(propertyData, componentClassName);
public CompositeMapperBuilder addComponent(PropertyData propertyData, Class componentClass) {
return delegate.addComponent(propertyData, componentClass);
}
public void addComposite(PropertyData propertyData, PropertyMapper propertyMapper) {
@ -120,8 +120,7 @@ public class ComponentPropertyMapper implements PropertyMapper, CompositeMapperB
} else {
// set the component
try {
Object subObj = ReflectHelper.getDefaultConstructor(
ReflectHelper.classForName(componentClassName)).newInstance();
Object subObj = ReflectHelper.getDefaultConstructor(componentClass).newInstance();
setter.set(obj, subObj, null);
delegate.mapToEntityFromMap(verCfg, subObj, data, primaryKey, versionsReader, revision);
} catch (Exception e) {

View File

@ -21,17 +21,17 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper;
package org.hibernate.envers.internal.entities.mapper;
import java.util.Map;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.internal.entities.PropertyData;
/**
* @author Adam Warski (adam at warski dot org)
*/
public interface CompositeMapperBuilder extends SimpleMapperBuilder {
public CompositeMapperBuilder addComponent(PropertyData propertyData, String componentClassName);
public CompositeMapperBuilder addComponent(PropertyData propertyData, Class componentClass);
public void addComposite(PropertyData propertyData, PropertyMapper propertyMapper);
public Map<PropertyData, PropertyMapper> getProperties();
}

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper;
package org.hibernate.envers.internal.entities.mapper;
import java.util.Map;
import org.hibernate.engine.spi.SessionImplementor;

View File

@ -21,20 +21,21 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper;
package org.hibernate.envers.internal.entities.mapper;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.MappingTools;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
import org.hibernate.envers.internal.tools.MappingTools;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.envers.internal.tools.Tools;
import org.hibernate.envers.tools.Pair;
import org.hibernate.envers.tools.Tools;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.property.Getter;
/**
@ -57,13 +58,13 @@ public class MultiPropertyMapper implements ExtendedPropertyMapper {
propertyDatas.put(propertyData.getName(), propertyData);
}
public CompositeMapperBuilder addComponent(PropertyData propertyData, String componentClassName) {
public CompositeMapperBuilder addComponent(PropertyData propertyData, Class componentClass) {
if (properties.get(propertyData) != null) {
// This is needed for second pass to work properly in the components mapper
return (CompositeMapperBuilder) properties.get(propertyData);
}
ComponentPropertyMapper componentMapperBuilder = new ComponentPropertyMapper(propertyData, componentClassName);
ComponentPropertyMapper componentMapperBuilder = new ComponentPropertyMapper(propertyData, componentClass);
addComposite(propertyData, componentMapperBuilder);
return componentMapperBuilder;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper;
package org.hibernate.envers.internal.entities.mapper;
import java.util.Map;
import org.hibernate.envers.tools.Pair;

View File

@ -21,15 +21,15 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper;
package org.hibernate.envers.internal.entities.mapper;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,8 +21,8 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper;
import org.hibernate.envers.entities.PropertyData;
package org.hibernate.envers.internal.entities.mapper;
import org.hibernate.envers.internal.entities.PropertyData;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,7 +21,8 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper;
package org.hibernate.envers.internal.entities.mapper;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@ -30,13 +31,13 @@ import org.hibernate.HibernateException;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.StringTools;
import org.hibernate.envers.tools.Tools;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.envers.internal.tools.StringTools;
import org.hibernate.envers.internal.tools.Tools;
import org.hibernate.property.DirectPropertyAccessor;
import org.hibernate.property.Setter;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper;
package org.hibernate.envers.internal.entities.mapper;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
@ -29,9 +29,9 @@ import java.util.Map;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
/**
* A mapper which maps from a parent mapper and a "main" one, but adds only to the "main". The "main" mapper
@ -98,8 +98,8 @@ public class SubclassPropertyMapper implements ExtendedPropertyMapper {
}
}
public CompositeMapperBuilder addComponent(PropertyData propertyData, String componentClassName) {
return main.addComponent(propertyData, componentClassName);
public CompositeMapperBuilder addComponent(PropertyData propertyData, Class componentClass) {
return main.addComponent(propertyData, componentClass);
}
public void addComposite(PropertyData propertyData, PropertyMapper propertyMapper) {

View File

@ -21,12 +21,13 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.id;
package org.hibernate.envers.internal.entities.mapper.id;
import java.util.Map;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.tools.Tools;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.tools.Tools;
import org.hibernate.internal.util.ReflectHelper;
/**
@ -35,11 +36,10 @@ import org.hibernate.internal.util.ReflectHelper;
*/
public abstract class AbstractCompositeIdMapper extends AbstractIdMapper implements SimpleIdMapperBuilder {
protected Map<PropertyData, SingleIdMapper> ids;
protected String compositeIdClass;
protected Class compositeIdClass;
protected AbstractCompositeIdMapper(String compositeIdClass) {
protected AbstractCompositeIdMapper(Class compositeIdClass) {
ids = Tools.newLinkedHashMap();
this.compositeIdClass = compositeIdClass;
}
@ -54,8 +54,7 @@ public abstract class AbstractCompositeIdMapper extends AbstractIdMapper impleme
Object ret;
try {
final Class clazz = ReflectHelper.classForName(compositeIdClass);
ret = ReflectHelper.getDefaultConstructor(clazz).newInstance();
ret = ReflectHelper.getDefaultConstructor(compositeIdClass).newInstance();
} catch (Exception e) {
throw new AuditException(e);
}

View File

@ -21,11 +21,11 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.id;
package org.hibernate.envers.internal.entities.mapper.id;
import java.util.Iterator;
import java.util.List;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.internal.tools.query.Parameters;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,16 +21,16 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.id;
package org.hibernate.envers.internal.entities.mapper.id;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.property.Getter;
import org.hibernate.property.Setter;
@ -41,7 +41,7 @@ import org.hibernate.property.Setter;
public class EmbeddedIdMapper extends AbstractCompositeIdMapper implements SimpleIdMapperBuilder {
private PropertyData idPropertyData;
public EmbeddedIdMapper(PropertyData idPropertyData, String compositeIdClass) {
public EmbeddedIdMapper(PropertyData idPropertyData, Class compositeIdClass) {
super(compositeIdClass);
this.idPropertyData = idPropertyData;

View File

@ -21,11 +21,11 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.id;
package org.hibernate.envers.internal.entities.mapper.id;
import java.util.List;
import java.util.Map;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.internal.tools.query.Parameters;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,21 +21,22 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.id;
package org.hibernate.envers.internal.entities.mapper.id;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.internal.util.ReflectHelper;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class MultipleIdMapper extends AbstractCompositeIdMapper implements SimpleIdMapperBuilder {
public MultipleIdMapper(String compositeIdClass) {
public MultipleIdMapper(Class compositeIdClass) {
super(compositeIdClass);
}
@ -76,8 +77,7 @@ public class MultipleIdMapper extends AbstractCompositeIdMapper implements Simpl
Object ret;
try {
final Class clazz = ReflectHelper.classForName(compositeIdClass);
ret = ReflectHelper.getDefaultConstructor(clazz).newInstance();
ret = ReflectHelper.getDefaultConstructor(compositeIdClass).newInstance();
} catch (Exception e) {
throw new AuditException(e);
}

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.id;
package org.hibernate.envers.internal.entities.mapper.id;
import org.hibernate.Query;
/**

View File

@ -21,8 +21,8 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.id;
import org.hibernate.envers.entities.mapper.SimpleMapperBuilder;
package org.hibernate.envers.internal.entities.mapper.id;
import org.hibernate.envers.internal.entities.mapper.SimpleMapperBuilder;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,14 +21,15 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.id;
package org.hibernate.envers.internal.entities.mapper.id;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.property.Getter;
import org.hibernate.property.Setter;
import org.hibernate.proxy.HibernateProxy;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation;
package org.hibernate.envers.internal.entities.mapper.relation;
import java.io.Serializable;
import java.lang.reflect.Constructor;
@ -37,15 +37,15 @@ import java.util.Set;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.RevisionType;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.entities.mapper.PersistentCollectionChangeData;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.Tools;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.entities.mapper.PersistentCollectionChangeData;
import org.hibernate.envers.internal.entities.mapper.PropertyMapper;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.envers.internal.tools.Tools;
import org.hibernate.property.Setter;
/**

View File

@ -1,4 +1,4 @@
package org.hibernate.envers.entities.mapper.relation;
package org.hibernate.envers.internal.entities.mapper.relation;
import java.io.Serializable;
import java.util.Map;
@ -6,10 +6,10 @@ import javax.persistence.NoResultException;
import org.hibernate.NonUniqueResultException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
/**
* Template class for property mappers that manage one-to-one relation.

View File

@ -1,4 +1,4 @@
package org.hibernate.envers.entities.mapper.relation;
package org.hibernate.envers.internal.entities.mapper.relation;
import java.io.Serializable;
import java.util.List;
@ -6,15 +6,13 @@ import java.util.Map;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.EntityConfiguration;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.entities.mapper.PersistentCollectionChangeData;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.entities.EntityConfiguration;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.entities.mapper.PersistentCollectionChangeData;
import org.hibernate.envers.internal.entities.mapper.PropertyMapper;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.property.Setter;
/**
@ -61,13 +59,7 @@ public abstract class AbstractToOneMapper implements PropertyMapper {
entCfg = verCfg.getEntCfg().getNotVersionEntityConfiguration(entityName);
isRelationAudited = false;
}
Class entityClass;
try {
entityClass = ReflectHelper.classForName(entCfg.getEntityClassName());
}
catch ( ClassNotFoundException e ) {
throw new AuditException( e );
}
Class entityClass = ReflectionTools.loadClass( entCfg.getEntityClassName(), verCfg.getClassLoaderService() );
return new EntityInfo(entityClass, entityName, isRelationAudited);
}

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation;
package org.hibernate.envers.internal.entities.mapper.relation;
import java.io.Serializable;
import java.util.Collection;
@ -29,11 +29,11 @@ import java.util.Map;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.BasicCollectionInitializor;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.entities.mapper.PropertyMapper;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.initializor.BasicCollectionInitializor;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,10 +21,10 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation;
import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.entities.mapper.relation.query.RelationQueryGenerator;
package org.hibernate.envers.internal.entities.mapper.relation;
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.entities.mapper.relation.query.RelationQueryGenerator;
/**
* Data that is used by all collection mappers, regardless of the type.

View File

@ -21,7 +21,8 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation;
package org.hibernate.envers.internal.entities.mapper.relation;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
@ -29,14 +30,14 @@ import java.util.Map;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.ListCollectionInitializor;
import org.hibernate.envers.entities.mapper.relation.lazy.proxy.ListProxy;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.entities.mapper.PropertyMapper;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.initializor.ListCollectionInitializor;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.proxy.ListProxy;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
import org.hibernate.envers.internal.tools.Tools;
import org.hibernate.envers.tools.Pair;
import org.hibernate.envers.tools.Tools;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation;
package org.hibernate.envers.internal.entities.mapper.relation;
import java.io.Serializable;
import java.util.Collection;
@ -29,11 +29,11 @@ import java.util.Map;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.MapCollectionInitializor;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.entities.mapper.PropertyMapper;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.initializor.MapCollectionInitializor;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,8 +21,8 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation;
import org.hibernate.envers.entities.mapper.relation.component.MiddleComponentMapper;
package org.hibernate.envers.internal.entities.mapper.relation;
import org.hibernate.envers.internal.entities.mapper.relation.component.MiddleComponentMapper;
/**
* A data holder for a middle relation component (which is either the collection element or index):

View File

@ -21,10 +21,10 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation;
import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.IdMappingData;
import org.hibernate.envers.entities.mapper.id.IdMapper;
package org.hibernate.envers.internal.entities.mapper.relation;
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
import org.hibernate.envers.internal.entities.IdMappingData;
import org.hibernate.envers.internal.entities.mapper.id.IdMapper;
/**
* A class holding information about ids, which form a virtual "relation" from a middle-table. Middle-tables are used

View File

@ -21,14 +21,14 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation;
package org.hibernate.envers.internal.entities.mapper.relation;
import java.io.Serializable;
import javax.persistence.OneToOne;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
import org.hibernate.envers.query.AuditEntity;
import org.hibernate.envers.reader.AuditReaderImplementor;
/**
* Property mapper for not owning side of {@link OneToOne} relation.

View File

@ -1,13 +1,13 @@
package org.hibernate.envers.entities.mapper.relation;
package org.hibernate.envers.internal.entities.mapper.relation;
import java.io.Serializable;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import org.hibernate.envers.Audited;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
import org.hibernate.envers.query.AuditEntity;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.persister.entity.EntityPersister;
/**

View File

@ -21,15 +21,15 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation;
package org.hibernate.envers.internal.entities.mapper.relation;
import java.util.Comparator;
import java.util.SortedMap;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.SortedMapCollectionInitializor;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.initializor.SortedMapCollectionInitializor;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
/**
* @author Michal Skowronek (mskowr at o2 dot pl)

View File

@ -21,15 +21,15 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation;
package org.hibernate.envers.internal.entities.mapper.relation;
import java.util.Comparator;
import java.util.SortedSet;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.entities.mapper.relation.lazy.initializor.SortedSetCollectionInitializor;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.initializor.Initializor;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.initializor.SortedSetCollectionInitializor;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
/**
* @author Michal Skowronek (mskowr at o2 dot pl)

View File

@ -1,10 +1,10 @@
package org.hibernate.envers.entities.mapper.relation;
package org.hibernate.envers.internal.entities.mapper.relation;
import java.io.Serializable;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.relation.lazy.ToOneDelegateSessionImplementor;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.entities.mapper.relation.lazy.ToOneDelegateSessionImplementor;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
import org.hibernate.persister.entity.EntityPersister;
/**

View File

@ -21,22 +21,19 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation;
package org.hibernate.envers.internal.entities.mapper.relation;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.RevisionType;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.ToOneDelegateSessionImplementor;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.Tools;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.entities.mapper.id.IdMapper;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
import org.hibernate.envers.internal.tools.EntityTools;
import org.hibernate.envers.internal.tools.query.Parameters;
/**
* @author Adam Warski (adam at warski dot org)
@ -86,7 +83,7 @@ public class ToOneIdMapper extends AbstractToOneMapper {
protected boolean checkModified(SessionImplementor session, Object newObj, Object oldObj) {
//noinspection SimplifiableConditionalExpression
return nonInsertableFake ? false : !Tools.entitiesEqual(session, referencedEntityName, newObj, oldObj);
return nonInsertableFake ? false : !EntityTools.entitiesEqual(session, referencedEntityName, newObj, oldObj);
}
public void nullSafeMapToEntityFromMap(AuditConfiguration verCfg, Object obj, Map data, Object primaryKey,

View File

@ -21,15 +21,13 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation.component;
package org.hibernate.envers.internal.entities.mapper.relation.component;
import java.util.Map;
import javax.persistence.ElementCollection;
import javax.persistence.Embeddable;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.entities.EntityInstantiator;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.internal.entities.EntityInstantiator;
import org.hibernate.envers.internal.tools.query.Parameters;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,12 +21,12 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation.component;
package org.hibernate.envers.internal.entities.mapper.relation.component;
import java.util.Map;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.entities.EntityInstantiator;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.internal.entities.EntityInstantiator;
import org.hibernate.envers.internal.tools.query.Parameters;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,19 +21,19 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation.component;
package org.hibernate.envers.internal.entities.mapper.relation.component;
import java.util.Map;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.entities.EntityInstantiator;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.entities.mapper.CompositeMapperBuilder;
import org.hibernate.envers.entities.mapper.MultiPropertyMapper;
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.relation.ToOneIdMapper;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.internal.entities.EntityInstantiator;
import org.hibernate.envers.internal.entities.PropertyData;
import org.hibernate.envers.internal.entities.mapper.CompositeMapperBuilder;
import org.hibernate.envers.internal.entities.mapper.MultiPropertyMapper;
import org.hibernate.envers.internal.entities.mapper.PropertyMapper;
import org.hibernate.envers.internal.entities.mapper.relation.ToOneIdMapper;
import org.hibernate.envers.internal.tools.query.Parameters;
import org.hibernate.internal.util.ReflectHelper;
/**
@ -43,14 +43,9 @@ public class MiddleEmbeddableComponentMapper implements MiddleComponentMapper, C
private final MultiPropertyMapper delegate;
private final Class componentClass;
public MiddleEmbeddableComponentMapper(MultiPropertyMapper delegate, String componentClassName) {
public MiddleEmbeddableComponentMapper(MultiPropertyMapper delegate, Class componentClass) {
this.delegate = delegate;
try {
componentClass = Thread.currentThread().getContextClassLoader().loadClass( componentClassName );
}
catch ( Exception e ) {
throw new AuditException( e );
}
this.componentClass = componentClass;
}
@Override
@ -95,8 +90,8 @@ public class MiddleEmbeddableComponentMapper implements MiddleComponentMapper, C
}
@Override
public CompositeMapperBuilder addComponent(PropertyData propertyData, String componentClassName) {
return delegate.addComponent( propertyData, componentClassName );
public CompositeMapperBuilder addComponent(PropertyData propertyData, Class componentClass) {
return delegate.addComponent( propertyData, componentClass );
}
@Override

View File

@ -21,14 +21,14 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation.component;
package org.hibernate.envers.internal.entities.mapper.relation.component;
import java.util.Map;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.EntityInstantiator;
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
import org.hibernate.envers.internal.entities.EntityInstantiator;
import org.hibernate.envers.internal.entities.mapper.id.IdMapper;
import org.hibernate.envers.internal.tools.query.Parameters;
/**
* A component mapper for the @MapKey mapping: the value of the map's key is the id of the entity. This

View File

@ -21,13 +21,14 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation.component;
package org.hibernate.envers.internal.entities.mapper.relation.component;
import java.util.Map;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.entities.EntityInstantiator;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.envers.internal.entities.EntityInstantiator;
import org.hibernate.envers.internal.tools.ReflectionTools;
import org.hibernate.envers.internal.tools.query.Parameters;
/**
* A component mapper for the @MapKey mapping with the name parameter specified: the value of the map's key

View File

@ -21,13 +21,13 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation.component;
package org.hibernate.envers.internal.entities.mapper.relation.component;
import java.util.Map;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.entities.EntityInstantiator;
import org.hibernate.envers.entities.mapper.relation.MiddleIdData;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.internal.entities.EntityInstantiator;
import org.hibernate.envers.internal.entities.mapper.relation.MiddleIdData;
import org.hibernate.envers.internal.tools.query.Parameters;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,13 +21,13 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation.component;
package org.hibernate.envers.internal.entities.mapper.relation.component;
import java.util.Map;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
import org.hibernate.envers.entities.EntityInstantiator;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
import org.hibernate.envers.internal.entities.EntityInstantiator;
import org.hibernate.envers.internal.tools.query.Parameters;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,12 +21,12 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation.component;
package org.hibernate.envers.internal.entities.mapper.relation.component;
import java.util.Map;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.entities.EntityInstantiator;
import org.hibernate.envers.tools.query.Parameters;
import org.hibernate.envers.internal.entities.EntityInstantiator;
import org.hibernate.envers.internal.tools.query.Parameters;
/**
* A mapper for reading and writing a property straight to/from maps. This mapper cannot be used with middle tables,

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation.lazy;
package org.hibernate.envers.internal.entities.mapper.relation.lazy;
import java.io.Serializable;
import java.sql.Connection;

View File

@ -21,14 +21,12 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation.lazy;
import java.io.Serializable;
package org.hibernate.envers.internal.entities.mapper.relation.lazy;
import org.hibernate.HibernateException;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.EntitiesConfigurations;
import org.hibernate.envers.entities.mapper.relation.ToOneEntityLoader;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.entities.mapper.relation.ToOneEntityLoader;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
/**
* @author Adam Warski (adam at warski dot org)

View File

@ -21,13 +21,13 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.entities.mapper.relation.lazy.initializor;
package org.hibernate.envers.internal.entities.mapper.relation.lazy.initializor;
import java.util.List;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.EntityInstantiator;
import org.hibernate.envers.entities.mapper.relation.query.RelationQueryGenerator;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.configuration.spi.AuditConfiguration;
import org.hibernate.envers.internal.entities.EntityInstantiator;
import org.hibernate.envers.internal.entities.mapper.relation.query.RelationQueryGenerator;
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
/**
* Initializes a persistent collection.

Some files were not shown because too many files have changed in this diff Show More