Source Taste: Hibernate/JPA: AbstractEntityManagerImpl

来源:互联网 发布:淘宝售前客服用语大全 编辑:程序博客网 时间:2024/06/08 14:59

PART 1: static clause(static block)

static {entityManagerSpecificProperties.add( AvailableSettings.LOCK_SCOPE );entityManagerSpecificProperties.add( AvailableSettings.LOCK_TIMEOUT );entityManagerSpecificProperties.add( AvailableSettings.FLUSH_MODE );entityManagerSpecificProperties.add( AvailableSettings.SHARED_CACHE_RETRIEVE_MODE );entityManagerSpecificProperties.add( AvailableSettings.SHARED_CACHE_STORE_MODE );entityManagerSpecificProperties.add( QueryHints.SPEC_HINT_TIMEOUT );}
Quoted from <Thinking in Java>: This code, like other static initializations, is executed only once: the first time you make an object of that class or the first time you access a static member of that class(even if you never make an object of that class).

PART 2:  A Bunch of 'private static class' in class AbstractEntityManagerImpl

NOTE: In java, static class is for inner class ONLY!