<? xml version = "1.0" encoding = "UTF-8" ?> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence < persistence-unit name = "frameworkEjb" transaction-type = "JTA" > < jta-data-source >frameworkDs</ jta-data-source > </ persistence-unit > < persistence-unit name = "scada" transaction-type = "JTA" > < jta-data-source >scada</ jta-data-source > </ persistence-unit > </ persistence > |
上图是persistence.xml中的配置文件 其中frameworkEjb和scada是Weblogic发布的两个数据源的名称,当在实现类中要用某个数据源的时候就加入一下语句
@PersistenceContext(unitName="frameworkEjb")