Meaningless Drivel is fun!*
The moose likes Object Relational Mapping and the fly likes MappingException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "MappingException" Watch "MappingException" New topic
Author

MappingException

Gaurav Chikara
Ranch Hand

Joined: Jun 09, 2000
Posts: 410
I have the following snippet of code from hibernate-config.xml file and
UserGovtEduRef.hbm.xml

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory
name="hibernate/SessionFactory">
<property name="hibernate.show_sql">false</property>
<!-- properties -->
<property name="hibernate.connection.datasource">jdbc/cplg</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>

<mapping resource="Account.hbm.xml"/>

<mapping resource="SymomCplgLookup.hbm.xml"/>
<mapping resource="UserRole.hbm.xml"/>
<mapping resource="UserGovtEduRef.hbm.xml"/>


</session-factory>



</hibernate-configuration>




And in my UserGovtEduRef.hbm.xml this is the code
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping default-cascade="all" default-lazy="false">

<class name="com.symantec.qg.bo.UserGovtEduRefBO" table="QG_BUYING_PROGRAM_MAP">
<id name="bpmId" type="long" >
<generator class="native"/>
</id>
<property name="isGovtCountry" column="GOV_COUNTRY"/>
<property name="isEduCountry" column="EDU_COUNTRY"/>
</class>

<query name="lookupGovtPrograms">
select distinct gov_country from UserGovtEduRefBO where edu_country ='Y' and country_id= ?
</query>

<query name="lookupEduPrograms">
select distinct edu_country from UserGovtEduRefBO where gov_country = 'Y' and country_id = ?
</query>

</hibernate-mapping>

The Object class UserGovtEduRefBO is created in the jar file and is always found

But when I start my application server It throws me following stacktrace
[7/25/06 13:11:26:133 PDT] 0000003b Configuration E TRAS0014I: The following exception was logged org.hibernate.MappingException: class com.symantec.qg.bo.GovtEduProgBO not found while looking for property: isGovtCountry

After this also follwing stacktrace crie for same missing UserGovtEduRefBO.class

Since I am new to Hibernate I am not sure what missing pieces I need to assemble ot make it work

If any one has come across same scenario and has solution then please help me also

Thanks in advance



:roll:


SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
Scott Johnson
Ranch Hand

Joined: Aug 24, 2005
Posts: 518
The app server's classloaders can't find the class anywhere in it's classpath.

Is class name spelled correctly in the mapping file? Assuming the class is deployed in a jar, is the jar in the application's or the app server's classpath? Are the permissions correct on the jar?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: MappingException
 
Similar Threads
NullPointerException on SessionFactory sessionFactory = new Configuration().configure().buildSession
Dialect class not found
query on Hibernate
Sybase stored proc error
Hibernate query not mapped