JpaMetadataProviderImpl.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:rice 作者:
/**
    * {@inheritDoc}
    */
@Override
protected synchronized void initializeMetadata(Collection<Class<?>> types) {
    LOG.info("Initializing JPA Metadata from " + entityManager);

    masterMetadataMap.clear();
    // QUESTION: When is JPA loaded so this service can initialize itself?
    // Build and store the map

    for ( IdentifiableType<?> identifiableType : entityManager.getMetamodel().getEntities() ) {
           //Only extract the metadata if EntityType and not a MappedSuperClass
           if(identifiableType instanceof EntityType<?>){
               EntityType<?> type = (EntityType<?>)identifiableType;
               try {
                   masterMetadataMap.put(type.getBindableJavaType(), getMetadataForClass(type.getBindableJavaType()));
                   if (LOG.isDebugEnabled()) {
                       LOG.debug("Added Metadata For: " + type.getBindableJavaType());
                   }
               } catch (Exception ex) {
                   LOG.error("Error obtaining JPA metadata for type: " + type.getJavaType(), ex);
               }
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号