Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.mpos.controller; import org.hibernate.HibernateException; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; /** * * @author Windows 8 */ public class ControllerUpdate { public static void Updator() { SessionFactory factory = HibernateUtil.getSessionFactory(); Session session = factory.openSession(); Transaction tx = null; try { tx = session.beginTransaction(); String sql = "UPDATE location SET name='???' WHERE iso = '???' ";//insert position and which values you want to edit from the table SQLQuery query = session.createSQLQuery(sql); query.executeUpdate(); tx.commit(); } catch (HibernateException e) { if (tx != null) { tx.rollback(); } } finally { session.close(); factory.close(); // CLOSE CONNECTION } } }