0 Replies Latest reply on May 14, 2011 3:54 PM by sfrancolla

    Hibernate custom UserType exceptioning in JBoss 6 startup only  :(

    sfrancolla

      Hi! 

       

      Is this some kind of scope issue??

       

      Just switched to JBoss-6.0.0.Final from Tomcat stand-alone.  Have been using Hibernate 3.6 Final all along and my package libraries are unchanged.  Finally got thru JBoss classloading and am now presented with the following Hibernate exception.  I use a handful of custom UserTypes.  Mappings are defined in hbm.xml still.  Entity and mapping below as well.  This deployed fine on Tomcat.  Unsure how it's not finding my type since the code's all in the same package.

       

      All input very much appreciated!

       

       

      [code]Caused by: org.hibernate.MappingException: Could not determine type for: com.project.persistence.dao.usertype.DefaultStatusIfNullStatusType, at table: LOCATION, for columns: [org.hibernate.mapping.Column(STATUS)]

                at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:306) [:3.6.0.Final]

                at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:290) [:3.6.0.Final]

                at org.hibernate.mapping.Property.isValid(Property.java:217) [:3.6.0.Final]

                at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:463) [:3.6.0.Final]

                at org.hibernate.mapping.RootClass.validate(RootClass.java:235) [:3.6.0.Final]

                at org.hibernate.cfg.Configuration.validate(Configuration.java:1332) [:3.6.0.Final]

                at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1835) [:3.6.0.Final]

                at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860) [:3.0.5.RELEASE]

                at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779) [:3.0.5.RELEASE]

                at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) [:3.0.5.RELEASE]

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) [:3.0.5.RELEASE]

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) [:3.0.5.RELEASE]

                ... 107 more

      [/code]

       

       

      My entity:

       

       

      [code]@Component

      public class Location extends AbstractPersistentEntity implements Serializable {

       

       

          private Integer locationId;

          private String geonameId;

          private String geonameJson;

          private String cityName;

          private String status;

          private Timestamp createTimestamp;

          private Timestamp updateTimestamp;

       

       

          /**

           * Default constructor.

           */

          public Location() {

          }

       

       

          public Integer getLocationId() {

              return this.locationId;

          }

       

       

          public void setLocationId(Integer locationId) {

              this.locationId = locationId;

          }

       

       

          public String getGeonameId() {

              return this.geonameId;

          }

       

       

          public void setGeonameId(String geonameId) {

              this.geonameId = geonameId;

          }

       

       

          public String getGeonameJson() {

              return this.geonameJson;

          }

       

       

          public void setGeonameJson(String geonameJson) {

              this.geonameJson = geonameJson;

          }

       

       

          public String getCityName() {

              return this.cityName;

          }

       

       

          public void setCityName(String cityName) {

              this.cityName = cityName;

          }

       

       

          public String getStatus() {

              return this.status;

          }

       

       

          public void setStatus(String status) {

              this.status = status;

          }

       

       

          public Timestamp getCreateTimestamp() {

              return this.createTimestamp;

          }

       

       

          public void setCreateTimestamp(Timestamp createTimestamp) {

              this.createTimestamp = createTimestamp;

          }

       

       

          public Timestamp getUpdateTimestamp() {

              return this.updateTimestamp;

          }

       

       

          public void setUpdateTimestamp(Timestamp updateTimestamp) {

              this.updateTimestamp = updateTimestamp;

          }

       

       

      }

      [/code]

       

       

      The mapping:

       

       

      [code]<?xml version="1.0" encoding="utf-8"?>

      <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

      <hibernate-mapping>

          <class name="com.project.persistence.model.Location" table="LOCATION" catalog="db">

              <id name="locationId" type="java.lang.Integer">

                  <column name="LOCATION_ID" />

                  <generator class="identity" />

              </id>

              <property name="geonameId" type="java.lang.String">

                  <column name="GEONAME_ID" length="10" not-null="true" unique="true" />

              </property>

              <property name="geonameJson" type="java.lang.String">

                  <column name="GEONAME_JSON" length="5000" not-null="true" />

              </property>

              <property name="cityName" type="java.lang.String">

                  <column name="CITY_NAME" length="200" not-null="true" />

              </property>

              <property name="status" type="com.proj.persistence.dao.usertype.DefaultStatusIfNullStatusType">

                  <column name="STATUS" length="1" />

              </property>

              <property name="createTimestamp" type="com.proj.persistence.dao.usertype.DefaultNowIfNullTimestampType">

                  <column name="CREATE_TIMESTAMP" length="19" />

              </property>

              <property name="updateTimestamp" type="com.proj.persistence.dao.usertype.UpdateToNowAlwaysTimestampType">

                  <column name="UPDATE_TIMESTAMP" length="19" />

              </property>

          </class>

      </hibernate-mapping>

      [/code]

       

       

       

       

      Thanks for your time.