Integrating JasperReports with JPA

Hibernate is just one of many available ORM tools. The proliferation of the ORM tools motivated Sun Microsystems to come up with a standard ORM tool for Java. Out of this initiative, the Java Persistence API (JPA) was born.

It is possible to integrate JasperReports with JPA by writing report templates that use JPA's query language as opposed to using SQL. The following JRXML template illustrates this:

<?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://jasperreports.sourceforge.net /jasperreports http://jasperreports.sourceforge.net/xsd /jasperreport.xsd" name="JpaQueryDemoReport" ...

Get JasperReports 3.5 for Java Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.