当前位置: 技术问答>java相关
关于EJB的几个概念比较模糊,请问????????????
来源: 互联网 发布时间:2014-12-29
本文导语: Session Bean是什么意思?有状态的和无状态的Session Bean到底什么含义??? 还有Entity Bean? 包括Bean管理的持久性(BMP)Entity Bean, 和容器管理的持久性(CMP)Entity Bean,他们都是什么意思?有什么区别? 还有本地接口和远程接口,调...
Session Bean是什么意思?有状态的和无状态的Session Bean到底什么含义???
还有Entity Bean?
包括Bean管理的持久性(BMP)Entity Bean, 和容器管理的持久性(CMP)Entity Bean,他们都是什么意思?有什么区别?
还有本地接口和远程接口,调度码???
我的理解是:Entity Bean好象能够用Java的类来表示后台的数据库,程序员的所有对数据库的操作都不用直接和数据库打交道,都是用对对象的操作来实现的.是吗吗吗吗吗吗吗吗............?????????????????
还有Entity Bean?
包括Bean管理的持久性(BMP)Entity Bean, 和容器管理的持久性(CMP)Entity Bean,他们都是什么意思?有什么区别?
还有本地接口和远程接口,调度码???
我的理解是:Entity Bean好象能够用Java的类来表示后台的数据库,程序员的所有对数据库的操作都不用直接和数据库打交道,都是用对对象的操作来实现的.是吗吗吗吗吗吗吗吗............?????????????????
|
请仔细阅读
Session beans
An enterprise session bean executes on behalf of a single client. In a sense, the session bean represents the client in the EJB server. Session beans can maintain the client's state, which means they can retain information for the client. The classic example where a session bean might be used is a shopping cart for an individual shopping at an online store on the web. As the shopper selects items to put in the "cart," the session bean retains a list of the selected items. Session beans can be short-lived. Usually when the client ends the session, the bean is removed by the client. Session beans can be either stateful or stateless. Stateless beans don't maintain state for a particular client. Because they don't maintain state, stateless beans can be used to support multiple clients.
Entity beans
An entity bean provides an object view of data in a database. Usually the bean represents rows in a set of relational database tables. An entity bean usually serves more than one client. Unlike session beans, entity beans are considered to be long-lived. They maintain a persistent state, living as long as the data remains in the database, rather than as long as a particular client needs it. The container can manage the bean's persistence, or the bean can manage it itself. If the persistence is bean-managed, the bean developer must write code that includes calls to the database.
Session beans
An enterprise session bean executes on behalf of a single client. In a sense, the session bean represents the client in the EJB server. Session beans can maintain the client's state, which means they can retain information for the client. The classic example where a session bean might be used is a shopping cart for an individual shopping at an online store on the web. As the shopper selects items to put in the "cart," the session bean retains a list of the selected items. Session beans can be short-lived. Usually when the client ends the session, the bean is removed by the client. Session beans can be either stateful or stateless. Stateless beans don't maintain state for a particular client. Because they don't maintain state, stateless beans can be used to support multiple clients.
Entity beans
An entity bean provides an object view of data in a database. Usually the bean represents rows in a set of relational database tables. An entity bean usually serves more than one client. Unlike session beans, entity beans are considered to be long-lived. They maintain a persistent state, living as long as the data remains in the database, rather than as long as a particular client needs it. The container can manage the bean's persistence, or the bean can manage it itself. If the persistence is bean-managed, the bean developer must write code that includes calls to the database.
|
stateful 和stateless的区别在于是否能保存某个对话的过程,即是否支持跨方法的调用,一般你有些信息需要被多个方法调用时就用stateful,这也只是我的理解。而Entitybean则是于数据库紧密相关一一对应,通过bean或者容器来实现持久化,后者省去了一些持久化的开发,将工作留给了容器,而native & remote 还是看那本书吧Mastering Enterprise JavaBeans" "Ed Roman"
|
"Mastering Enterprise JavaBeans and the Java 2 Platform,Enterprise Edition" by Ed Roman. Pls. read it carefully. You can download it from many sites. In "www.google.com" search with: ( "Mastering Enterprise JavaBeans" "Ed Roman" download).