Hibernate -- what does this exception mean??
- From: "amatijaca@xxxxxxxxx" <amatijaca@xxxxxxxxx>
- Date: 23 Jun 2005 09:15:02 -0700
Hi there,
I am a relative newbie to Hibernate, and I have managed so far to
persist 2-3 tables, however, on this one table, I am having some real
difficulty. I keep getting this exception:
net.sf.hibernate.id.IdentifierGenerationException: ids for this class
must be manually assigned before calling save():
com.cibc.gdp.tecp.envoy.audit.persistence.PostProcessResults
I had a look at IdentifierGenerationException and the explanation was
not very useful... Below I have included the info... I realy have no
clue what the exception is trying to tell me. The XML looks fine, and
so does the class....
Thanks for all the help!!
Alex.
============================================
My mappings for this table look as:
<class
name="com.cibc.gdp.tecp.envoy.audit.persistence.PostProcessResults"
table="ARCHIVE_CHEQUE">
<id name="prior_event_id" column="EVENT_ID" />
<property name="archive_cheque_id" column="ARCHIVE_CHEQUE_ID" />
<property name="account_number" column="ACC_NMBR" />
<property name="cheque_amount" column="CHEQUE_AMT" />
<property name="transaction_code" column="TRANSACTION_CODE" />
<property name="bank_number" column="BANK_NMBR" />
<property name="transit_number" column="TRANSIT_NMBR" />
</class>
The class PostProcessResults looks like this:
package com.cibc.gdp.tecp.envoy.audit.persistence;
/**
* Date Jun 22, 2005
*
* @author AM509
*/
public class PostProcessResults {
int account_number; //
int cheque_amount; //
int transaction_code; //
int bank_number; //
int transit_number; //
String prior_event_id; //
String archive_cheque_id; //
/**
* @return Returns the account_number.
*/
public int getAccount_number() {
return account_number;
}
/**
* @param account_number The account_number to set.
*/
public void setAccount_number(int account_number) {
this.account_number = account_number;
}
/**
* @return Returns the archive_cheque_id.
*/
public String getArchive_cheque_id() {
return archive_cheque_id;
}
/**
* @param archive_cheque_id The archive_cheque_id to set.
*/
public void setArchive_cheque_id(String archive_cheque_id) {
this.archive_cheque_id = archive_cheque_id;
}
/**
* @return Returns the bank_number.
*/
public int getBank_number() {
return bank_number;
}
/**
* @param bank_number The bank_number to set.
*/
public void setBank_number(int bank_number) {
this.bank_number = bank_number;
}
/**
* @return Returns the cheque_amount.
*/
public int getCheque_amount() {
return cheque_amount;
}
/**
* @param cheque_amount The cheque_amount to set.
*/
public void setCheque_amount(int cheque_amount) {
this.cheque_amount = cheque_amount;
}
/**
* @return Returns the prior_event_id.
*/
public String getPrior_event_id() {
return prior_event_id;
}
/**
* @param prior_event_id The prior_event_id to set.
*/
public void setPrior_event_id(String prior_event_id) {
this.prior_event_id = prior_event_id;
}
/**
* @return Returns the transaction_code.
*/
public int getTransaction_code() {
return transaction_code;
}
/**
* @param transaction_code The transaction_code to set.
*/
public void setTransaction_code(int transaction_code) {
this.transaction_code = transaction_code;
}
/**
* @return Returns the transit_number.
*/
public int getTransit_number() {
return transit_number;
}
/**
* @param transit_number The transit_number to set.
*/
public void setTransit_number(int transit_number) {
this.transit_number = transit_number;
}
}
And the persistence looks like this:
PostProcessAudit ppa = (PostProcessAudit) event;
ppa.prepareForPersistence();
// EverythingForPersistence eftp = new EverythingForPersistence();
// eftp.populatePostProcessAudit(ppa);
PostProcessResults ppr = new PostProcessResults();
ppr.setAccount_number(Integer.parseInt(ppa.getAccount_number()));
ppr.setArchive_cheque_id(ppa.getArchive_cheque_id());
ppr.setBank_number(Integer.parseInt(ppa.getBank_number()));
// ppr.setChannelId(ppa.getChannelId());
ppr.setCheque_amount(Integer.parseInt(ppa.getCheque_amount()));
// ppr.setCurrency_code(Integer.parseInt(ppa.getCurrency_code()));
ppr.setPrior_event_id(ppr.getPrior_event_id());
ppr.setTransaction_code(Integer.parseInt(ppa.getTransaction_code()));
ppr.setTransit_number(Integer.parseInt(ppa.getTransit_number()));
Session session =
HibernateUtil.getInstance(factory).currentSession();
Transaction tx = null;
tx = session.beginTransaction();
session.save(ppr);
tx.commit();
HibernateUtil.closeSession();
.
- Follow-Ups:
- Re: Hibernate -- what does this exception mean??
- From: Georg J. Stach
- Re: Hibernate -- what does this exception mean??
- Prev by Date: Re: Optimization
- Next by Date: Re: Hibernate -- what does this exception mean??
- Previous by thread: Optimization
- Next by thread: Re: Hibernate -- what does this exception mean??
- Index(es):
Relevant Pages
|
|