miscellaneous_7

来源:互联网 发布:钢雨篷荷载计算软件 编辑:程序博客网 时间:2024/06/06 06:58

Linux系统中修改mysql密码:

通过登录mysql系统,

# mysql -uroot -p

Enter password: 【输入原来的密码】

mysql>usemysql;

mysql> update userset password=passworD("新密码") where user='root';

mysql> flushprivileges;

mysql> exit;  



el表达式中,param的应用:使用param可以获得URL后面的参数;这些参数在页面源码中可以直接引用;

<ahref="${pageContext.request.contextPath}/ProductServlet?method=findByPage&cid=${param.cid}&pageNum=${pb.pageNumber -1 }"aria-label="Previous">



关于JPA的XML配置文件中持久化单元声明:<persistence-unit name="myPersistUnit" transaction-type="RESOURCE_LOCAL">  中transaction-type的取值:

JTA事务(java Transaction API)是J2EE规范中有关事务的标准。它是容器级别的事务,只能运行在J2EE服务器中。它的最大优势是可以支持分布式的事务,如果系统采用的是分布式的数据库,那么只能选择JTA管理EntityManager事务。

使用JTA管理EntityManager事务时,需要注意以下几个问题。

— JTA事务只能运行在J2EE的环境中,即EJB容器中和Web容器中;而在J2SE环境中只能使用RESOURCE_LOCAL管理事务。

— 容器托管的EntityManager对象只能采用JTA的事务,而不能采用RESOURCE_LOCAL事务。

 

RESOURCE_LOCAL事务数据库本地的事务。它是数据库级别的事务,只能针对一种数据库,不支持分布式的事务。对于中小型的应用,可以采用RESOURCE_LOCAL管理EntityManager事务。

使用RESOURCE_LOCAL管理EntityManager事务时需要注意以下几个问题。

— 在J2SE环境中,只能使用RESOURCE_LOCAL管理EntityManager事务,并且EntityManager对象是以应用托管方式获得的。

— 代码中使用RESOURCE_LOCAL管理事务时,要通过调用EntityManager的getTransaction()方法获得本地事务对象。


原创粉丝点击