如何使用mssql数据库配置ejb?我想使用EJB实体bean访问mssql数据库表,我使用jboss 7作为应用程序服务器?
答案 0 :(得分:0)
基本上,您需要:
persistence.xml示例
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="SITE_WEB" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/myDataSourceJndiName</jta-data-source>
<properties>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="false"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
</properties>
</persistence-unit>
要创建模块并定义数据源,请结帐https://mpashworth.wordpress.com/2012/01/26/configuring-a-sql-server-data-source-within-jboss-7-1/