I'm currently migrating an old Hibernate tool from version 3.2 to the latest release. I've run into a situation where one of the methods that I need to override has been changed into a private method, making it impossible for me to override it.
This is how it was in the earlier release:
protected void add(XmlDocument metadataXml) throws MappingException {
HbmBinder.bindRoot(metadataXml, createMappings(), Collections.EMPTY_MAP);
}
What I the tool changed was that it instead called a different HbmBinder:
protected void add(XmlDocument metadataXml) throws MappingException {
AutofetchHbmBinder.bindRoot(metadataXml, createMappings(), Collections.EMPTY_MAP);
}
In the version I'm currently working on, the bindRoot-call is called in this method:
private void processHbmXml(XmlDocument metadataXml, Set<String> entityNames) {
try {
HbmBinder.bindRoot(metadataXml, createMappings(), Collections.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);
}
}
}
As you can see, the method can't be overridden because of the private keyword. The method is using variables that I don't have in the subclass, so rewriting methods that will call this method is not an option.
Is there something I can do in order to call AutofetchHbmBinder.bindRoot in this case?
Aucun commentaire:
Enregistrer un commentaire