I'm using jboss 3.2.3 and hibernate 2.1.2, the deploy it's ok... at least it's what jboss says, the problem is in the client. when i make the lookup the sessionFactory comes null, any ideas??
Thanks, Aldo.
Code:
public static void main (String[]args){
try {
System.setProperty( "java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
System.setProperty( "java.naming.provider.url","jnp://localhost:1099");
System.setProperty( "java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
Context ctx = new InitialContext( );
SessionFactory sessionFactory= (SessionFactory)ctx.lookup("HibernateFactory");
}
catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
Code:
<server>
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory,name=HibernateFactory">
<depends>jboss.jca:service=RARDeployer</depends>
<depends>jboss.jca:service=LocalTxCM,name=prueba</depends>
<!-- Make it deploy ONLY after DataSource had been started -->
<attribute name="MapResources">mappings/prueba.hbm.xml</attribute>
<attribute name="JndiName">HibernateFactory</attribute>
<attribute name="Datasource">java:/prueba</attribute>
<attribute name="Dialect">net.sf.hibernate.dialect.MySQLDialect</attribute>
<attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
<attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute>
<attribute name="UseOuterJoin">false</attribute>
<attribute name="ShowSql">false</attribute>
<attribute name="UserTransactionName">UserTransaction</attribute>
</mbean>
</server>
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="Prueba" table="prueba" >
<id name="id" type="int" column="id" unsaved-value="null">
<generator class="identity"/>
</id>
<property name="nombre" type="java.lang.String" column="nombre" not-null="true"/>
</class>
</hibernate-mapping>