-->
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: persistent class not mapped
PostPosted: Wed Aug 02, 2006 8:31 pm 
Beginner
Beginner

Joined: Tue Feb 07, 2006 10:39 pm
Posts: 46
i have the persistent class as follow:

public class MCategory implements java.io.Serializable, TableData {
Code:

    // Fields   

     private String category;
     private String description;


    // Constructors

    /** default constructor */
    public MCategory() {
    }

   /** minimal constructor */
    public MCategory(String category) {
        this.category = category;
    }
   
    /** full constructor */
    public MCategory(String category, String description) {
        this.category = category;
        this.description = description;
    }
   
    // Property accessors

    public String getDescription() {
        return this.description;
    }
   
    public void setDescription(String description) {
        this.description = description;
    }

   public String getCategory() {
      return category;
   }

   public void setCategory(String category) {
      this.category = category;
   }

   
}

the mapping file is as below:

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">
<!-- Generated Apr 20, 2006 9:01:24 AM by Hibernate Tools 3.1.0 beta3 -->
<hibernate-mapping>
    <class name="my.com.shinyang.ilms.model.MCategory" table="m_category">
        <id name="category" type="string">
            <column name="CATEGORY" length="20" />
            <generator class="assigned" />
        </id>
        <property name="description" type="string">
            <column name="DESCRIPTION" length="100" />
        </property>
    </class>
</hibernate-mapping>



and i try to add the category by using the session bean as below:

Code:
ses = ThreadLocalSession.currentSession();   
ses.save(category);
ses.flush();
return category;

but when i try to save the object, it returns the wrror: "MCategory is not mapped' in server.
any good suggestion???


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 02, 2006 11:31 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Did you remember to add the mapping file to your config file?

_________________
Code tags are your friend. Know them and use them.


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.