-->
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.  [ 2 posts ] 
Author Message
 Post subject: getting MappingException: persistent class [xxxx] not found
PostPosted: Tue Jun 22, 2004 3:21 pm 
Beginner
Beginner

Joined: Tue Jun 22, 2004 3:16 pm
Posts: 35
I am new to Hibernate. I have a small test program that tries to read data from database and display it.

public class Test {
public static void main(String[] args) throws Exception{

// configuration
//Configuration cfg = new Configuration().addClass(AddressType.class);
Configuration cfg = new Configuration().addResource("AddressType.hbm.xml");
SessionFactory sft = cfg.buildSessionFactory();

// open session
Session session = sft.openSession();

// search query
String search = "select a from AddressType as a";

// search and return
Collection list = session.find(search);
for(Iterator i = list.iterator(); i.hasNext();){
AddressType addressType = (AddressType)i.next();
System.out.println("address type: " + addressType.getAddressType()
+ ", description: " + addressType.getDescription());
}
}
}

The AddressType.hbm.xml looks like this and it is in the same directory as the Test file. The AddressType.java is under the same directory too.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="com.bcbsma.regdomain.common.type.AddressType"
table="TBL_ADDRTYPE">
<id name="addressType" type="string"
unsaved-value="null">
<column name="ADDRTYPE" sql-type="VARCHAR2(1)"
not-null="true"/>
<generator class="uuid.hex"/>
</id>
<property name="description">
<column name="DESCRIPTION" sql-type="VARCHAR2(20)"
not-null="false"/>
</property>
</class>
</hibernate-mapping>

Any thing wrong?

Thanks,

jw


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 23, 2004 11:18 am 
Beginner
Beginner

Joined: Mon Jun 07, 2004 4:21 pm
Posts: 44
Location: Boston
Do you have the package name in the class ( I am sure you do :) )?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.