-->
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.  [ 2 posts ] 
Author Message
 Post subject: @OneToMany mapping issue on UPDATE
PostPosted: Thu Dec 10, 2009 5:28 pm 
Newbie

Joined: Thu Dec 10, 2009 5:22 pm
Posts: 1
I get the following error when I do an update..

16:00:58,629 DEBUG [JDBCExceptionReporter] Could not execute JDBC batch update [update PAY set OPERATOR_DT=?, OPERATOR_ID=?, ACCOUNT_ID=?, AMOUNT=?, BATCH_ID=?, NOTE=?, CREATE_DT=?, INST_ID=?, IDNAME=?, STATEMENT_ID=?, STATUS_ID=?, EVENT_ID=?, EVENT_DT=?, PATIENT_ID=?, PLAN_ID=?, SCHEDULE_ID=?, STUDY_NUM=? where PAYMENT_ID=?]
java.sql.BatchUpdateException: ORA-01407: cannot update ("MY_SCHEMA"."PAY"."EVENT_DT") to NULL

at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10768)

------------------------------------------------------------------------
Classes >>

@Entity
@Table(name = "STATEMENT")
public class Statement extends DomainObject implements IPay
{
...
...
@OneToMany(mappedBy = "statement", cascade = { CascadeType.ALL })
@org.hibernate.annotations.Cascade(value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
private final List<Payment> payments = new ArrayList<Payment();
...
...
}


@Entity
@Table(name = "PAY")
public abstract class Payment extends DomainObject
{
...
@Temporal(TemporalType.DATE)
@Column(name = "EVENT_DT", insertable = false, updatable = false)
protected Calendar eventDate = Calendar.getInstance();
...
@ManyToOne
@JoinColumn(name = "STATEMENT_ID")
private Statement statement;
...
...
}

--------------------------------------------------------------------------------------

Any ideas what could be the issue?
As the error message indicates EVENT_DT column in table "PAY" is not nullable. Debugger shows there are valid values for event date. Therefore this must be a mapping issue.


Top
 Profile  
 
 Post subject: Re: @OneToMany mapping issue on UPDATE
PostPosted: Fri Dec 11, 2009 5:25 am 
Regular
Regular

Joined: Thu Sep 06, 2007 2:22 am
Posts: 108
Location: Noida,India
Problem with -
Code:
@Column(name = "EVENT_DT", insertable = false, updatable = false)

remove
Code:
insertable = false, updatable = false


Then final annotation will be -
Code:
@Column(name = "EVENT_DT")


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