1 Reply Latest reply on May 11, 2006 9:30 AM by jaikiran

    How to set binding ordering?

    nancy.aggarwal

      Hi,

      I am new to JNDI.I want to bind hibernate to JBOSS.I created a hibernate-service.xml having following content:

      <server>
       <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=Hibernate"> <attribute name="DatasourceName">jdbc/mysql</attribute> <attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute> <attribute name="SessionFactoryName">testing</attribute><attribute name="Hbm2ddlAuto">create-drop</attribute> <attribute name="ShowSqlEnabled">true</attribute> </mbean></server>



      If I put this xml while running JBOSS,I can lookup java:/testing successfully.But if restart jboss(having this xml already),it is unable to
      start service jboss.har:service=Hibernate

      11:59:26,437 WARN [ServiceController] Problem starting service jboss.har:service=Hibernate
      org.hibernate.HibernateException: Could not find datasource

      But I can lookup the specified datasource with 'java:jdbc/mysql'.I think problem is that jboss goes to bind hibernate binding first and when it tries to find database binding,it cannot find.

      Is there anyway so that my datasource get binded first and then my hibernate binding should be done by JBOSS so that Hibenate binding can lookup db binding.