[jboss-user] [Installation, Configuration & Deployment] - jboss 4.2 Hibernate 3.2 entity mapping problem

cgrahamatip do-not-reply at jboss.com
Thu May 31 17:54:16 EDT 2007


I am trying to get a test jsf application to work on the standard jboss 4.2.0 AS server.  I am using eclipse as the IDE. I set the build path in my eclipse project to point to jboss/default/lib jar files for hibernate and other required jars. 

when I deployed the application everythings works as it should until I make a call from a backing bean to query or load a hibernate class.  I get the following error:  "org.hibernate.MappingException: Unknown entity: com.ipi.InformationPortal.model.People".

The configuration snippets are:

########hibernate.cfg.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>
<session-factory name="mdp-sf">
      
      		true
      
      <!-- Mapping files -->
      
</session-factory>
</hibernate-configuration>

###############  hibernate.properties #################
..
## MySQL

hibernate.dialect org.hibernate.dialect.MySQLDialect
#hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect
#hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql://localhost/myDB
hibernate.connection.username username
hibernate.connection.password xxxxxxx
..

########### People.hbm.xml #######################
<?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 May 27, 2007 7:19:14 PM by Hibernate Tools 3.2.0.beta7 -->
<hibernate-mapping package="com.ipi.InformationPortal.model">

        
        
            
            
        
        
            
                
            
        
        
            
                
            
        
        
            
                
            
        
    
</hibernate-mapping>

#############  People.java ######################

package com.ipi.InformationPortal.model;
// Generated May 27, 2007 7:19:11 PM by Hibernate Tools 3.2.0.beta7



/**
 * People generated by hbm2java
 */
public class People  implements java.io.Serializable {

    // Fields    

     private int peopleid;
     private String firstName;
     private String middleInitial;
     private String lastName;

     // Constructors

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

	/** minimal constructor */
    public People(int peopleid) {
        this.peopleid = peopleid;
    }
    /** full constructor */
    public People(int peopleid, String firstName, String middleInitial, String lastName) {
       this.peopleid = peopleid;
       this.firstName = firstName;
       this.middleInitial = middleInitial;
       this.lastName = lastName;
    }
   
    // Property accessors
    public int getPeopleid() {
        return this.peopleid;
    }
    
    public void setPeopleid(int peopleid) {
        this.peopleid = peopleid;
    }
    public String getFirstName() {
        return this.firstName;
    }
    
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    public String getMiddleInitial() {
        return this.middleInitial;
    }
    
    public void setMiddleInitial(String middleInitial) {
        this.middleInitial = middleInitial;
    }
    public String getLastName() {
        return this.lastName;
    }
    
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

}


############### backing bean call ####################
 
  public static suggestionBean getSuggestionBean() {

    int peopleid = 1;
    Configuration cfg = new Configuration();
    SessionFactory sf = cfg.buildSessionFactory();
    String address = randomString(suggestedAddresses);
    String password = randomString(chars, 8);
    /*
     * Insert some hibernate to get the user name from db.
     */
    People p = new People();
    Session session = sf.openSession();

    p = (People) session.load(People.class, peopleid);

    password = p.getFirstName();
    address = p.getLastName();
    session.close();
    return(new suggestionBean(address, password));
  }

#############################################
The hibernate configuration files are at the root of the jsf app.

Any input would be greatly appreciated!!


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050328#4050328

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050328



More information about the jboss-user mailing list