Prevayler
The Open Source Prevalence Layer

Reports

Posted in Mar 20, 2008 by Tasos Zervos - Edit - History

Does it make sense to do Reporting directly against OBJECTS?

There are pros and cons to that:

Pro 1) Queries will run MUCH faster than through a database connection. Every Date or every
BigDecimal value present in every column of every record of every JDBC ResultSet is an object and
has to be marshalled. That is extremely costly.

Pro 2) You can use all the querying logic and calculations already available in the business logic
of your system without having to duplicate that in your Reporting SQLs.

Pro 3) Because of the above, you never need to break your system's encapsulation. Most people
couldn't care less about this but I believe encapsulation breaking through " shared " databases to
be the main cause for system integration and maintenance nightmares.

Con 1) You have to use an OO query layer that works with POJOs or a Reporting tool that runs on
objects rather than table records (or write your own layer / tool).
Alternatively you write a bit of extra code to access the existing business logic methods.: -)

Comments