List of usage examples for org.springframework.data.jpa.mapping JpaMetamodelMappingContext JpaMetamodelMappingContext
public JpaMetamodelMappingContext(Set<Metamodel> models)
From source file:org.lightadmin.core.config.bootstrap.JpaMetamodelMappingContextFactoryBean.java
@Override protected JpaMetamodelMappingContext createInstance() throws Exception { Metamodel metamodel = entityManager.getMetamodel(); Set<ManagedType<?>> managedTypes = metamodel.getManagedTypes(); Set<Class<?>> entitySources = new HashSet<Class<?>>(managedTypes.size()); for (ManagedType<?> type : managedTypes) { Class<?> javaType = type.getJavaType(); if (javaType != null) { entitySources.add(javaType); }/*from ww w. j a v a 2 s . com*/ } Set<Metamodel> metaModelSet = new HashSet<>(Collections.singletonList(metamodel)); JpaMetamodelMappingContext context = new JpaMetamodelMappingContext(metaModelSet); context.setInitialEntitySet(entitySources); context.initialize(); return context; }