These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: MappingException resolving custom Hib UserType
PostPosted: Sat May 14, 2011 12:02 pm 
Newbie

Joined: Wed Dec 29, 2010 6:36 pm
Posts: 5
Hi! Just switched to JBoss 6 from Tomcat. Have been using Hibernate 3.6 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.

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


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;
    }

}


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>



Thanks for your time.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.