0

seam で hibernate 設定を使用して jpa を設定すると、THIN ドライバでサポートされていない Null ユーザーまたはパスワードが表示されます

components.xml

<persistence:hibernate-session-factory   name="hibernateSessionFactory" cfg-resource-name="hibernate.cfg.xml"/>
<persistence:managed-hibernate-session name="session" 
                 auto-create="true"
 session-factory-jndi-name="java:/mobeeSessionFactory"/>

hibernate.cfg.xml

<hibernate-configuration>
 <session-factory name="java:/mobeeSessionFactory">
  <property name="hibernate.connection.pool_size">10</property>
  <property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
  <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:mobee</property>
  <property name="hibernate.connection.username">mobeemigrate</property>
  <property name="hibernate.show_sql">true</property>
 <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
  <property name="hibernate.format_sql">true</property>

  <property name="hibernate.default_entity_mode">pojo</property>
  <property name="hibernate.session_factory_name">java:/mobeeSessionFactory</property>
  <property name="hibernate.connection.datasource">mobeeadminDataSource</property>
  <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
  <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
  <property name="hibernate.transaction.auto_close_session">false</property>
  <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
  <property name="hibernate.transaction.flush_before_completion">true</property>
  <property name="hibernate.hbm2ddl.auto">create</property>
  <!-- Here are the mappings -->
  <mapping class="tempCustomers" package="com.manam.mobee.persist.entity.TempCustomers"/>
  <mapping class="tempAccounts" package="com.manam.mobee.persist.entity.TempAccounts"/>
 </session-factory>
</hibernate-configuration>

プロジェクト名-ds.xml

<local-tx-datasource>
  <jndi-name>mobeeadminDataSource</jndi-name>
  <use-java-context>false</use-java-context>
  <connection-url>jdbc:oracle:thin:@localhost:1521:mobee</connection-url>
  <driver-class>oracle.jdbc.OracleDriver</driver-class>
  <user-name>mobeemigrate</user-name>
  <password>mobeemigrate</password>
 </local-tx-datasource>
4

2 に答える 2

0

にパスワードがありませんhibernate.cfg.xml

修正するには、以下に示すように hibernate.cfg.xml ファイルに以下を含めます。

  <property name="hibernate.connection.password">mobeemigrate</property>

hibernate.cfg.xml

<hibernate-configuration>
 <session-factory name="java:/mobeeSessionFactory">
  <property name="hibernate.connection.pool_size">10</property>
  <property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
  <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:mobee</property>
  <property name="hibernate.connection.username">mobeemigrate</property>
  <property name="hibernate.connection.password">mobeemigrate</property>
  <property name="hibernate.show_sql">true</property>
 <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
  <property name="hibernate.format_sql">true</property>

  <property name="hibernate.default_entity_mode">pojo</property>
  <property name="hibernate.session_factory_name">java:/mobeeSessionFactory</property>
  <property name="hibernate.connection.datasource">mobeeadminDataSource</property>
  <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
  <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
  <property name="hibernate.transaction.auto_close_session">false</property>
  <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
  <property name="hibernate.transaction.flush_before_completion">true</property>
  <property name="hibernate.hbm2ddl.auto">create</property>
  <!-- Here are the mappings -->
  <mapping class="tempCustomers" package="com.manam.mobee.persist.entity.TempCustomers"/>
  <mapping class="tempAccounts" package="com.manam.mobee.persist.entity.TempAccounts"/>
 </session-factory>
</hibernate-configuration>
于 2012-12-07T13:09:15.580 に答える
0

hibernate.cfg.xml には次のプロパティがあります。

<property name="hibernate.connection.username">mobeemigrate</property>

しかし、対応するパスワードではありません:

<property name="hibernate.connection.password">mobeemigrate</property>
于 2012-12-07T13:09:45.343 に答える