[Persistence, JBoss/CMP, Hibernate, Database] - 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.jsfapp.model.People".
Any information would be greatly appreciated..
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.
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050345#4050345
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050345
17 years, 5 months
[JBoss Seam] - Re: PAGE context and Ajax4JSF
by jazir1979
Hi Gavin,
Thanks for the reply.
"gavin.king(a)jboss.com" wrote : anonymous wrote : the serialized page state is not available when Ajax4JSF goes through the JSF lifecycle to process the validations
|
| I'm sure that's not correct. Ajax4JSF does resubmit the serialized state back to the server.
|
I'd have thought so too, but I read something on the forums which led me to believe this was the problem (can't find the link now). Perhaps the behaviour I'm seeing is actually to do with my @Factory/@DataModel usage.
Here's what's happening...
| @DataModel(scope = ScopeType.PAGE)
| private List<Batch> batchList;
|
| @Factory("batchList")
| public void search() { ... }
|
Now, every time focus leaves an input box that has Ajax4JSF validation on it, the search() method gets called on the server. I assumed this was because the Ajax4JSF request does not have the page scoped "batchList" available, so the @Factory gets called. What do you think?
"gavin.king(a)jboss.com" wrote :
| anonymous wrote : i wanted the data model to refresh on each request.
|
| Then what you need to do is re-render the whole f:view. If you don't re-render the ViewRoot, then the PAGE scope attributes won't be updated on the client side.
|
| If you use reRender="theViewRootId", everything should work fine.
|
Those requests aren't PPR/ajax.. but thanks for that tip because if I solve the above a4jsf validation problem, I will probably change this later on and I would have just reRender'ed the data table, not the whole view.
cheers,
Daniel.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050340#4050340
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050340
17 years, 5 months
[JBoss jBPM] - Getting a list of the process variables in a process instanc
by lachelt
>From outside of a process instance I want to get visibility into the current state of a process instance (e.g. what are its process variables and their values). For some context? I am showing a list of the process instances, but want to give the client more than just the instance id, process name, start time, end time, etc. I want to give more info that identifies this process instance (to a user) ? which would come from variables in the process instance.
I found that I can get the root token for a process instance, and then construct an ExecutionContext from that which lets me get a variable. This seems sort of overkill. I don?t want to do execution at this point? I just want to see into the process instance. Is this the only/recommended way to do what I want?
Also, is it possible to get a list of the Process Variables in the process instance? I?ve only found the ExecutionContext.getVariable() method ? for which I need to know the name of a specific variable I am interested in.
Thanks,
-Jon
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050338#4050338
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050338
17 years, 5 months