-->
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.  [ 1 post ] 
Author Message
 Post subject: mapping problem with Hibernate 3.2 and jboss 4.2.0
PostPosted: Thu May 31, 2007 7:14 pm 
Newbie

Joined: Thu May 31, 2007 6:11 pm
Posts: 1
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.jsfapp.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">
<property name="show_sql">
true
</property>
<!-- Mapping files -->
<mapping resource="com/ipi/jsfapp/model/People.hbm.xml"/>
</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.jsfapp.model">
<class name="People" table="people" catalog="myDB">
<comment></comment>
<id name="peopleid" type="int">
<column name="peopleid" />
<generator class="native" />
</id>
<property name="firstName" type="string">
<column name="first_name" length="45">
<comment></comment>
</column>
</property>
<property name="middleInitial" type="string">
<column name="middle_initial" length="1">
<comment></comment>
</column>
</property>
<property name="lastName" type="string">
<column name="last_name" length="65">
<comment></comment>
</column>
</property>
</class>
</hibernate-mapping>

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

package com.ipi.jsfapp.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!!


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

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.