A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 晴雨 中级黑马   /  2018-12-25 11:00  /  774 人查看  /  4 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

清单 1. 检索自动产生的关键字

statement stmt = conn.createstatement();

// obtain the generated key that results from the query.

stmt.executeupdate("insert into authors " +

'(first_name, last_name) " +

"values ('george', 'orwell')",

statement.return_generated_keys);

resultset rs = stmt.getgeneratedkeys();

if ( rs.next() ) {

// retrieve the auto generated key(s).

int key = rs.getint();

}

jta/jts
1.jta/jts基本知识
服务器实现jts是否对应用程序开发人员来说不是很重要的。
对你来说,应该把jta看作是可用的api。

jta是用来开发distributed tansaction的 api.
而jts定义了支持jta中实现transaction manager 的规范。

javatransaction service (jts) specifies the implementation of a transaction manager which supports the java transaction api (jta) 1.0 specification at the high-level and implements the java mapping of the omg object transaction service (ots) 1.1 specification at the low-level. jts uses the standard corba orb/ts interfaces and internet inter-orb protocol (iiop) for transaction context propagation between jts transaction managers.

a jts transaction manager provides transaction services to the parties involved in distributed transactions: the application server, the resource manager, the standalone transactional application, and the communication resource manager (crm).
2.jta
1.1 事务处理的概念
jta实际上是由两部分组成的:一个高级的事务性客户接口和一个低级的 x/open xa接口。

我们关心的是高级客户接口,因为bean可以访问它,而且是推荐的客户应用程序的事务性接口。
低级的xa接口是由ejb服务器和容器使用来自动协调事务和资源(如数据库)的

1.1.1事务划分
a.程序划分
使用usertransaction启动jta事务
the usertransaction interface defines the methods that allow an application to explicitly manage transaction boundaries.(from j2ee api document)

4 个回复

倒序浏览
很实用,谢谢了
回复 使用道具 举报
优秀x
回复 使用道具 举报
你学的肯定很好,目前找到工作了吧
回复 使用道具 举报
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马