HHH-6113 re-fact and more tests

This commit is contained in:
Strong Liu 2011-05-22 20:23:29 +08:00
parent c62e5fccc8
commit c1415b4b8f
4 changed files with 17 additions and 12 deletions

View File

@ -65,7 +65,7 @@ abstract class AnnotationMocker extends AbstractMocker {
} }
protected boolean isDefaultCascadePersist() { protected boolean isDefaultCascadePersist() {
return defaults.isCascadePersist(); return defaults.isCascadePersist()!=null && defaults.isCascadePersist();
} }
//@JoinTable //@JoinTable

View File

@ -95,7 +95,7 @@ class DefaultConfigurationHelper {
if ( hasSchemaOrCatalogDefined( defaults ) ) { if ( hasSchemaOrCatalogDefined( defaults ) ) {
applyDefaultSchemaAndCatalog( annotationsMap, defaults ); applyDefaultSchemaAndCatalog( annotationsMap, defaults );
} }
if ( defaults.isCascadePersist() ) { if ( defaults.isCascadePersist()!=null && defaults.isCascadePersist() ) {
applyDefaultCascadePersist( annotationsMap ); applyDefaultCascadePersist( annotationsMap );
} }
} }

View File

@ -165,8 +165,8 @@ public class EntityMappingsMocker {
private String packageName; private String packageName;
private String schema; private String schema;
private String catalog; private String catalog;
private boolean metadataComplete; private Boolean metadataComplete;
private boolean cascadePersist; private Boolean cascadePersist;
public XMLAccessType getAccess() { public XMLAccessType getAccess() {
return access; return access;
@ -200,19 +200,19 @@ public class EntityMappingsMocker {
this.schema = schema; this.schema = schema;
} }
public boolean isMetadataComplete() { public Boolean isMetadataComplete() {
return metadataComplete; return metadataComplete;
} }
void setMetadataComplete(boolean metadataComplete) { void setMetadataComplete(Boolean metadataComplete) {
this.metadataComplete = metadataComplete; this.metadataComplete = metadataComplete;
} }
public boolean isCascadePersist() { public Boolean isCascadePersist() {
return cascadePersist; return cascadePersist;
} }
void setCascadePersist(boolean cascadePersist) { void setCascadePersist(Boolean cascadePersist) {
this.cascadePersist = cascadePersist; this.cascadePersist = cascadePersist;
} }
@ -230,9 +230,14 @@ public class EntityMappingsMocker {
if ( globalDefault.getCatalog() != null ) { if ( globalDefault.getCatalog() != null ) {
catalog = globalDefault.getCatalog(); catalog = globalDefault.getCatalog();
} }
metadataComplete = globalDefault.isMetadataComplete(); if ( globalDefault.isCascadePersist() != null ) {
cascadePersist = globalDefault.isCascadePersist(); cascadePersist = globalDefault.isCascadePersist();
} }
if ( globalDefault.isMetadataComplete() != null ) {
metadataComplete = globalDefault.isMetadataComplete();
}
}
} }
} }
} }

View File

@ -184,9 +184,9 @@ public class IndexBuilder {
// annotations classes overrided by xml // annotations classes overrided by xml
if ( indexedClassInfoAnnotationsMap.containsKey( name ) ) { if ( indexedClassInfoAnnotationsMap.containsKey( name ) ) {
Map<DotName, List<AnnotationInstance>> tmp = getIndexedAnnotations( name ); Map<DotName, List<AnnotationInstance>> tmp = getIndexedAnnotations( name );
DefaultConfigurationHelper.INSTANCE.applyDefaults( tmp, defaults );
mergeAnnotationMap( tmp, map ); mergeAnnotationMap( tmp, map );
} }
DefaultConfigurationHelper.INSTANCE.applyDefaults( map, defaults );
mergeAnnotationMap( map, annotations ); mergeAnnotationMap( map, annotations );
} }