JDBC中事务的问题之二

public void Login()throws Exception
{

User user = new User();
Password password = new Password();

MySQL mysql = new MySQL();

try
{
mysql.getConnection().setAutoCommit(false);

password.Insert(参数1);
user.Insert(参数2);

mysql.getConnection().commit();

}catch(Exception e)
{
mysql.getConnection().rollback();
}finally{
mysql.close();
}
其中的password对象和user对象的insert分别做的是自己的数据插入操作
现在这个事务能起到原来的作用吗

不用了,我已经知道了,行不通。