When to Prefer EJB through the GWT Servlet

My colleague told me that using a local EJB is not a good idea, because they act like classes packaged inside a JAR (i.e. when EJB is used only as localthey have no advantages over normal classes). And I should use EJB only when some parts of the code can potentially be used by several applications. But I read about the benefits of EJB (security, thread safety, trasanctions, etc.).

So, I'm confused: when to use the GWT Servlet (it's more convenient than simple HTTPServlet, it offers a method call in RPC style) and when to use EJB?

PS I do not use futures such as JPA 2.0, CDI, etc. (Because I can only use Java EE 5 on WAS 7).

+5
source share
3 answers

My colleague told me that using local EJB is not a good idea

I strongly disagree with this. Local the EJB - a good idea really , as they are the ideal type of bean to implement your business logic. The current harvest of EJB beans is very light, so you don’t need to avoid them because of the expected weight severity.

The biggest advantage of these types of beans is probably their automatic transaction management, which will be very useful when working with any database.

, JMS EIS. -, , . , User, , . EJB start\commit\rollback , ( , "Connection" ) , isn ' t.

EJB beans . .

, -, (@RolesAllowed), beans (, ) .

Java EE 6 -, .war( .jar .).

, : GWT Servlet ( , HTTPServlet, RPC) EJB?

, EJB. .

, EJB. , , .

, (.NET, ++ Java- AS, EJB), EJB.

, Corba (IIOP) , , , EJB , Java AS (Application Server), Java SE ( ).

, EJB , . - JNDI, , JBoss, . JBoss AS 7.

EJB Web Service. GWT Servlet , . GWT, /rpc ( GWT) .

Java- - JAX-WS JAX-RS, SOAP resp REST ( EJB btw). JAX-RS Jersey () RestEasy. Java EE 6 , . Java EE 5 JAX-RS , JAX-WS .

JAX-RS , JAX-WS ( , ).

, EJB? , , AS. ( , json/xml - ), . -, , , .

JAX-RS (bean), (-), EJB, -.

+9

EJB - , , .., .

Java EE:

enterprise beans, - :

. , . , beans , .

. beans, , .

. , beans. , .

, - -, EJB , , GWT Servlet, .

, , JMS , EJB .

, , , . , , , . , bean , EJB.

+1

It depends on the application / project scope. EJB is used to support Java EE features. It does not include in the scope of your project. Do not use it. Java EE Features

0
source

All Articles