Hibernate version: 3.1.2
hi,
i am in a situation, where it would be helpful , if the following was possible: i specify two directory locations as locations for mapping file resources. the first one contains the standard mappings, the second one customer-specific mappings, which should override the mappings from the first location .
After checking the source it seems this could be achieved quite easily by adding an overrideMappingAllowed property to and changing the addClass(),addCollection() and addQuery() Methods in org.hibernate.cfg.Mappings along the lines of:
Code:
public void addClass(PersistentClass persistentClass) throws MappingException {
Object old = classes.put( persistentClass.getEntityName(), persistentClass );
if ( old!=null ) {
throw new DuplicateMappingException( "class/entity", persistentClass.getEntityName() );
}
}
becomes:
Code:
public void addClass(PersistentClass persistentClass) throws MappingException {
Object old = classes.put( persistentClass.getEntityName(), persistentClass );
if ( old!=null && !overrideMappingAllowed ) {
throw new DuplicateMappingException( "class/entity", persistentClass.getEntityName() );
}
}
could this have any undesired side effects? and if this change makes sense, would it be possible to get it into the source tree, so i do not have to use my own patched version of hibernate ?
Lutz