7.6. Code Generation in EJB
The most interesting use of code generation in the J2EE environment is Enterprise JavaBeans. Despite the similar names, EJBs are completely unrelated to JavaBeans.[6] An EJB represents data and logic that executes in a server environment. There are two primary kinds of EJBs. Session beans represent short-lived conversational state between a client and server, and entity beans represent long-lived data, often in a back end database.
[6] There are only so many coffee metaphors, so the coolest ones have to be reused.
For our purpose here, the interesting thing about EJBs is that they leverage generated code to add semantics beyond the semantics specifically encoded in Java classes. Most importantly, EJBs can acquire transactional ...
Get Component Development for the Java™ Platform now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.