JPAPersistenceUnitPostProcessor.java 文件源码

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

项目:lutece-core 作者:
/**
 * Scans for *.orm.xml and adds Entites from classpath.
 *
 * @param pui
 *            the pui
 */
@Override
public void postProcessPersistenceUnitInfo( MutablePersistenceUnitInfo pui )
{
    _Log.info( "Scanning for JPA orm.xml files" );

    for ( File ormFile : getListORMFiles( ) )
    {
        String ormAbsolutePath = ormFile.getAbsolutePath( );
        _Log.info( "Found ORM file : " + ormAbsolutePath );
        pui.addMappingFileName( ormAbsolutePath.substring( ormAbsolutePath.indexOf( CLASSPATH_PATH_IDENTIFIER ) ) );
    }

    _Log.info( "Scanning for JPA entities..." );

    Set<String> entityClasses = AnnotationUtil.find( Entity.class.getName( ) );
    entityClasses.addAll( AnnotationUtil.find( Embeddable.class.getName( ) ) );
    entityClasses.addAll( AnnotationUtil.find( MappedSuperclass.class.getName( ) ) );

    for ( String strClass : entityClasses )
    {
        _Log.info( "Found entity class : " + strClass );

        if ( !pui.getManagedClassNames( ).contains( strClass ) )
        {
            pui.addManagedClassName( strClass );
        }
    }

    if ( _Log.isDebugEnabled( ) )
    {
        dumpPersistenceUnitInfo( pui );
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号