Changes to the existing API
We've added an interceptor layer to MetaModel, which makes it possible for you to intercept operations just before or just after they have been executed. Use-cases of interceptors are many, but you might need them for migration purposes, for query rewriting or for logging or security.
Using interceptors you can intercept schemas before they are returned to the user, queries before they are executed, datasets before they are returned, or update operations before they are written.
Read the Using interceptors page for examples and more information on interceptors.
We've used the new interceptor layer to implement a type conversion layer which allows you to transparently convert values of certain column before they are read and written. For instance, you might want to interpret a column in a CSV file as numbers, even though the column is inherently a string column. With the new type mechanism, that operation is as easy as:
DataContext dc = ...;
dc = Converters.addTypeConverter(dc, column, new StringToIntegerConverter());
Other examples might be to automatically compress and decompress byte arrays, or even serializing and deserializing complete objects to BLOBs.
Read the Automatic type conversion page for examples and more information on type conversion.
The JDBC module's update performance has been greatly improved by using prepared statements as well as committing only once per update. Since this is completely in line with the semantics of the existing API, the improvement is not something that you will notice in actual code, but expect a very nice performance improvement (depending on the DB) on execution of large update batches.
MetaModel has offered conversion of types for a pretty long while, by using the ColumnTypeTransformer class. But with version 2.2 we've rewritten this layer to be based on the new interceptor mechanism. This means that you can now do type conversion of any column type and you no longer have to worry about changing the source columns' type to have this feature.
The ColumnTypeTransformer class has been removed to make place for this new and better implementation of the same concept!
A bug was fixed, which pertained to the generation of INSERT statements and having quotes in the inserted values.
Although MongoDB was officially added in MetaModel 2.1, it was by mistake not included as a dependency in the MetaModel-full module. It has now been added, so the 'full' maven dependency is easily manageable.