Injecting Entitymanager via XML and not annnotations

后端 未结 2 1087
萌比男神i
萌比男神i 2021-02-20 03:44

What I am trying to do is inject through XML almost the same way that is done through A @PersistenceContext annotation. I am in need of this because of the fact I have differen

2条回答
  •  余生分开走
    2021-02-20 04:12

    You can provide the persistence unit name in the xml configuration, using the SharedEntityManagerBean, like below:

    
        
            
                
            
        
    
    

    of course, you can have the SharedEntityManagerBean as a separate bean

    Here, I m injecting entityManager into BaseDAO as you're doing using @PersistenceContext(unitName="...")

提交回复
热议问题