从persistance.xml到jboss数据源配置外部化postgresql模式

时间:2015-04-06 11:01:53

标签: java postgresql jboss datasource persistence.xml

这是我的persistance.xml

<?xml version="1.0" encoding="UTF-8"?>

http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd“&GT;

<persistence-unit name="cframe-context-unit">

    <jta-data-source>java:jboss/datasources/ClicencePostgresDS</jta-data-source>

    <jar-file>myModel.jar</jar-file>

    <properties>
        <property name="hibernate.archive.autodetection" value="class"/>
        <property name="hibernate.format_sql" value="true"/>
        <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
        <property name="hibernate.default_schema" value="dev"/>
        <property name="hibernate.hbm2ddl.auto" value="update"/> 
    </properties>

</persistence-unit>

我想删除此行<property name="hibernate.default_schema" value="dev"/>并在jboss数据源配置中设置它。 这是我目前的jboss数据源配置

<datasource jta="false" jndi-name="java:jboss/datasources/ClicencePostgresDS" pool-name="ClicencePostgresDS" enabled="true" use-java-context="true" use-ccm="false">  
                <connection-url>  
                    jdbc:postgresql://127.0.0.1:5432/citech_db  
                </connection-url>
                <driver>postgresql</driver>  
                <pool>  
                    <min-pool-size>2</min-pool-size>  
                    <max-pool-size>20</max-pool-size>  
                </pool>  
                <security>  
                    <user-name>username</user-name>  
                    <password>password</password>  
                </security>  
                <validation>  
                    <validate-on-match>false </validate-on-match>  
                    <background-validation>false</background-validation>  
                    <!--background-validation-millis>0</background-validation-millis-->  
                </validation>  
                <statement>  
                    <prepared-statement-cache-size>0</prepared-statement-cache-size>  
                    <share-prepared-statements>false</share-prepared-statements>  
                </statement>  
            </datasource> 

0 个答案:

没有答案