Questions tagged [ejb-3.1]

This tag is used for question related to the session bean and message-driven bean component types of the EJB 3.1 programming model.

JSR 318: Enterprise JavaBeans, Version 3.1

Enterprise JavaBeans is an architecture for the development and deployment of component-based business applications. Applications written using the Enterprise JavaBeans architecture are scalable, transactional, and multi-user secure.

The Enterprise JavaBeans 3.0 specification focused on bringing ease-of-use to the EJB API. The purpose of the Enterprise JavaBeans 3.1 specification is to further simplify the EJB architecture by reducing its complexity from the developer's point of view, while also adding new functionality in response to the needs of the community.

The focus will be on the core session bean and message-driven bean component models and their client API. Although the Java Persistence API was developed within EJB 3.0, it will evolve under a separate JSR rather than within EJB 3.1.

1103 questions
163
votes
5 answers

What is an EJB, and what does it do?

Been trying to learn what EJB beans are, what does it mean their instances are managed in a pool, blah blah. Really can't get a good grip of them. Can you explain me what they really are (practically for a Java Programmer)? What do they do? Which…
jacktrades
  • 7,224
  • 13
  • 56
  • 83
98
votes
7 answers

Stateless and Stateful Enterprise Java Beans

I am going through the Java EE 6 tutorial and I am trying to understand the difference between stateless and stateful session beans. If stateless session beans do not retain their state in between method calls, why is my program acting the way it…
Stanley kelly
  • 1,088
  • 1
  • 8
  • 9
42
votes
7 answers

EJB 3.1 or Spring 3.. When to choose which one?

EJB achieved many improvements in 3.x versions, Spring is also commonly used and version 3 is a good alternative. There are many articles on web, but no exact comparison about ejb3x versus spring3x.. Do you have any ideas about them, in real world…
asyard
  • 1,743
  • 5
  • 21
  • 43
42
votes
2 answers

Difference between @Stateless and @Singleton

I'm following this tutorial which also uses an EJB: package exercise1; import java.util.Random; import javax.ejb.Stateless; import javax.inject.Named; @Stateless public class MessageServerBean { private int counter = 0; public String…
godzillante
  • 1,174
  • 1
  • 17
  • 32
39
votes
3 answers

What is the difference between @Inject and @EJB

I'm currently learning the new Java EE 6 component models and am confused with the latest dependency injection mechanism. So here are my questions: 1) What is the difference between @Inject and @EJB 2) If I have a simple POJO that contains another…
xandross
  • 911
  • 2
  • 11
  • 17
38
votes
4 answers

EJB @Schedule wait until method completed

I want to write a back-ground job (EJB 3.1), which executes every minute. For this I use the following annotation: @Schedule(minute = "*/1", hour = "*") which is working fine. However, sometimes the job may take more than one minute. In this case,…
Phil P.
  • 383
  • 1
  • 3
  • 6
36
votes
2 answers

Default EJB transaction mode for asynchronous methods?

When I have an @Asynchronous method in an EJB, and I don't specify the @TransactionAttribute, then how exactly does the container handle the transaction boundaries? Obviously, it can't use the calling thread's transaction, so what does it do? Same…
Mike Baranczak
  • 8,291
  • 8
  • 47
  • 71
29
votes
5 answers

Packaging EJB in JavaEE 6 WAR vs EAR

Starting a new project and would like to know the pros and cons of packaging EJB in a WAR vs EAR. Will JNDI still works when EJBs are in the WAR? efficiency? etc.? Thanks.
duvo
  • 1,634
  • 2
  • 18
  • 30
25
votes
3 answers

JavaEE6 DAO: Should it be @Stateless or @ApplicationScoped?

I'm currently creating an EJB3 Data Access Class to handle all database operations in my Java EE 6-application. Now, since Java EE 6 provides the new ApplicationScoped annotation, I wonder what state my EJB should have, or if it should be stateless.…
Wolkenarchitekt
  • 20,170
  • 29
  • 111
  • 174
24
votes
1 answer

Spring vs EJB (advantage and disadvantage)

I am currently preparing my final project study. I have to develop a distributed application for the management of human resources, but on my benchmark for technologies to use I found it confusing to decide between Spring or the EJB 3.1. I do not…
Informatique2015
  • 279
  • 1
  • 2
  • 4
24
votes
2 answers

Avoid expunging timer on glassfish

I have a method annotated with @Schedule that is called by the container once in a while. @Schedule(second = "*/5", minute = "*", hour = "*", persistent = false) public void myTimerMethod() throws Exception { ... } Problem is on certain…
Aksel Willgert
  • 11,367
  • 5
  • 53
  • 74
23
votes
3 answers

Can the EJB 3.1 @Schedule be configured outside of the application code?

How can I configure a schedule intervals: @Schedule(persistent=true, minute="*", second="*/5", hour="*") outside of the application code? How can I configure it in ejb-jar.xml? Can I configure it outside the application (kind of properties file)?
Moran
  • 231
  • 1
  • 2
  • 3
23
votes
2 answers

CDI Extension for Flyway

I tried to run flyway in my application before hibernate is hooking in on my JBoss AS 7.1. I tried with an @javax.ejb.Startup annotation, but this gets executed AFTER Hibernate is initialized and the database scheme is checked. So as far as I…
Dominik Obermaier
  • 5,610
  • 4
  • 34
  • 45
19
votes
1 answer

Is it possible to @Inject a @RequestScoped bean into a @Stateless EJB?

Is it possible to inject a request-scoped CDI bean into a Stateless session bean? I had asked a related question and thought the specific CDI @RequestScoped into @Stateless question merited its own post. Passing state between EJB methods /…
wrschneider
  • 17,913
  • 16
  • 96
  • 176
19
votes
1 answer

Possible to change ejb parameter at runtime for @Schedule annotation?

Probably a silly question for someone with ejb experience... I want to read and change the minute parameter dynamically for one of my EJB beans that uses the Java EE scheduler via the @Schedule annotation. Anyone know how to do this at runtime as…
simgineer
  • 1,754
  • 2
  • 22
  • 49
1
2 3
73 74