Client Transactions
One of the main aspects of the Enterprise Java Beans (EJB) framework
is its support for transactions. Although EJB supports alternative
programming styles for use of transactions, namely declarative and
programmatic transactions, EJB's support remains limited. The EJB transaction
model is a component-centric model in the sense that transactions are tied
to beans (1 bean method = 1 transaction). It helps coping with
concurrent components, but it lacks support for managing concurrent clients
who participate in a transaction. Client transactions typically
need different and more sophisticated transactional support than is provided
by plain EJB transactions.
In this tutorial we discuss several implementation techniques for client
transactions. All implementations presented in this talk are built
on top of EJB transactions. These approaches include client initiated transactions
based on JTS/JTA and server-side support for optimistic and pessimistic
locking. Along with the implementation techniques themselves we will
discuss performance characteristics and further up- and down-sides of each
of the idioms.
|
Persistence
One of the main aspects of the Enterprise Java Beans (EJB) framework
is its support for persistency by means of entity beans. Although
entity beans already support several persistence mechanisms (container-managend
and bean-managed persistence) there are further alternative persistence
mechanisms in Java, which we discuss in this tutorial. The discussion is
motivated by the following observation:
A common pattern in multi-tier applications is the facade pattern,
in which a remotely accessible session bean hides the actual access to
persistent data. In EJB the persistent data is conceptually represented
by entity beans. Entity beans are components, that is, they have
support not only for transparent persistency, but also for distribution,
transaction control, security and the like. Often the component overhead
of entity beans is overkill for the problem at hand. What is needed
in numerous applications is just a persistency mechanism, not a full-blown
component model.
In this tutorial we discuss several implementation techniques for persistency
in enterprise applications, starting with an evaluation of the EJB persistence
model, which comes in two flavors as container-managed and bean-managed
persistence. We compare a data layer consisting of entity beans
to manually coded database access via JDBC. There are further alternatives
in form of relational mapping tools . And last but not least, there is
the recently released standard for Java Data Objects (JDO), which is a
Java persistence model that gets a lot of attention in the J2EE community
as a potential alternative to entity beans. We will look into all
these alternative approaches. Along with the different
implementation techniques themselves we will discuss the up- and down-sides
of each of the approaches. |