You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by 滕训华 <te...@magic-sw.com.cn> on 2008/06/16 10:31:28 UTC

Save error

In my edit tml page there are two methods:

         void onActivate(long customerId){

       customer=customerManager.getCustomerByCustomerId(customerId);

       customer.setCustomerName("afasdfasdfasdf");

       customerManager.saveCustomer(customer);

       System.out.println(customer.getCustomerId());

    }

 

Object onSuccess(){

    

       customerManager.saveCustomer(customer);

       return Customers.class;

       

    }

And my DAO Impl is: 

 

    public boolean saveCustomer(TblCustomerInfo customerInfo) {

       

       getHibernateTemplate().update(customerInfo);  

       return true;

    }

 

But when the saveCustomer method can be called correctly,and in the
onSuccess,It will give me an error:

Batch update returned unexpected row count from update [0]; actual row
count: 0; expected: 1; nested exception is
org.hibernate.StaleStateException: Batch update returned unexpected row
count from update [0]; actual row count: 0; expected: 1

 

How to slove this?

 


答复: Save error

Posted by 滕训华 <te...@magic-sw.com.cn>.
I monitored the value of customer.customerId in the onSuccess.I found now it
is zero.But why is it zero? I have found it has the correct value in the
onActivate.Why it is changed into zero in the onSuccess?

My tml page is: 

<t:beaneditform t:id="customer" >
	 	<t:parameter name="remark">
	 		<t:label for="remark"/>
	 		<t:TextArea t:id="remark" value="customer.remark"
cols="50" rows="10" />
	 	</t:parameter>
	 </t:beaneditform>

-----邮件原件-----
发件人: 滕训华 [mailto:tengxh@magic-sw.com.cn] 
发送时间: 2008年6月16日 16:31
收件人: 'Tapestry users'
主题: Save error

In my edit tml page there are two methods:

         void onActivate(long customerId){

       customer=customerManager.getCustomerByCustomerId(customerId);

       customer.setCustomerName("afasdfasdfasdf");

       customerManager.saveCustomer(customer);

       System.out.println(customer.getCustomerId());

    }

 

Object onSuccess(){

    

       customerManager.saveCustomer(customer);

       return Customers.class;

       

    }

And my DAO Impl is: 

 

    public boolean saveCustomer(TblCustomerInfo customerInfo) {

       

       getHibernateTemplate().update(customerInfo);  

       return true;

    }

 

But when the saveCustomer method can be called correctly,and in the
onSuccess,It will give me an error:

Batch update returned unexpected row count from update [0]; actual row
count: 0; expected: 1; nested exception is
org.hibernate.StaleStateException: Batch update returned unexpected row
count from update [0]; actual row count: 0; expected: 1

 

How to slove this?

 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org