@Override @SuppressWarnings({"unchecked"}) public void prepare(MetadataSources sources) { // create a jandex index from the annotated classes Indexer indexer = new Indexer(); for (Class<?> clazz : sources.getAnnotatedClasses()) { indexClass(indexer, clazz.getName().replace('.', '/') + ".class"); } // add package-info from the configured packages for (String packageName : sources.getAnnotatedPackages()) { indexClass(indexer, packageName.replace('.', '/') + "/package-info.class"); } index = indexer.complete(); List<JaxbRoot<XMLEntityMappings>> mappings = new ArrayList<JaxbRoot<XMLEntityMappings>>(); for (JaxbRoot<?> root : sources.getJaxbRootList()) { if (root.getRoot() instanceof XMLEntityMappings) { mappings.add((JaxbRoot<XMLEntityMappings>) root); } } if (!mappings.isEmpty()) { // process the xml configuration final OrmXmlParser ormParser = new OrmXmlParser(metadata); index = ormParser.parseAndUpdateIndex(mappings, index); } if (index.getAnnotations(PseudoJpaDotNames.DEFAULT_DELIMITED_IDENTIFIERS) != null) { metadata.setGloballyQuotedIdentifiers(true); } }
@Override @SuppressWarnings({"unchecked"}) public void prepare(MetadataSources sources) { this.processors = new ArrayList<HibernateMappingProcessor>(); for (JaxbRoot jaxbRoot : sources.getJaxbRootList()) { if (jaxbRoot.getRoot() instanceof XMLHibernateMapping) { processors.add( new HibernateMappingProcessor(metadata, (JaxbRoot<XMLHibernateMapping>) jaxbRoot)); } } }
public HibernateMappingProcessor( MetadataImplementor metadata, JaxbRoot<XMLHibernateMapping> jaxbRoot) { this.metadata = metadata; this.jaxbRoot = jaxbRoot; this.hibernateMapping = jaxbRoot.getRoot(); this.mappingDefaults = new OverriddenMappingDefaults( metadata.getMappingDefaults(), hibernateMapping.getPackage(), hibernateMapping.getSchema(), hibernateMapping.getCatalog(), null, null, hibernateMapping.getDefaultCascade(), hibernateMapping.getDefaultAccess(), hibernateMapping.isDefaultLazy()); autoImport = hibernateMapping.isAutoImport(); metaAttributeContext = extractMetaAttributes(); }