Questions tagged [ejb-3.0]

This tag is used for question related to the session bean and message-driven bean component types of the EJB 3.0 programming model. For questions about the persistent entities defined in the document "Java Persistence API" of the EJB 3.0 specification, use the [JPA] tag.

JSR 220: Enterprise JavaBeans 3.0

The Enterprise JavaBeans architecture is a component architecture for the development and deployment of component-based business applications.

The purpose of Enterprise JavaBeans (EJB) 3.0 is to improve the EJB architecture by reducing its complexity from the developer's point of view.

The goal of EJB 3.0 is to target ease of development, the main theme of the Java EE 5 platform release. EJB 3.0 is a major simplification over the APIs defined by the EJB 2.1 and earlier specifications. The simplified EJB 3.0 API allows developers to program EJB components as ordinary Java objects with ordinary Java business interfaces rather than as heavy weight components. Both component and client code are simplified, and the same tasks can be accomplished in a simpler way, with fewer lines of code. Because it is much simpler, EJB 3.0 is also much faster to learn to use than EJB 2.1.

2345 questions
37
votes
1 answer

EJB3 + JEE6: What is a persistent Timer?

I'm just about to use the new EJB3 TimerService (as part of Java EE 6), and as usual, I'm impressed by the brevity of JavaDoc :) Do you know what is the effect of the persistent property of the TimerConfig object? JavaDoc TimerConfig says: The…
Hank
  • 4,597
  • 5
  • 42
  • 84
37
votes
2 answers

JPA and Table Views. Can it be done?

We currently have a Java EE system where we are mapping to our database using JPA. It is a fairly well developed system with about 20 entities. We now have been ordered to use Views for everything. Eg: if we have a table called PERMISSION then we…
Oliver Watkins
  • 12,575
  • 33
  • 119
  • 225
34
votes
7 answers

Middleware & SOA by Example

I am an inexperienced Java developer trying to wrap my head around some fundamental middleware/SOA concepts and technologies, specifically: Service-Oriented Architecture (SOA) Message-Oriented Middleware (MOM) Message Queue Apache…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
32
votes
2 answers

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

I'm building my first Java EE application using JSF, PrimeFaces, Glassfish and Netbeans. Because I'm new, it's possible I'm approaching the core problem wrong. Core problem: I want to maintain user's information securely. There seems to be…
Alan B. Dee
  • 5,490
  • 4
  • 34
  • 29
31
votes
3 answers

Glassfish JAX-WS side by side SSL / insecure EJB webservice

Is it possible to run a single @WebService bean as both secure and insecure at the same time, preferably using the same URL except for the http/https protocol difference? I am able to run the service either secure or insecure…
Justin
  • 4,097
  • 1
  • 22
  • 31
31
votes
8 answers

Stateless Session Beans vs. Singleton Session Beans

The Java EE 6 Tutorial says: To improve performance, you might choose a stateless session bean if it has any of these traits: The bean’s state has no data for a specific client. In a single method invocation, the bean performs a generic task for…
deamon
  • 89,107
  • 111
  • 320
  • 448
29
votes
2 answers

EJB 3.0 - Nested Transaction != Requires New?

I just read the Transactions Chapter (10) of "Mastering EJB 3.0" and now I'm confused about nested transactions. The book says "The EJB-defined transaction manager does not support nested transactions; it requires support for only flat…
NorRen
  • 711
  • 2
  • 9
  • 22
26
votes
4 answers

How to access the file system from an EJB 3?

I would like to know how can I access the file system from an EJB 3 bean? I searched the Internet on the subject and haven't found a good answer. Some suggest using the java.io/java.nio even though the specification prohibits this usage. Most…
Pierre Thibault
  • 1,895
  • 2
  • 19
  • 22
26
votes
8 answers

EJB3 Transaction Propagation

I have a stateless bean something like: @Stateless public class MyStatelessBean implements MyStatelessLocal, MyStatelessRemote { @PersistenceContext(unitName="myPC") private EntityManager mgr; …
Matt S.
  • 1,129
  • 2
  • 10
  • 14
25
votes
4 answers

How do you unit test Java EE code?

I want to ask for your prefered way to test Java EE code? I found only three project, that are trying to help to code unit tests in Java EE environment: http://jakarta.apache.org/cactus/ : Last Published: 2009-01-18 http://www.junitee.org/ : Last…
marabol
  • 1,247
  • 2
  • 15
  • 22
25
votes
4 answers

A JTA EntityManager cannot use getTransaction()

How can I use the following code in my non-ejb application. The code works. @Override public void saveItems(Collection items) { synchronized (em) { EntityTransaction tx = em.getTransaction(); try { tx.begin(); …
auser
  • 6,307
  • 13
  • 41
  • 63
24
votes
2 answers

EJB: Avoid Transaction rollback

When a (transactional) method of an EJB calls another (transactional) method of another EJB, and an exception is thrown in the second, but catched in the first one, it seems that the transaction is automatically rolled back when the second one…
Mr.Eddart
  • 10,050
  • 13
  • 49
  • 77
22
votes
2 answers

Eager / auto loading of EJB / load EJB on startup (on JBoss)

EJBs seem to be loaded lazily - whenever accessed. However, I want to initialize them eagerly - i.e. whenever the container starts-up. How is this achieved (in JBoss in particular) This topic gives some hints, but isn't quite satisfactory.
Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
22
votes
2 answers

Examples or Uses Cases to explain EJB Transaction Attributes

There are some good explanations of EJB Transaction Attributes (and annotations) out there, for example, OpenEJB's. But sometimes when I try to cover this with someone who hasn't worked with many transactional resources, I see their eyes start to…
cwash
  • 4,185
  • 5
  • 43
  • 53
21
votes
2 answers

Elegantly handling constraint violations in EJB/JPA environment?

I'm working with EJB and JPA on a Glassfish v3 app server. I have an Entity class where I'm forcing one of the fields to be unique with a @Column annotation. @Entity public class MyEntity implements Serializable { private String uniqueName; …
hallidave
  • 9,579
  • 6
  • 31
  • 27