-->
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.  [ 3 posts ] 
Author Message
 Post subject: net.sf.hibernate.MappingException
PostPosted: Sun Jul 25, 2004 8:06 pm 
Beginner
Beginner

Joined: Wed Jul 21, 2004 8:12 pm
Posts: 35
Hello Everyone:

I have a two classes Queue and Ticket. There is a one-to-many relation between the Queue and Ticket class. However, when I run my code to add a ticket to Queue, I get the following exception (the xml and java files are after the stact Trace):

[7/25/04 19:47:39:500 EDT] 5697dbcc Configuration I net.sf.hibernate.cfg.Configuration Configuration resource: /hibernate.cfg.xml

[7/25/04 19:47:39:812 EDT] 5697dbcc Configuration I net.sf.hibernate.cfg.Configuration Mapping resource: ccol/dbo/Ticket.hbm.xml

[7/25/04 19:47:40:031 EDT] 5697dbcc Binder I net.sf.hibernate.cfg.Binder Mapping class: ccol.dbo.Ticket -> Ticket

[7/25/04 19:47:40:312 EDT] 5697dbcc Configuration E net.sf.hibernate.cfg.Configuration Could not compile the mapping document

[7/25/04 19:47:40:344 EDT] 5697dbcc Configuration E net.sf.hibernate.cfg.Configuration TRAS0014I: The following exception was logged net.sf.hibernate.MappingException: Could not find class: Queue
at net.sf.hibernate.cfg.Binder.bindManyToOne(Binder.java:611)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1010)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:352)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1229)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:315)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:973)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:856)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:842)
at at ccol.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:33).null(Unknown Source)
at actions.AddTicketAction.execute(AddTicketAction.java:40)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)

Here is the mapping file for Ticket:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping>

<class name="ccol.dbo.Ticket" table="Ticket">

<id name="id" column="Ticket_ID" type="long">
<generator class="native" />
</id>

<property name="ticketNumber" type="integer" column="ticketNumber" not-null="true" unique="true" />

<property name="ticketStatus" type="string" column="ticketStatus" length="10" not-null="true" />

<property name="openedTimeStamp" type="timestamp" column="time_Opened" not-null="true" />

<property name="routedTimeStamp" type="timestamp" column="time_Routed" />

<property name="reopenedTimeStamp" type="timestamp" column="time_Reopened" />

<property name="closedCancelledTimeStamp" type="timestamp" column="time_ClosedCancelled" />

<property name="customerCNUM" type="string" column="customerCNUM" length="9" not-null="true" />

<property name="customerAltPhone" type="string" column="customerAltPhone" length="30" />

<property name="customerAltEmail" type="string" column="customerAltEmail" length="100" />

<property name="customerLocation" type="string" column="customerLocation" length="30" not-null="true" />

<property name="ticketCheckedOutByCNUM" type="string" column="assignee" length="9" />

<property name="ticketSummary" type="string" column="ticketSummary" length="100" not-null="true" />

<property name="ticketScratchPad" type="string" column="ticketScratchPad" length="100" />

<property name="customerEmailFlag" type="yes_no" column="customerEmailFlag" />

<property name="customerPriority" type="short" column="customerPriority" />

<property name="componentKeywords" type="string" column="componentKeywords" length="100" />

<property name="ticketHistory" type="clob" column="history" />

<property name="customerDoNotSurveyFlag" type="yes_no" column="doNotSurveyFlag" />

<many-to-one name="queue" column="Queue_ID" class="Queue" not-null="true" />
</class>
</hibernate-mapping>

Here is Ticket.java

package ccol.dbo;

import java.sql.Clob;
import java.sql.Timestamp;

public class Ticket {

private Long id;
private int ticketNumber;
private short customerPriority;

private String ticketStatus;
private String customerCNUM;
private String customerAltPhone;
private String customerAltEmail;
private String customerLocation;
private String ticketCheckedOutByCNUM;
private String ticketSummary;
private String ticketScratchPad;
private String componentKeywords;

private Timestamp openedTimeStamp;
private Timestamp routedTimeStamp;
private Timestamp reopenedTimeStamp;
private Timestamp closedCancelledTimeStamp;

private boolean customerEmailFlag;
private boolean customerDoNotSurveyFlag;

private Clob ticketHistory;

private Queue queue;

public Ticket() {
id = null;
ticketNumber = 0;
customerPriority = 0;
ticketStatus = null;
customerCNUM = null;
customerAltPhone = null;
customerAltEmail = null;
customerLocation = null;
ticketCheckedOutByCNUM = null;
ticketSummary = null;
ticketScratchPad = null;
componentKeywords = null;

openedTimeStamp = null;
routedTimeStamp = null;
reopenedTimeStamp = null;
closedCancelledTimeStamp = null;

customerEmailFlag = false;
customerDoNotSurveyFlag = false;

}

public Timestamp getClosedCancelledTimeStamp() {
return closedCancelledTimeStamp;
}

public String getComponentKeywords() {
return componentKeywords;
}

public String getCustomerAltEmail() {
return customerAltEmail;
}

public String getCustomerAltPhone() {
return customerAltPhone;
}

public String getCustomerCNUM() {
return customerCNUM;
}

public boolean isCustomerDoNotSurveyFlag() {
return customerDoNotSurveyFlag;
}

public boolean isCustomerEmailFlag() {
return customerEmailFlag;
}

public String getCustomerLocation() {
return customerLocation;
}

public short getCustomerPriority() {
return customerPriority;
}

public Long getId() {
return id;
}

public Timestamp getOpenedTimeStamp() {
return openedTimeStamp;
}

public Timestamp getReopenedTimeStamp() {
return reopenedTimeStamp;
}

public Timestamp getRoutedTimeStamp() {
return routedTimeStamp;
}

public String getTicketCheckedOutByCNUM() {
return ticketCheckedOutByCNUM;
}

public Clob getTicketHistory() {
return ticketHistory;
}


public int getTicketNumber() {
return ticketNumber;
}

public String getTicketScratchPad() {
return ticketScratchPad;
}

public String getTicketStatus() {
return ticketStatus;
}

public String getTicketSummary() {
return ticketSummary;
}

public Queue getQueue() {
return queue;
}

public void setClosedCancelledTimeStamp(Timestamp timestamp) {
closedCancelledTimeStamp = timestamp;
}

public void setComponentKeywords(String string) {
componentKeywords = string;
}

public void setCustomerAltEmail(String string) {
customerAltEmail = string;
}

public void setCustomerAltPhone(String string) {
customerAltPhone = string;
}

public void setCustomerCNUM(String string) {
customerCNUM = string;
}

public void setCustomerDoNotSurveyFlag(boolean b) {
customerDoNotSurveyFlag = b;
}

public void setCustomerEmailFlag(boolean b) {
customerEmailFlag = b;
}

public void setCustomerLocation(String string) {
customerLocation = string;
}

public void setCustomerPriority(short s) {
customerPriority = s;
}

public void setId(Long l) {
id = l;
}

public void setOpenedTimeStamp(Timestamp timestamp) {
openedTimeStamp = timestamp;
}

public void setReopenedTimeStamp(Timestamp timestamp) {
reopenedTimeStamp = timestamp;
}

public void setRoutedTimeStamp(Timestamp timestamp) {
routedTimeStamp = timestamp;
}

public void setTicketCheckedOutByCNUM(String string) {
ticketCheckedOutByCNUM = string;
}

public void setTicketHistory(Clob clob) {
ticketHistory = clob;
}

public void setTicketNumber(int i) {
ticketNumber = i;
}

public void setTicketScratchPad(String string) {
ticketScratchPad = string;
}

public void setTicketStatus(String string) {
ticketStatus = string;
}

public void setTicketSummary(String string) {
ticketSummary = string;
}

public void setQueue(Queue queue) {
this.queue = queue;
}

}

Mapping file for Queue:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping>

<class name="ccol.dbo.Queue" table="Queue">

<id name="id" column="Queue_ID" type="long">
<generator class="native" />
</id>

<property name="queueName" type="string" column="qName" length="30" not-null="true" unique="true" />

<property name="queueStatus" type="string" column="qStatus" length="8" not-null="true" />

<property name="queueTeamName" type="string" column="qTeamName" length="100" />

<property name="queueDescription" type="string" column="qDescription" length="1000" />

<property name="queueKeywords" type="string" column="qKeywords" length="200" />

<set name="tickets" inverse="true" cascade="save-update">
<key column="Queue_ID" />
<one-to-many class="Ticket" />
</set>

</class>
</hibernate-mapping>


and finally Queue.java

package ccol.dbo;

import java.util.HashSet;
import java.util.Set;

public class Queue {

private Long id;

private String queueName;
private String queueStatus;
private String queueTeamName;
private String queueDescription;
private String queueKeywords;

private Set tickets;

public Queue() {
id = null;
queueName = null;
queueStatus = null;
queueTeamName = null;
queueDescription = null;
queueKeywords = null;
tickets = new HashSet();
}


public Long getId() {
return id;
}

public String getQueueDescription() {
return queueDescription;
}

public String getQueueKeywords() {
return queueKeywords;
}

public String getQueueName() {
return queueName;
}
public String getQueueStatus() {
return queueStatus;
}

public String getQueueTeamName() {
return queueTeamName;
}

public Set getTickets() {
return tickets;
}

public void addTickets(Ticket ticket) {
ticket.setQueue(this);
tickets.add(ticket);
}


public void setId(Long l) {
id = l;
}

public void setQueueDescription(String string) {
queueDescription = string;
}

public void setQueueKeywords(String string) {
queueKeywords = string;
}

public void setQueueName(String string) {
queueName = string;
}

public void setQueueStatus(String string) {
queueStatus = string;
}

public void setQueueTeamName(String string) {
queueTeamName = string;
}

public void setTickets(Ticket ticket) {
ticket.setQueue(this);
tickets.add(ticket);
}

}

I would greatly appreciate if someone gives me a hint at where the source of problem is. Thanks is advance


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 25, 2004 8:08 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Hibernate doesn't load your Queue.hbm.xml. Check your configuration.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: my cofig file
PostPosted: Sun Jul 25, 2004 9:13 pm 
Beginner
Beginner

Joined: Wed Jul 21, 2004 8:12 pm
Posts: 35
Here is my Config file, I do not know why it can not load my Queue.hbm.xml. Do I have anything wrong here?

<hibernate-configuration>

<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory
name="java:comp/env/hibernate/SessionFactory">

<!-- properties -->
<property name="hibernate.connection.driver_class">COM.ibm.db2.jdbc.app.DB2Driver</property>
<property name="hibernate.dialect">net.sf.hibernate.dialect.DB2Dialect</property>
<property name="hibernate.connection.url">jdbc:db2:ccol</property>
<property name="hibernate.connection.username">dbadmin</property>
<property name="hibernate.connection.password">ccol</property>

<!-- mapping files -->
<mapping resource="ccol/dbo/Ticket.hbm.xml"/>
<mapping resource="ccol/dbo/Queue.hbm.xml"/>


</session-factory>

</hibernate-configuration>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.