After the update, try calling  commit. If you are using 

HibernateSessionManager from 
http://tapestry.apache.org/tapestry5.1/tapestry-hibernate/

call HibernateSessionManager.commit().

Shing 


Home page : http://www.lombok.demon.co.uk/



--- On Sun, 21/2/10, toejoe <to...@hotmail.com> wrote:

> From: toejoe <to...@hotmail.com>
> Subject: sql update of existing table
> To: users@tapestry.apache.org
> Date: Sunday, 21 February, 2010, 0:44
> 
> Hello.
> 
> I am using Tapestry 5.0.18 framework with Netbeans 6.8, MS
> Sqlexpress 2005
> and using hibernate support for accessing database.
> 
> One page is crated for data input. Other one will display
> data from table.
> Input is performed using t:beaneditform and display via
> t:grid. Whatever
> data I enter, it will be successfuly stored in database.
> Grid component will
> display it all. So, this basic part is functioning ok.
> 
> Main entity, Class Servis has 3 attributes : servisid,
> InvNo, Vendor and
> Status.
> Servisid is generated value:
>  �...@id
>  �...@generatedvalue
>    private Long servisid; 
> so it is incremented for every new row and is unique.
> 
> To store data after clicking on submit/update in
> beaneditform, I use the
> following code:
>     @CommitAfter
>     public Object onSuccess(){ 
>       Servis temp = new Servis();
>       temp.setInvno(servis.getInvno());
>       temp.setVendor(servis.getVendor());
>       temp.setStatus(servis.getStatus());
>       session.save(temp);
>       return start;
>     }
> 
> I have customized grid component to display additional
> column which would be
> used to change status attribute.
> Tml file :
>         <t:grid source="list"
> row="servis" add="change">
>             <t:parameter
> name="changeCell">
>                
> <t:actionlink t:id="change"
> context="servis.servisid">Set
> TRUE</t:actionlink>
>            
> </t:parameter>
>         </t:grid>
> 
> Java class. I use following method to display only rows
> with status = FALSE
> 
>    public List getList() {
>       Criteria crit =
> getSession().createCriteria(Servis.class);
>       crit.add(Restrictions.eq("status",
> Status.FALSE));
>       return crit.list();
>       }
> 
> Now, I want to update value of status by clicking on Set
> TRUE in grid
> component. I tried with several variants like this:
> 
>    Object onActionFromChange(long id) {
>       SQLQuery query =
> getSession().createSQLQuery("UPDATE tblServis SET
> status = 'TRUE' WHERE servisid = "+id);
>       query.executeUpdate();
>       return start;
>       }
> 
> It won't update table. I also get no exception. Clicking on
> Set TRUE will
> drive me to start page. I tested and I definitely get
> appropriate id from
> grid.
> Can somebody suggest me what should I do to accomplish
> table update?
> 
> Thanks in advance.
> -- 
> View this message in context: 
> http://old.nabble.com/sql-update-of-existing-table-tp27667156p27667156.html
> Sent from the Tapestry - User mailing list archive at
> Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 
> 




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

Reply via email to