EJB 2.1 and EJB 3.0 applications, AXIS web services or stand-alone J2SE programs. CUBA provides an EJB-3-oriented component model and a descriptor and code generator to produce adapters for multiple runtime environments.
Real reuse of components
CUBA and EJB 3.0Developing a CUBA components is similar to writing an EJB 3 component using either code annotations or XML descriptors for the specification of meta information. However, CUBA is not exactly EJB 3 but wraps the standard almost completely and provides an equivalent to all relevant API and description artefacts. This was an essential design desicion for making CUBA components independent from any assumptions about a particular target runtime environment. CUBA components can e.g. be run on both EJB 2.1 and EJB 3.0 containers without modification. Platform-dependent aspects are completely hidden in generated adapter classes acting as a compatibility layer and emulation wrapper (e.g. performing the dependency injection in EJB 2.1 environments). The support for both versions of containers provides a very interesting migration option for developers who can not move to newer application servers in the near future.
CUBA also brings the vision of EJB testing without application server alive. Since EJB 3, the standard is designed for this requirement e.g. by means of its POJO approach and the new dependency injection which in general allows to instanciate components like an ordinary class for test purposes. However, in many cases it will turn out that even simple test scenarios require a minimum of container services, e.g. concerning transaction management and user authentication. CUBA provides such a mini container and is therefore the perfect basis for rapid component development. This was already the case for CUBA 1, of course, and it is not related to EJB 3 from a CUBA developer's point of view.
As CUBA already applied some fundamental simplifications of EJB 3 in its earlier versions (e.g. no home interfaces were needed), the component and programming model is upwards compatible with CUBA 1 and 2. Most components developed on older CUBA releases should therefore work in CUBA 3 right from the start simply by re-generating adapters and descriptors.
CUBA and persistenceCUBA supports the Java Persistence API and integrates with various independent persistence management toolkits which can be set on top of the framework's general resource and transaction management. Examples for using the open-source ORM toolkits Apache OJB, PriDE, and Hibernate are included in the CUBA delivery.