开发者

MVC architecture EJB funcionallity

HI would like to understand how do ejbs work in an MVC architecture, what i do not get is: When the web app starts, the system creates an ejb for each record in every table of db or an ejb with a开发者_JAVA技巧ll the records of all tables?

Thank you very much


I'm not sure I get the question right, are you speaking of EJB 2 or EJB 3?

In the EJB 2.x model, the so-called Entity Bean corresponded indeed to rows in the database. The beans where created on demand, when the data needed to be accessed. Otherwise that would mean that the whole database gets loaded in memory.

In EJB 3.x, Entity Beans were superseded by the Java Persistence API (JPA). With JPA, you map tables to regular java classes (POJO). Instances of the class correspond to individual rows in the table. No data is loaded at startup. Data is loaded when you query the database through the Persistence API, and then maintained in a cache.

Despite the similarities, and especially the terminology "entity" like in EJB 2 entity and JPA entity, both technologies are radically different. JPA is not an evolution of EJB 2 Entity Bean, it is a replacement.

(EJB 2 entity was an object model in which each entity could be accessed remotely through a unique identity. The approach taken by JPA is a data-oriented model, where you just send data back and forth between the client and the server.)

Hope it helps.


Dude u are confused and Of the Track

http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/app-arch/app-arch2.html

MVC is for WEB Interface Layer of EJB Process. and not ment for other Layers in EJB.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜