Hi everyone,
I have a bit of a problem that I need some input on. I’m migrating a Hibernate tool from version 3.2 to the newest release. However, I also need a version for Hibernate 4.3.10 for another project. The tool extends or copies most of the classes in Hibernate to add extra functionality. The problem is that in version 4.3.10 the HbmBinder-class is called in a different method.
In 3.5 it was like this:
protected void add(org.dom4j.Document doc) throws MappingException {
HbmBinder.bindRoot(doc, createMappings(),
CollectionHelper.EMPTY_MAP);
}
And in Hibernate 4.3.10 it is like this:
private void processHbmXml(XmlDocument metadataXml, Set<String> entityNames) {
try {
HbmBinder.bindRoot( metadataXml, createMappings(), CollectionHelper.EMPTY_MAP, entityNames );
}
catch ( MappingException me ) {
throw new InvalidMappingException(
metadataXml.getOrigin().getType(),
metadataXml.getOrigin().getName(),
me
);
}
for ( String entityName : entityNames ) {
if ( annotatedClassesByEntityNameMap.containsKey( entityName ) ) {
annotatedClasses.remove( annotatedClassesByEntityNameMap.get( entityName ) );
annotatedClassesByEntityNameMap.remove( entityName );
}
}
}
What I want to accomplish is something like this:
@Override
private void processHbmXml(XmlDocument metadataXml, Set<String> entityNames) {
try {
AutofetchHbmBinder.bindRoot( metadataXml, createMappings(), CollectionHelper.EMPTY_MAP, entityNames );
}
catch ( MappingException me ) {
throw new InvalidMappingException(
metadataXml.getOrigin().getType(),
metadataXml.getOrigin().getName(),
me
);
}
for ( String entityName : entityNames ) {
if ( annotatedClassesByEntityNameMap.containsKey( entityName ) ) {
annotatedClasses.remove( annotatedClassesByEntityNameMap.get( entityName ) );
annotatedClassesByEntityNameMap.remove( entityName );
}
}
}
Since the tool that I’m migrating uses a different HbmBinder, I need to change the bindRoot-call to that specific class. The problem is that the new method is private so I can’t override it. Does anyone have an idea what I could do to solve this?