Home » Enterprise Java » Page 114

Enterprise Java

Bean managed Transactions

With this example we are going to demonstrate how to handle bean managed transactions using EJBs. Enterprise beans are Java EE components that implement Enterprise JavaBeans (EJB) technology. Enterprise beans run in the EJB container, a runtime environment within the Application Server (see Container Types). Although transparent to the application developer, the EJB container provides system-level services such as transactions ...

Read More »

Use Timer service example

This is an example of how to use the javax.ejb.TimerService in an EJB. The TimerService interface provides enterprise bean components with access to the container-provided Timer Service. The EJB Timer Service allows stateless session beans, singleton session beans, message-driven beans, and EJB 2.x entity beans to be registered for timer callback events at a specified time, after a specified elapsed ...

Read More »

Stateful Session Bean to persist Entity

In this example we shall show you how to use a Stateful Session Bean to persist an Entity. In a stateful session bean, the instance variables represent the state of a unique client-bean session. The state is retained for the duration of the client-bean session. If the client removes the bean or terminates, the session ends and the state disappears. ...

Read More »

Simple Stateless Session Bean example

With this example we are going to demonstrate how to create a simple Stateless Session Bean. A stateless session bean does not maintain state with the client. When a client invokes the methods of a stateless bean, the bean’s instance variables may contain a state specific to that client, but only for the duration of the invocation. When the method ...

Read More »

Stateless Session Bean to persist Entity

This is an example of how to create a Stateless Session Bean to persist an Entity. A stateless session bean does not maintain state with the client. When a client invokes the methods of a stateless bean, the bean’s instance variables may contain a state specific to that client, but only for the duration of the invocation. When the method ...

Read More »

Map Java Enum type in JPA

In this example we shall show you how to map a Java Enum type in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications. Here, we map a Java Enum implementation in JPA, as described below: An entity class An entity is a lightweight persistence domain object. Typically, an ...

Read More »

Embedded compound primary key in JPA

With this example we are going to demonstrate how to create an embedded compound primary key in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications. A composite primary key is usually made up of two or more primitive or JDK object types. Composite primary keys typically arise when ...

Read More »

Named query with entity in JPA

This is an example of how to create a named query with an entity in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications. A named query is a predefined query that you create and associate with a container-managed entity. The named queries are stored on the EntityManager. At ...

Read More »

Single table inheritance in JPA

In this example we shall show you how to create a single table inheritance in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications. Here we shall show you how to use inheritance in JPA.               Manager and ProjectManager classes The Manager class ...

Read More »

One To Many bidirectional mapping in JPA

With this example we are going to demonstrate how to use One to Many bidirectional mapping in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications. Here, we are using the JPA to define a one to many bidirectional mapping between two entities.             ...

Read More »