OK, here is the code that caused my problems:
Code:
try{
Session sess = HibernateSessionFactory.getCurrentSession();
<snip>.db.mappings.TOrder hOrder = new <snip>.db.mappings.TOrder();
CopyBeanUtil.copy(order, hOrder);
hOrder.setCustomer(loadHCustomer(customerid));
hOrder.setVat(loadHVat(order.getVatid()));
hOrder.setReseller(loadHReseller(order.getResellerid()));
hOrder.setAccount(loadHAccount(order.getAccountid()));
hOrder.setCampaignid(order.getCampaignid() );
Long result = (Long) sess.save(hOrder);
System.err.println("~~~~ "+hOrder.getOrderid()+" ~~~~");
System.err.println("~~~~ "+hOrder.getCampaignid()+" ~~~~");
return result;
} catch (Exception he) {
he.printStackTrace();
}
the mapping:
Code:
package <snip>.db.mappings;
// Generated 19.07.2006 11:28:25 by Hibernate Tools 3.1.0.beta5
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
public class TOrder implements java.io.Serializable {
// Fields
private Long orderid;
private Date lastUpdated;
private String status;
private String txhandle;
private Long parentorderid;
private Long processinstanceid;
private Long portalid;
private Date billingdate;
private BigDecimal billingamount;
private BigDecimal netbillingamount;
private Long paymentperiod;
private Date actualcancellationdate;
private Boolean ebanking;
private BigDecimal dunningcosts;
private Date dunningdate;
private String customerip;
private BigDecimal netsubtotal;
private String remarks;
private Set orderitems = new HashSet(0);
private Vat vat;
private Customer customer;
private Reseller reseller;
private Account account;
private Invoices invoice;
private String currency;
private Long campaignid;
// Constructors
/** default constructor */
public TOrder() {
}
/** minimal constructor */
public TOrder(String status, Customer customer) {
this.status = status;
this.customer = customer;
}
/** full constructor */
public TOrder(String status, String txhandle, Long parentorderid, Long processinstanceid, Long portalid, Date billingdate, BigDecimal billingamount, BigDecimal netbillingamount, Long paymentperiod, Date actualcancellationdate, boolean banking,BigDecimal dunningcosts, Date dunningdate, String customerip,BigDecimal netsubtotal, String remarks, Set orderitems, Vat vat, Customer customer, Reseller reseller, Account account,Invoices invoice) {
this.status = status;
this.txhandle = txhandle;
this.parentorderid = parentorderid;
this.processinstanceid = processinstanceid;
this.portalid = portalid;
this.billingdate = billingdate;
this.billingamount = billingamount;
this.netbillingamount = netbillingamount;
this.paymentperiod = paymentperiod;
this.actualcancellationdate = actualcancellationdate;
this.ebanking = ebanking;
this.dunningcosts = dunningcosts;
this.dunningdate = dunningdate;
this.customerip = customerip;
this.netsubtotal = netsubtotal;
this.remarks = remarks;
this.orderitems = orderitems;
this.vat = vat;
this.customer = customer;
this.reseller = reseller;
this.account = account;
this.invoice = invoice;
}
public Long getOrderid() {
return this.orderid;
}
public void setOrderid(Long orderid) {
this.orderid = orderid;
}
public Date getLastUpdated() {
return this.lastUpdated;
}
public void setLastUpdated(Date lastUpdated) {
this.lastUpdated = lastUpdated;
}
public String getStatus() {
return this.status;
}
public void setStatus(String status) {
this.status = status;
}
public String getTxhandle() {
return this.txhandle;
}
public void setTxhandle(String txhandle) {
this.txhandle = txhandle;
}
public Long getParentorderid() {
return this.parentorderid;
}
public void setParentorderid(Long parentorderid) {
this.parentorderid = parentorderid;
}
public Long getProcessinstanceid() {
return this.processinstanceid;
}
public void setProcessinstanceid(Long processinstanceid) {
this.processinstanceid = processinstanceid;
}
public Long getPortalid() {
return this.portalid;
}
public void setPortalid(Long portalid) {
this.portalid = portalid;
}
public Date getBillingdate() {
return this.billingdate;
}
public void setBillingdate(Date billingdate) {
this.billingdate = billingdate;
}
public BigDecimal getBillingamount() {
return this.billingamount;
}
public void setBillingamount(BigDecimal billingamount) {
this.billingamount = billingamount;
}
public BigDecimal getNetbillingamount() {
return this.netbillingamount;
}
public void setNetbillingamount(BigDecimal netbillingamount) {
this.netbillingamount = netbillingamount;
}
public Long getPaymentperiod() {
return this.paymentperiod;
}
public void setPaymentperiod(Long paymentperiod) {
this.paymentperiod = paymentperiod;
}
public Date getActualcancellationdate() {
return this.actualcancellationdate;
}
public void setActualcancellationdate(Date actualcancellationdate) {
this.actualcancellationdate = actualcancellationdate;
}
public Boolean getEbanking() {
return this.ebanking;
}
public void setEbanking(Boolean ebanking) {
this.ebanking = ebanking;
}
public BigDecimal getDunningcosts() {
return this.dunningcosts;
}
public void setDunningcosts(BigDecimal dunningcosts) {
this.dunningcosts = dunningcosts;
public Date getDunningdate() {
return this.dunningdate;
}
public void setDunningdate(Date dunningdate) {
this.dunningdate = dunningdate;
}
public String getCustomerip() {
return this.customerip;
}
public void setCustomerip(String customerip) {
this.customerip = customerip;
}
public BigDecimal getNetsubtotal() {
return this.netsubtotal;
}
public void setNetsubtotal(BigDecimal netsubtotal) {
this.netsubtotal = netsubtotal;
}
public String getRemarks() {
return this.remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public Set getOrderitems() {
return this.orderitems;
}
public void setOrderitems(Set orderitems) {
this.orderitems = orderitems;
}
public Vat getVat() {
return this.vat;
}
public void setVat(Vat vat) {
this.vat = vat;
}
public Customer getCustomer() {
return this.customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public Reseller getReseller() {
return this.reseller;
}
public void setReseller(Reseller reseller) {
this.reseller = reseller;
}
public Account getAccount() {
return this.account;
}
public void setAccount(Account account) {
this.account = account;
}
public Invoices getInvoice() {
return this.invoice;
}
public void setInvoice(Invoices invoice) {
this.invoice = invoice;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public Long getCampaignid() {
return campaignid;
}
public void setCampaignid(Long campaignid) {
this.campaignid = campaignid;
}
}
it prints:
Quote:
11:03:05,042 ERROR [STDERR] ~~~~ 9433 ~~~~
11:03:05,042 ERROR [STDERR] ~~~~ 3 ~~~~
from postgreSQL:
Code:
select * from t_order where orderid=9433;
orderid | lastupdated | status | txhandle | parentorderid | processinstanceid | billingdate | billingamount | netbillingamount | paymentperiod | actualcancellationdate | ebanking | dunningcosts | dunningdate | customerip | netsubtotal | remarks | vatid | contactid | resellerid | accountid | invoiceid | portalid | currency | campaignid
---------+-------------------------+-----------------------+----------+---------------+-------------------+-------------------------+---------------+------------------+---------------+------------------------+----------+--------------+-------------+--------------+-------------+---------+-------+-----------+------------+-----------+-----------+----------+----------+------------
9433 | 2006-12-14 11:03:55.376 | ORDER_WAITING_PAYMENT | | | | 2006-12-14 11:03:43.158 | 64.87 | 54.06 | | | | | | 62.116.8.105 | 54.06 | | 1 | 15577 | | 7206 | 5197 | 3 | EUR |
(1 row)