How to configure Spring Data JPA using XML

前端 未结 2 1244
忘掉有多难
忘掉有多难 2020-11-30 02:46

I\'m reading the book \"Professional Java for Web Applications - Nicholas S. Williams\" The book example has this configuration for Spring Data JPA:

@Bean
pu         


        
2条回答
  •  青春惊慌失措
    2020-11-30 03:09

    If you want to configure Spring Data JPA by using XML configuration (and use the configuration described in the book), you have to follow these steps:

    1. Configure the data source bean.
    2. Configure the entity manager factory bean.
    3. Configure the transaction manager bean.
    4. Enable annotation driven transaction management.
    5. Configure Spring Spring Data JPA.

    The application context configuration (applicationContext-persistence.xml) file looks as follows:

    
    
    
      
      
    
      
      
    
      
      
        
        
        
        
          
            org.hibernate.dialect.MySQL5InnoDBDialect
            none
            true
          
        
        
        
        
        
        
        
      
    
      
      
        
      
    
      
      
    
      
      
    
    

提交回复
热议问题