[Installation, Configuration & Deployment] - jboss 4.2 Hibernate 3.2 entity mapping problem
by cgrahamatip
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
17 years, 6 months
[JBoss Seam] - PAGE context and Ajax4JSF
by jazir1979
Hi all,
Are there any plans (is it even technically possible?) to get PAGE scoped components to work with a page that uses Ajax4JSF?
I was using a PAGE-scoped @Factory @DataModel previously, to display data to the user that gets modified by other asynchronous processes - ie: i wanted the data model to refresh on each request. However, this failed when I had form fields with Ajax4JSF because the serialized page state is not available when Ajax4JSF goes through the JSF lifecycle to process the validations.
I had to solve it by using a long-running conversation with judicious use of @End on most of the other actions on my bean, which seems a bit of a hack.
Is there a better way? Or should I just avoid the a4JSF validation and PPR on this kind of page?
thanks kindly,
Daniel.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050327#4050327
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050327
17 years, 6 months
[JBossCache] - Re: Exclusive lock on bottom (leaf) node only?
by FredrikJ
Using repeatable read as transaction isolation will not stop concurrent read access to the node if i'm not mistaken.
My interpretation is that atijms want to get an exclusive lock on '/a/b/n1' regardless of read or write operation. If this is correct then repeatable_read would not solve the issue.
I have actually the same requirement, I need to access a node and lock that node (and that node only) excusively. I do not want to write-lock the parent nodes. If I use Option.setForceWriteLock() , then all nodes are write locked.
So far, I have found two working solutions, none which are pretty imho.
1. Perform a write operation such as remove(...) first when accessing the node. That acquires a write lock during the transaction right away. Not very performance wise I would gather though =)
2. Make your own locking scheme. I implemented this, it doesn't feel right (feels like a true hack), but it works for me. First I get the lock from the node, add the lock to my transaction. Then I acquireAll on the node for read locks and finally acquire write lock on the leaf node only.
I'd be real happy if there was an option we could provide (similar to Options.setForceWriteLock()) that let us readlock the branch and write lock the leaf node only...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050321#4050321
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050321
17 years, 6 months