[jboss-user] [JBoss Seam] - How to insert a timestamp to a Not Nullable column from a fo

anarinsky do-not-reply at jboss.com
Thu Apr 5 18:15:25 EDT 2007


I have a class that contains a Date property - timestamp.  Also, I have a form for persisting this object in the database. This form was created by the seam generator.  In the database the timestamp is not nullable. 

The timestamp should be equal to a current time. A user should not insert it.  So I removed this field from the form and changed the setter for this property

public void setTimestamp(Date time) {
		if (time==null)
		{
			timestamp = new Date();
		}
	this.timestamp = time;
	}

However, the persisting mechanism does not use this setter. As a result I am getting the exception:
Exception during request processing: javax.servlet.ServletException: #{projNotesHome.persist}: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: : com.scea.spot4.ProjNotes.timestamp

Any suggestion?


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035180#4035180

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035180



More information about the jboss-user mailing list