The new version of the CUBA platform has been released, bringing in several major new features, along with some improvements and bug fixes.
As this is a major release, there are also some breaking changes listed in the release notes. Most of them will be revealed on the compilation of your project, so just follow recommendations listed in the release notes and hints from your IDE. If you have any troubles with the upgrade, feel free to ask us on the support forum.
The main improvements and enhancements of the 6.0 version are as follows.
Java 8 Language Features
The platform now requires Java 8 and you can use all its features in the application code: lambdas, streams, etc. We’ve added new listener interfaces suitable for implementation by lambda expressions to Datasource, CollectionDatasource and some other classes. The old interfaces still exist but are deprecated.
EclipseLink ORM
EclipseLink 2.6 framework is now used for ORM instead of OpenJPA. It supports the latest JPA 2.1 specification and allows you to use database functions and “on” clause in JPQL. Besides, EclipseLink can be more effective when fetching related collections from the database: see the documentation on view’s fetch attribute.
The whole API for working with data on the EntityManager level has remained the same. The main difference is that now access to an unfetched attribute leads to an exception. Previously you could read unfetched attributes and got nulls, which could result in NullPointerException. We think that the new approach with the definitive exception is better for troubleshooting because the exception tells you what attribute should be included in the view.
Sometimes EclipseLink treats non-trivial JPQL queries differently from OpenJPA, so you may need to modify them if you get exceptions at runtime.
Security Improvements
We have strengthened control over data sending from middleware to the client tier. First, all attribute permissions are now enforced on middleware and values of hidden attributes are not passed to the client tier. Values of read-only attributes are not saved by DataManager. Second, we removed the ability to load scalar values through DataManager, because it is impossible to check them against entity attribute permissions. So now you cannot execute queries like select e.name, count(e) from ns$MyEntity e …
through DataManager. If you need such data on the client tier, create a service with appropriate method in your project and protect it with a specific permission if required. If you need just the number of records for certain criteria, use the new DataManager.getCount()
method. We have also removed the LoadContext.useSecurityConstraints
attribute which means that if you want to bypass the security constraints from the client tier, you need to create your own service method loading data through EntityManager and returning it to the client.
Single WAR Deployment
Previously any CUBA application consisted of at least two WAR files (or exploded WARs in the case of fast deployment to Tomcat). This caused unnecessary complication in the deployment of small-scale applications, especially into cloud environments. Now you can create a single WAR file containing both client tier and middleware, which makes the deployment process trivial.
Upgraded Dependencies
The new platform release is based on the latest versions of underlying frameworks and tools:
- Spring Framework 4.2.0
- Vaadin 7.5.6
- AmCharts 3.17.1
- Lucene 5.3.0
- Gradle 2.6
- Tomcat 8
We have changed the logging API to SLF4J and implementation to Logback 1.1.3. But your application can still use Commons Logging or Log4j API thanks to the bundled log4j-over-slf4j bridge.
CUBA Studio 2.0
We have created the new simplistic visual theme for Studio, so now it looks really cool. The new Studio user interface is based on Vaadin 7 and supports proper scaling when using the browser zoom function.
The main functionality improvement is the advanced settings for standard screens creation. Now you can create both browser and editor screens as before, or only one of them, or even combine the browser and the editor on one screen where the table is on the left side, and edit fields for the selected record are on the right side. The settings also allow you to choose what components will be added to the generated screens.
The full list of changes in this Studio release can be found here.
The detailed release notes of CUBA Platform 6.0 are available here.