JSF request scoped bean keeps recreating new Stateful session beans on every request?

Stateful session beans (SFSB) are not exactly what you think they are. You seem to think that they behave somehow like session scoped JSF managed beans. This is untrue. The term “session” in EJBs has an entirely different meaning than the HTTP session which you’ve had in mind. The “session” in EJBs must be interpreted … Read more

Middleware & SOA by Example

SOA main principles: Build systems as set of services where each service is Coarse-grained Interoperable Loosely coupled A company offers a lot of business services (coarse-grained) developed over many years and exposed to the users (human or other systems) in some form. There are more chances that each of these features have been designed and … Read more

JPA and Table Views. Can it be done? [duplicate]

For more info on JPA and database views see, http://en.wikibooks.org/wiki/Java_Persistence/Advanced_Topics#Views In JPA you can map to a VIEW the same as a table, using the @Table annotation. You can then map each column in the view to your object’s attributes. Views are normally read-only, so object’s mapping to views are normally also read-only. In most … Read more

EJB3 transaction rollback

First of all, there is no rollback of an exception, it’s a rollback of a transaction. If you throw your exception with @ApplicationException(rollback=true), you don’t have to rollback the transaction manually. Context.setRollbackOnly() forces the container to rollback the transaction, also if there is no exception. A checked exception itself doesn’t rollback a transaction. It needs … Read more

Why should we use EJB? [closed]

The EJB or Enterprise Java Beans are plain java classes (since version 3.0) with annotations that enable to you write the business logic of your applications and later deploy it (or install) on a Java Enterprise Edition Server. You must consider use EJB if you wish to take advantage of the following services provided by … Read more