2 Replies Latest reply on Jul 1, 2005 11:35 AM by j. Eduardo

    Jboss 4.0.2 with Hibernate 3.0.4

    Manish Parikh Newbie

      I recently migrated my project from Jboss 4.0.1SP1 to Jboss 4.0.2. I use the hibernate.cfg.xml file to set the Hibernate Sessionfactory at startup. The log shows the the factory does get bound in jndi. However when I try to retrive the factory using jndi in the code , I get null.

      Please advise.

        • 1. Re: Jboss 4.0.2 with Hibernate 3.0.4
          Markus Werner Newbie

          If have the same problem.

          But in the log file I found these entries, and i don't know what to do now.

          [org.hibernate.impl.SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
          [org.jboss.hibernate.jmx.Hibernate] SessionFactory successfully built and bound into JNDI [SessionFactory]

           <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=Hibernate">
           <attribute name="DatasourceName">java:/DefaultDS</attribute>
           <attribute name="Dialect">org.hibernate.dialect.Oracle9Dialect</attribute>
           <property name="hibernate.default_schema">LAGERDBA</property>
           <property name="connection.pool_size">1</property>
           <property name="show_sql">true</property>
           <attribute name="SessionFactoryName">SessionFactory</attribute>
           <attribute name="CacheProviderClass">org.hibernate.cache.HashtableCacheProvider</attribute>
           <attribute name="ShowSqlEnabled">true</attribute>

          Sample Hibernate File

          package de.psb_gmbh.main.business.persistence.hibernate;
          import java.util.Set;
          public class AcUser implements java.io.Serializable {
           // Fields
           private String UserId;
           private AcGroup AcGroup;
           private String LoginName;
           private String Name;
           private String Password;
           private Integer CheckCount;
           private Set<AcUserToGroup> SetOfAcUserToGroup;
           // Constructors
           public AcUser() {
           // Property accessors
           public String getUserId() {
           return this.UserId;
           public void setUserId(String UserId) {
           this.UserId = UserId;
           public AcGroup getAcGroup() {
           return this.AcGroup;
           public void setAcGroup(AcGroup AcGroup) {
           this.AcGroup = AcGroup;
           public String getLoginName() {
           return this.LoginName;
           public void setLoginName(String LoginName) {
           this.LoginName = LoginName;
           public String getName() {
           return this.Name;
           public void setName(String Name) {
           this.Name = Name;
           public String getPassword() {
           return this.Password;
           public void setPassword(String Password) {
           this.Password = Password;
           public Integer getCheckCount() {
           return this.CheckCount;
           public void setCheckCount(Integer CheckCount) {
           this.CheckCount = CheckCount;
           public Set<AcUserToGroup> getSetOfAcUserToGroup() {
           return this.SetOfAcUserToGroup;
           public void setSetOfAcUserToGroup(Set<AcUserToGroup> setOfAcUserToGroup) {
           this.SetOfAcUserToGroup = setOfAcUserToGroup;

          <?xml version="1.0"?>
          <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
           <class name="de.psb_gmbh.main.business.persistence.hibernate.AcUser" table="AC_USER" schema="LAGERDBA">
           <id name="UserId">
           <column name="USER_ID"/>
           <generator class="assigned" />
           <many-to-one name="AcGroup" class="de.psb_gmbh.main.business.persistence.hibernate.AcGroup">
           <column name="MASTER_GROUP_ID"/>
           <property name="LoginName">
           <column name="LOGIN_NAME"/>
           <property name="Name">
           <column name="NAME"/>
           <property name="Password">
           <column name="PASSWORD"/>
           <property name="CheckCount">
           <column name="CHECK_COUNT"/>
           <set name="SetOfAcUserToGroup">
           <column name="USER_ID" />
           <one-to-many class="de.psb_gmbh.main.business.persistence.hibernate.AcUserToGroup" />

          I'm using
          - JBoss 4.0.2
          - Hibernate 3.0.5
          - Java 5.0
          - Oracle DB 9.2
          - Windows XP SP1
          - Eclipse 3.1M7 with MyEclipse 3.8.4, JBoss IDE1.5M1, XML Spy Pro 2005