Home » Tag Archives: EJB (page 2)

Tag Archives: EJB

EJB passivation and activation example

java-interview-questions-answers

In this tutorial we are going to see how activation and passivation works in a Stateful Java Enterprise Session Bean. 1. Introduction Stateful Session Beans usually hold information about a specific client, and holds that information throughout the whole session. It is a fact though, that client sessions tend to be active for a respectable amount of time, and of ...

Read More »

Java EE Stateful Session Bean (EJB) example

java-interview-questions-answers

In this article we are going to see how you can use Stateful Session Beans to keep track of state across a client Session in a simple Web Application. 1. Introduction Stateful Session Beans usually hold information about a specific client’s session, and holds that information throughout the whole session (opposed to Stateless Session Beans). A Stateful EJB instance is ...

Read More »

Java EE EJB Interceptors tutorial and example

java-interview-questions-answers

In this example we are going to see how to use Interceptors in an EJB and test it using a simple Web Application. 1. Introduction Interceptors are used, as the name suggests, when you want to intercept calls to EJB methods. If you declare an Interceptor for a Bean, every time a method of that Bean is invoked, it will ...

Read More »

JBoss AS7 JNDI & EJB 3.1 Naming changes

jboss-logo

As a result of the “feature train” continuing to march on and us not keeping our software stack up-to-date, our team finds ourselves in the un-enviable position of having to migrate: JBoss 4.2.3 to AS 7.1.x (currently looking at 7.1.1) EJB 2.1 to EJB 3.1 Hibernate 2 to Hibernate 3 or 4 in quick fashion.  I mean, who wants to ...

Read More »

EJB Inheritance is Different From Java Inheritance

java-interview-questions-answers

Despite the fact that EJB inheritance sometimes uses Java inheritance — they’re not always the same. Just as you could read in my previous post, EJB doesn’t have to implement any interface to expose a business interface. The other way around is also true — just because EJB is implementing some interface or extending other EJB doesn’t mean it exposes ...

Read More »

Defining EJB 3.1 Views (Local, Remote, No-Interface)

java-interview-questions-answers

This post will talk about possible ways of defining EJB views using annotations (I’ll just mention about using EJB Deployment Descriptor at the end.) I’ll focus on the most current EJB 3.1 views omitting legacy local, remote and home interfaces. Therefore, we can choose between: remote business interface view, local business interface view, no-interface view. I won’t discuss functional differences ...

Read More »

Four solutions to the LazyInitializationException – Part 2

jsf-logo

This article continues from part 1 of the tutorial. Load collection by Stateful EJB with PersistenceContextType.EXTENDED This approach can be applied only to applications that works with Full JEE environments: to use a EJB with PersistenceContextType.EXTENDED. Check the code below how the DAO would look like: package com.ejb; import javax.ejb.Stateful; import javax.persistence.*; import com.model.Person; @Stateful public class SystemDAOStateful { @PersistenceContext(unitName ...

Read More »

Four solutions to the LazyInitializationException – Part 1

jsf-logo

In the post today we will talk about the common LazyInitializationException error. We will see four ways to avoid this error, the advantage and disadvantage of each approach and in the end of this post, we will talk about how the EclipseLink handles this exception. To see the LazyInitializationException error and to handle it, we will use an application JSF ...

Read More »

Full WebApplication JSF EJB JPA JAAS – Part 2

jsf-logo

View – Creation and JSF set up This tutorial continues from part 1. Let us create a new Dynamic Web Project. Create it like the image bellow: Pay attention: in some moment the Eclipse will ask you if you want to add the JSF Capabilities (auto complete), enable it. Like the screens bellow: After the project creation, let us edit ...

Read More »

Full WebApplication JSF EJB JPA JAAS – Part 1

jsf-logo

This post will be the biggest so far in my blog! We will see a full web application. It will be done will the newest technologies (until today), but I will give some hints to show how to adapt this post to older technologies. In the end of this post you will find the source code to download. You can ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.