如何根据我的配置文件

时间:2016-10-23 10:26:38

标签: java hibernate jboss jndi

我一直在努力在我的项目中设置JNDI

我的Hibernate文件是这样的:

    <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory >
        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
    <property name="hibernate.connection.password">mypass</property>
    <property name="hibernate.connection.url">jdbc:oracle:thin:@big-data-3.logti.etsmtl.ca:1521:LOG660</property>
    <property name="hibernate.connection.username">myTeam</property>
    <property name="hibernate.default_schema">teamAlpha</property>
    <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
    <property name="hibernate.search.autoregister_listeners">false</property>

    <mapping resource="Scenariste.hbm.xml" />
    <mapping resource="Utilisateur.hbm.xml" />
    <mapping resource="Annonce.hbm.xml" />
    <mapping resource="Genre.hbm.xml" />
    <mapping resource="Location.hbm.xml" />
    <mapping resource="Pays.hbm.xml" />
    <mapping resource="Personnelfilm.hbm.xml" />
    <mapping resource="Clientenretard.hbm.xml" />
    <mapping resource="Film.hbm.xml" />
    <mapping resource="Forfait.hbm.xml" />
    <mapping resource="Employe.hbm.xml" />
    <mapping resource="Client.hbm.xml" />
    <mapping resource="Personneltournage.hbm.xml" />
</session-factory>

我知道要添加JNDI,它必须与此类似

 hibernate.connection.datasource = java:/comp/env/jdbc/test
hibernate.transaction.factory_class = \
    org.hibernate.transaction.JTATransactionFactory
hibernate.transaction.manager_lookup_class = \
    org.hibernate.transaction.JBossTransactionManagerLookup
hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect

但是如何根据我的信息填充数据源和工厂类以及查找类?我的数据库名称是teamAlpha

我正在使用JBOSS插件进行eclipse, 谢谢

0 个答案:

没有答案