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
18
votes
3 answers

Can I (and how) lookup CDI managed beans using javax.naming.Context#lookup in EJB module?

Can I (and if so, how?) lookup CDI managed beans using javax.naming.Context#lookup in EJB module? I'm using GlassFish v3. I suppose that I can use @Named, but what is JNDI name of CDI managed bean? I want to lookup them from unmanaged POJOs so I…
zacheusz
  • 8,750
  • 3
  • 36
  • 60
18
votes
6 answers

CDI: Using Interceptors across different modules / bean archives

My Java EE 6 application consists of a war and an ejb module packaged in ear file. I'm using CDI for DI (i.e. I have a beans.xml file in both modules). I want to use a logging interceptor that is defined in the ejb module in the war module, as well.…
Theo
  • 3,074
  • 7
  • 39
  • 54
17
votes
2 answers

Why merging is not cascaded on a one to many relationship

My question here is almost similar to my other question Explicit delete on JPA relationships but I thought of simplifying it further to warrant more detailed answers. Imagine I have a OneToMany relationship between a parent and a…
Mark Estrada
  • 9,013
  • 37
  • 119
  • 186
16
votes
4 answers

JPA dynamic persistence unit name

I need a way to dynamically specify the persistence unit in a EJB. Simplified example: I have an application using multiple databases as data stores. Each of the data stores are structurally the same. Depending on the client connecting to the…
likenoother
  • 429
  • 1
  • 3
  • 11
16
votes
0 answers

Why is there no @TransactionTimeout annotation for EJB3 CMT in Java EE

For Container Managed Transactions (CMT) in EJB3, we have the following EJB annotations for Transaction Management. @TransactionAttribute @TransactionManagement Unfortunately, there are no ways to set up transaction timeout and it's specific to…
Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
15
votes
3 answers

WELD-001408 Unsatisfied dependencies when injecting EJBs that implement interfaces

Here is the situation. I've got the following interfaces: public interface Parent { } public interface ChildOne extends Parent { } public interface ChildTwo extends Parent { } and 2 EJBs: @Stateless public class FirstBean implements ChildOne {…
jFrenetic
  • 5,384
  • 5
  • 42
  • 67
14
votes
3 answers

Java EE Application Startup Failure

Is there any method to prevent a Java EE application from starting if an exception occurs during application initialization? I'm basically looking for a way to cause the application to enter a "j2ee.state.failed" state (per JSR-77) following an…
shelley
  • 7,206
  • 4
  • 36
  • 63
14
votes
3 answers

Set/configure the EJB Timer Service’s DataSource

I'm trying to use the Timer Service in EJB 3.1 in my app. @Stateless @LocalBean public class StatelessTimerSessionBean { @Schedule(minute = "*", second = "0", dayOfMonth = "*", month = "*", year = "*", hour = "9-17", dayOfWeek = "Mon-Fri") …
ejohansson
  • 2,832
  • 1
  • 23
  • 30
13
votes
4 answers

EJB 3.1 @EJB Injection into POJO

With the new EJB 3.1 spec is it possible to inject an EJB into a pojo? I know in EJB 3.0 the @EJB annotation could be used to inject an EJB but this did not work on simple pojos. If it is not do I have to look the bean up in JNDI as I know you…
Karl
  • 2,927
  • 8
  • 31
  • 39
12
votes
2 answers

Using EJBContext getContextData - is this safe?

I am planning to use EJBContext to pass some properties around from the application tier (specifically, a message-driven bean) to a persistence lifecycle callback that cannot directly be injected or passed parameters (session listener in…
wrschneider
  • 17,913
  • 16
  • 96
  • 176
12
votes
1 answer

@Singleton @Startup @PostConstruct method guaranteed to return before EJBs made available for client calls?

In the context of a Java EE 6 application run on WebSphere 8.0, I need to execute a number of startup tasks before any business method can be executed. Using a @Startup, @Singleton bean for this purpose seems like a promising solution. However, it…
Lord Zuthulu
  • 143
  • 1
  • 7
11
votes
1 answer

The mystery of Java EE 6 annotations inheritance

I'm using inheritance with EJB in a few scenarios, sometimes with annotations in the super class like this generic entityDAO: public class JpaDAO{ protected Class entityClass; @PersistenceContext(unitName="CarrierPortalPU") …
Rasmus Franke
  • 4,434
  • 8
  • 45
  • 62
11
votes
1 answer

unit testing EJBs with Maven 2 and Glassfish 3

I've been trying to set my application up so that I can unit test it's EJBs all day but I can't seem to get past what seems like a really simple problem. I have a standard Maven web application set up in NetBeans 6.9. I've automatically generated a…
wobblycogs
  • 4,083
  • 7
  • 37
  • 48
11
votes
1 answer

Java EE 6 Injection Into Abstract Class

In a Java EE 6 project I am working on, there is a lone field annotated with @EJB that is not being injected. Injection is working fine everywhere else. Being new to Java EE, I don't know if it is related to the field being in an abstract class, nor…
rusty_turkey
  • 320
  • 1
  • 3
  • 14
10
votes
1 answer

How does @SessionScoped work with EJB? Is CDI only for web-tier?

How is the session defined in @SessionScoped CDI bean? Is this annotation valid only when called from Servlet container, where the session is well defined in form of HttpSession? If not, than how an EJB with @Inject @SessionScoped MyBean myBean can…
Piotr Nowicki
  • 17,914
  • 8
  • 63
  • 82
1
2
3
73 74