HHH-3939:
- not creating a join table when the association is not audited git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@16702 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
4097832958
commit
d14805e920
|
@ -164,6 +164,19 @@ public final class AuditMetadataGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean checkPropertiesAudited(Iterator<Property> properties, ClassAuditingData auditingData) {
|
||||||
|
while (properties.hasNext()) {
|
||||||
|
Property property = properties.next();
|
||||||
|
String propertyName = property.getName();
|
||||||
|
PropertyAuditingData propertyAuditingData = auditingData.getPropertyAuditingData(propertyName);
|
||||||
|
if (propertyAuditingData == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked"})
|
@SuppressWarnings({"unchecked"})
|
||||||
private void createJoins(PersistentClass pc, Element parent, ClassAuditingData auditingData) {
|
private void createJoins(PersistentClass pc, Element parent, ClassAuditingData auditingData) {
|
||||||
Iterator<Join> joins = pc.getJoinIterator();
|
Iterator<Join> joins = pc.getJoinIterator();
|
||||||
|
@ -174,6 +187,11 @@ public final class AuditMetadataGenerator {
|
||||||
while (joins.hasNext()) {
|
while (joins.hasNext()) {
|
||||||
Join join = joins.next();
|
Join join = joins.next();
|
||||||
|
|
||||||
|
// Checking if all of the join properties are audited
|
||||||
|
if (!checkPropertiesAudited(join.getPropertyIterator(), auditingData)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Determining the table name. If there is no entry in the dictionary, just constructing the table name
|
// Determining the table name. If there is no entry in the dictionary, just constructing the table name
|
||||||
// as if it was an entity (by appending/prepending configured strings).
|
// as if it was an entity (by appending/prepending configured strings).
|
||||||
String originalTableName = join.getTable().getName();
|
String originalTableName = join.getTable().getName();
|
||||||
|
@ -210,10 +228,12 @@ public final class AuditMetadataGenerator {
|
||||||
Join join = joins.next();
|
Join join = joins.next();
|
||||||
Element joinElement = entitiesJoins.get(entityName).get(join);
|
Element joinElement = entitiesJoins.get(entityName).get(join);
|
||||||
|
|
||||||
|
if (joinElement != null) {
|
||||||
addProperties(joinElement, join.getPropertyIterator(), currentMapper, auditingData, entityName,
|
addProperties(joinElement, join.getPropertyIterator(), currentMapper, auditingData, entityName,
|
||||||
xmlMappingData, firstPass);
|
xmlMappingData, firstPass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked"})
|
@SuppressWarnings({"unchecked"})
|
||||||
private Triple<Element, ExtendedPropertyMapper, String> generateMappingData(
|
private Triple<Element, ExtendedPropertyMapper, String> generateMappingData(
|
||||||
|
|
Loading…
Reference in New Issue