This project contains the information about the upgrade of the third party libraries which are used by the Openbravo 3 distribution.
Summary / Prominent Changes
Short summary of the changes described in more detail below.
- Hibernate: update from 3.2.5.GA -> 3.6.3
- MUST: Some HQL queries (involving left, right, outer, fetch joins) change behavior and code using those MUST be reviewed
- optional: Deprecation - don't use class Expression, use class Restrictions instead
- JasperReports: update from 3.0.1 -> 4.0.1
- new iReport version 4.0.1 required, 2 config changes needed in iReport
- optionally, update jrxml files to avoid deprecation warnings
In this project most third party jar-libraries used by Openbravo have been updated to their latest upstream versions (as published at end of April 2011)
A few libraries which not used directly in by Openbravo code but which are dependencies of other libraries have not been updates to their latest upstream version but the versions bundled in the distribution using them. Example jcommon, jfreechart are used by JasperReports and have been updated to the versions included in the JasperReports 4.0.1 distribution.
The list of the currently used jar libraries, their versions and upstream url's can be seen in this page.
Known Issues / How to check & update your code
Hibernate HQL behavior change
New hibernate version introduced a change in how some HQL queries are interpreted.
This causes queries to fail or does even change the behavior of some queries if they fall into the schema described now:
join fetching: need to add aliases for intermediate joins
left join fetch rl.businesspartner left join fetch rl.businesspartner.language
Needs to be changed to use an alias for the first join which is used in the second join.
left join fetch rl.businesspartner rlbp left join fetch rlbp.language
Without this change the unmodified query will fail at runtime and throw an exception.
More info can be found in this hibernate forum discussion.
implicit left join + implicit use of same in where clause
When specifying a left join and using that joined table in a where clause in the same hql then an alias MUST be used in the join definition and that alias needs to be used in the where clause to get the same behavior
as mo left join mo.callout where mo.callout.module.id='0'
In hibernate 3.2.5 this was interpreted as a left join to mo.callout and a where clause for this same left join.
The same HQL syntax used with hibernate 3.6.3 interprets this differently and does the same left join as above, but adds another inner join and applies the where condition to this inner join.
This change in interpretation causes the result of the query to be different which will most likely be functional problem.
To achieve the same result as with the previous hibernate version the query needs to be changed like this:
as mo left join mo.callout moc where moc.module.id='0'
Which adds a explicit alias 'moc' to the left join and uses this alias in the where clause to make it explicit that it should be applied to the same left-join.
The new hibernate version 3.6.3 deprecates the class 'org.hibernate.criterion.Expression' instead the class 'org.hibernate.criterion.Restrictions' should be used.
This change can be done at any convenient time to avoid having the deprecation warning and to be safe for a future removal of this class when this is done by hibernate and that version is used in Openbravo (not before the next major version).
Note that this change can already be done in code targeting Openbravo 2.50 as the new Restrictions class is already available there. The updated code will then be fine with no warnings in both Openbravo 2.50 and Openbravo 3.
Example of the mostly mechanical change to fix this in all of the Openbravo 3 distribution can be seen here.
New JasperReports -> New iReport
Together with the new JasperReports version the corresponding newer version of the iReport (4.0.1) jrxml-editor must be used when working on jrxml report definitions from 3.0
Also in iReport two configuration changes must be done, to ensure that the reports work out of the box in Openbravo 3. Both change are described in the Reports documentation.
Warnings at runtime -> update your jrxml files
When using existing older jrxml report definitions those might show warnings at runtime that the files are using some deprecated elements. This can be corrected by upgrading the jrxml files with an ant task provided in the jasper report distribution, which can be downloaded here.
This 'antupdate' program can be found inside the jasperreport-4.0.1 distribution in the folder: "demo/samples/antupdate". This folder also contains a readme.txt with some explanation how to use/call the tool.