Hi all
Im a newbie I using JBoss-5.1.0.GA
with mysql and hibernate 3 and Im getting some error with configuring datasource. Below are my hibernate.cfg.xml and mysql-ds.xml Please let me know if im missing anything.
I have my mysql-ds.xml under this F:\jboss-5.1.0.GA
\server\default\deploy
hibernate.cfg.xml
<?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
">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory name="jdbc/ercDS">
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.url">jdbc:mysql://localhost:3306/</property>
<property name="connection.username">root</property>
<property name="connection.password">sandeep123</property>
<property name="connection.pool_size">2</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.use_sql_comments">true</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.default_schema">erc</property>
<property name="hibernate.generate_statistics">true</property>
<property name="hibernate.order_inserts">true</property>
<property name="hibernate.order_updates">true</property>
<property name="hibernate.use_identifier_rollback">true</property>
<property name="hibernate.bytecode.use_reflection_optimizer">true</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="hibernate.query.startup_check">true</property>
<property name="hibernate.current_session_context_class">jta</property>
<property name="hibernate.query.startup_check">true</property>
<!-- JTA transaction properties (begin) -->
<property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<!-- JTA transaction properties (end) -->
<!-- DataSource properties (begin) -->
<property name="hibernate.connection.datasource">jdbc/ercDS</property>
<!-- DataSource properties (end) -->
<!-- JBoss transaction manager lookup (begin) -->
<property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
<!-- JBoss transaction manager lookup (end) -->
<!-- Mapping files -->
</session-factory>
</hibernate-configuration>
Im using annotation so i donot have any mapping files how ever i hand configure my class
private static Configuration configuration = new AnnotationConfiguration().addAnnotatedClass(Organisation.class);
--------------------------------------------------------------------------------------------------------------------------------------------------------------
mysql-ds.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- See
http://www.jboss.org/community/wiki/Multiple1PC for information about local-tx-datasource -->
<!-- $Id: mysql-ds.xml 88948 2009-05-15 14:09:08Z jesper.pedersen $ -->
<!-- Datasource config for MySQL using 3.0.9 available from:
http://www.mysql.com/downloads/api-jdbc-stable.html -->
<datasources>
<local-tx-datasource>
<!-- The jndi name of the DataSource, it is prefixed with java:/ -->
<!-- Datasources are not available outside the virtual machine -->
<jndi-name>jdbc/ercDS</jndi-name>
<!-- For server mode db, allowing other processes to use mysql db over tcp.-->
<connection-url>jdbc:mysql://localhost:3306/</connection-url>
<!-- The driver class -->
<driver-class>com.mysql.jdbc.Driver</driver-class>
<!-- The login and password -->
<user-name>root</user-name>
<password>sandeep123</password>
<!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
<min-pool-size>1></min-pool-size>
<!-- The maximum connections in a pool/sub-pool -->
<max-pool-size>20></max-pool-size>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional)
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata> -->
</local-tx-datasource>
</datasources>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks
Sandeep