EJB 3.x常用注解

这里总结自己常用的,没用到的,或不常用以后再继续补充

 
1.Local

When used on the bean class, declares the local business interface(s) for a session bean.

用在 Bean 类上时,为会话 Bean 声明本地业务接口。用在接口上时,将该接口指定为本地业务接口。在这种情况下,不提供任何 value()。
如:@Local(LawsuitService.class)
 
 
2.Remote

Declares the remote business interface(s) for a session bean.

为会话 Bean 声明远程业务接口。用在接口上时,将该接口指定为远程业务接口。在这种情况下,不提供任何 value()。

 
3.Stateful

Component-defining annotation for a stateful session bean.

有状态会话 Bean 的组件定义注释。
 
4.Stateless

Component-defining annotation for a stateless session bean.

无状态会话 Bean 的组件定义注释。
 
 
5.Timeout

Designates a method on a stateless session bean class or message driven bean class that should receive EJB timer expirations for that bean.

指定无状态会话 Bean 类或消息驱动 Bean 类上接收该 Bean 的 EJB 计时器过期的方法。

 
   
6.TransactionAttribute

When applied at the TYPE-level, designates the default transaction attribute for all business methods of the session or message driven bean.

在 TYPE-level 应用时,为会话或消息驱动 Bean 的所有业务方法指定默认事务属性。在方法级应用时,仅为该方法指定事务属性。
如:@TransactionAttribute(TransactionAttributeType.SUPPORTS)、 @TransactionAttribute(TransactionAttributeType.REQUIRED)
 
   
7.Interceptors

Declares an ordered list of interceptors for a class or method.

声明类或方法的拦截器的有序列表
 
    
8.Lock

Declares a concurrency lock for a method of a singleton bean with container-managed concurrency.

方法声明一个并发锁的单例bean具有容器管理的并发。
如:@Lock(LockType.WRITE)

 
      
9.Schedule(排程器)

Schedule a timer for automatic creation with a timeout schedule based on a cron-like time expression.

计划时间为自动建立一个超时计划基于一个时间表达式
 
      
10.Startup

Mark a Singleton for eager loading during application initialization.

标记一个单例在应用初始化期间

 
11.ConcurrencyManagement 

Declares a Singleton or Stateful session bean's concurrency management type.

声明单例或有状态bean的并发管理类型

在config里用到的:
@Singleton
@Startup
@ConcurrencyManagement(ConcurrencyManagementType.CONTAINER)
@Lock(LockType.WRITE)
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
在service里用到的:

@Stateless
@Local(LawsuitService.class)
@TransactionAttribute(TransactionAttributeType.SUPPORTS)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值