When using MetadataSources and adding an inheritance hierarchy with subclass policy. This work fine with a single level, but fails with two or more levels.
This following exception is raised:
Exception in thread "main" java.lang.NullPointerException
at org.hibernate.metamodel.source.hbm.AbstractEntitySourceImpl.add(AbstractEntitySourceImpl.java:283)
at org.hibernate.metamodel.source.hbm.AbstractEntitySourceImpl.add(AbstractEntitySourceImpl.java:279)
at org.hibernate.metamodel.source.hbm.HierarchyBuilder.processCurrentMappingDocument(HierarchyBuilder.java:94)
at org.hibernate.metamodel.source.hbm.HierarchyBuilder.processMappingDocument(HierarchyBuilder.java:58)
at org.hibernate.metamodel.source.hbm.HbmMetadataSourceProcessorImpl.prepare(HbmMetadataSourceProcessorImpl.java:64)
at org.hibernate.metamodel.source.internal.MetadataImpl.prepare(MetadataImpl.java:175)
at org.hibernate.metamodel.source.internal.MetadataImpl.<init>(MetadataImpl.java:160)
at org.hibernate.metamodel.source.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:123)
at org.hibernate.metamodel.MetadataSources.buildMetadata(MetadataSources.java:151)
at org.test.hibmetadatasourcestest.Main.main(Main.java:33)