-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate 3.1 ... unmapped class: java.lang.String
PostPosted: Tue Mar 14, 2006 7:44 pm 
Newbie

Joined: Tue Mar 14, 2006 7:35 pm
Posts: 3
I have XDoclet generating my *.hbm.xml

<?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="my.pkg.BureauCode"
table="DOL_REF_BUREAU_CODES"
>

<id
name="id"
column="REF_BUR_ID"
type="long"
>
<generator class="sequence">
<param name="sequence">DOL_REF_BUREAU_CODES_SEQ</param>
</generator>
</id>

<version
name="version"
column="VERSION_NUM"
type="java.lang.Long"
unsaved-value="null"
/>

<property
name="bureauCode"
type="java.lang.String"
update="true"
insert="true"
column="REF_BUR_CODE"
/>

<property
name="bureauName"
type="java.lang.String"
update="true"
insert="true"
column="REF_BUR_NAME"
/>

<property
name="comment"
type="java.lang.String"
update="true"
insert="true"
column="REF_BUR_COMNT_TEXT"
/>

<many-to-one
name="createdBy"
class="java.lang.String"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="CREATD_USER_ID"
/>

<property
name="createdDate"
type="java.util.Date"
update="true"
insert="true"
column="CREATD_DATE"
/>

<many-to-one
name="modedBy"
class="java.lang.String"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="MODED_USER_ID"
/>

<property
name="modedDate"
type="java.util.Date"
update="true"
insert="true"
column="MODED_DATE"
/>

<property
name="activeFlag"
type="int"
update="true"
insert="true"
column="ACTV_FLG"
/>

</class>

</hibernate-mapping>

===============================
The error thrown at runtime is:

[2006-03-14 18:41:00,089][ERROR][HibernateUtils.<clinit>()63]-ERROR: HIBERNATE E
XCEPTION Caught:
org.hibernate.MappingException: An association from the table DOL_REF_BUREAU_COD
ES refers to an unmapped class: java.lang.String
org.hibernate.MappingException: An association from the table DOL_REF_BUREAU_COD
ES refers to an unmapped class: java.lang.String
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configur
ation.java:1134)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:
1052)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1168)
at gov.doj.atf.commons.standard.hibernate.util.HibernateUtils.<clinit>(H
ibernateUtils.java:59)
at gov.doj.atf.commons.standard.filter.HibernateSessionFilter.init(Hiber
nateSessionFilter.java:103)
at com.evermind.server.http.HttpApplication.getFilterConfig(HttpApplicat
ion.java:7471)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletReque
stDispatcher.java:510)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(Ser
vletRequestDispatcher.java:322)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpReques
tHandler.java:790)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
va:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
va:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Relea
sableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:534)

======================
I am making the move from hibernate 3.0 beta to the latest prod release of 3.1.2 ... When I remove the fields of type 'java.lang.String' in the *hbm.xml ... I do not get the problem. I am using Oracle App Server and Oracle db. The fields in the db are VARCHAR2.

Any help would be greatly appreciated!

Thanks!


Top
 Profile  
 
 Post subject: Check your many-to-one relations
PostPosted: Tue Mar 14, 2006 8:38 pm 
Beginner
Beginner

Joined: Mon Mar 14, 2005 6:07 pm
Posts: 36
Hibernate complains about these two mappings:
Code:
<many-to-one  name="createdBy"  class="java.lang.String"  cascade="none" outer-join="auto" update="true" insert="true" column="CREATD_USER_ID"
/>
<many-to-one name="modedBy" class="java.lang.String" cascade="none" outer-join="auto" update="true" insert="true" column="MODED_USER_ID"
/>

Hibernate expects another mapped class, not java.lang.String.

If you have a class representing users, put its full name in place of java.lang.String, like this:

Code:
<many-to-one  name="createdBy"  class="my.pkg.User" cascade="none" outer-join="auto" update="true" insert="true" column="CREATD_USER_ID"
/>
<many-to-one name="modedBy" class="my.pkg.User"cascade="none" outer-join="auto" update="true" insert="true" column="MODED_USER_ID"
/>


I hope this helps.


Top
 Profile  
 
 Post subject: Thanks!
PostPosted: Wed Mar 15, 2006 10:30 am 
Newbie

Joined: Tue Mar 14, 2006 7:35 pm
Posts: 3
I was working with someone else's code and did not pay attention to the XDoclet annotations ... thx for the xtra pair of eyes!


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

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.