JPA的配置文件persistence.xml参数详解

JPA规范要求在类路径的META-INF目录下放置persistence.xml, 文件的名称是固定的,配置模板如下: 

Xml代码

http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
 http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  

  org.eclipse.persistence.jpa.PersistenceProvider
  
  boa.framework.entity.CustomerEntity                                                                                 ENABLE_SELECTIVE
   CALLBACK     
  
   
   
   
   
   
   
   
   
   
  
 
  


  
  
  
  
     
      
  
     
        
  
     
   java:/test  
      
  
     
   product.xml  
  
     
   ../lib/model.jar  
  
     
   boa.framework.entity.CustomerEntity
  
     
   true 
   shared-cache-mode
  缓存模式。加了@Cacheable注解的默认为二级缓存。有四种模式:ALL-缓存所有实体;NONE-禁止缓存;ENABLE_SELECTIVE-如果加了缓存的标识,是默认的选选        项;DISABLE_SELECTIVE- enable caching unless explicitly marked as  @Cacheable(false) (not  recommended)
  validation-mode
  实体的验证模式,默认是激活的。当一个实体在创建、更新,在实体发送到数据库前会被进行验证。CALLBACK: entities are validated on creation, update and deletion. If no Bean Validation provider  is present, an exception is raised at initialization time.                          
     
      
        
     
  
  
  
  






你可能感兴趣的:(jpa,Java)