Enterprise JavaBeans 3.1

Entity Relationships (Enterprise JavaBeans 3.1)

  This topic retools our employee registry a bit further by discussing the relationships between entities. In order to model real-world business concepts, entity beans must be capable of forming relationships. For instance, an employee may have an address; we’d like to form an association between the two in our database model. The address could […]

Entity Inheritance (Enterprise JavaBeans 3.1)

  In order to be complete, an object-to-relational mapping engine must support inheritance hierarchies. The Java Persistence specification supports entity inheritance, polymorphic relationships/associations, and polymorphic queries. These features were completely missing in the older EJB CMP 2.1 specification. In this topic, we’ll modify the Employee entity that we defined in earlier topics to make it […]

Queries, the Criteria API, and JPA QL (Enterprise JavaBeans 3.1)

  Querying is a fundamental feature of all relational databases. It allows you to pull complex reports, calculations, and information about intricately related objects from persistence storage. Queries in Java Persistence are done using the JPA QL query language, native Structured Query Language (SQL), and the new Criteria API. JPA QL is a declarative query […]

Entity Callbacks and Listeners (Enterprise JavaBeans 3.1)

  When you execute EntityManager methods such as persist(), merge(), remove(), and find(), or when you execute JPA QL queries or use the Criteria API, a predefined set of lifecycle events are triggered. For instance, the persist() method triggers database inserts. Merging triggers updates to the database. The remove() method triggers database deletes. Querying entities […]

Security (Enterprise JavaBeans 3.1)

  Most enterprise applications are designed to serve a large number of clients, and users are not necessarily equal in terms of their access rights. An administrator might require hooks into the configuration of the system, whereas unknown guests may be allowed a read-only view of data. It’s bad practice, however, to hardcode users’ access […]

JNDI, the ENC, and Injection (Enterprise JavaBeans 3.1)

  Every EJB container that is deployed in an application server has its own personal internal registry called the Enterprise Naming Context (ENC). This is implemented by JNDI and is an object store where the EJB container can hold specific references to its environment. Think of it as the EJB container’s personal address book, where […]

Transaction (Enterprise JavaBeans 3.1)

ACID Transactions Unfortunately, good business-object design is not enough to make EJBs useful in an industrial-strength application. The problem is not with the definition of the EJBs or the taskflow; the problem is that a good design does not, in and of itself, guarantee that a business method represents a good transaction. To understand why, […]

Interceptors (Enterprise JavaBeans 3.1)

Intercepting Methods To understand when to use interceptors, we’ll first take a look at an example of poor code reuse. We’ll be building an online television station, and part of the backing application is a TunerEJB. Incoming requests to get a channel will return an InputStream pointer to read in the content: Management may have […]

Timer Service (Enterprise JavaBeans 3.1)

  Business systems frequently use scheduling systems to run programs at specified times. Scheduling systems typically run applications that generate reports, reformat data, or do audit work at night. In other cases, scheduling systems provide callback APIs that can alert subsystems of events such as due dates, deadlines, etc. Scheduling systems often run batch jobs […]

EJB 3.1: Web Services Standards (Enterprise JavaBeans 3.1)

  Web services have taken the enterprise computing industry by storm in the past couple of years, and for good reason. They present the opportunity for real interoperability across hardware, operating systems, programming languages, and applications. Based on the XML, SOAP, and WSDL standards, web services have enjoyed widespread adoption by nearly all of the […]