I'm attching the code. The error happened at the last statement when building session factory.
I had to pass in URL because inside a OSGi bundle, Hibernate could not find where the mapping file is.
Let me know if you have any ideas,
Peng
Properties props = new Properties();
props.setProperty("hibernate.connection.url","jdbc:mysql://localhost:3306/jbossdb");
props.setProperty("hibernate.connection.driver_class","com.mysql.jdbc.Driver");
props.setProperty("hibernate.connection.username","jboss");
props.setProperty("hibernate.connection.password","password");
props.setProperty("hibernate.dialect","net.sf.hibernate.dialect.MySQLDialect");
props.setProperty("hibernate.show_sql","false");
props.setProperty("hibernate.use_outer_join","true");
props.setProperty("hibernate.transaction.factory_class","net.sf.hibernate.transaction.JDBCTransactionFactory");
URL url = bc.getBundle().getResource("/DataDomainUser.hbm.xml");
Configuration config = new Configuration()
.addURL(url)
.setProperties(props);
SessionFactory sessionFactory = config.buildSessionFactory();
|