Docs are outdated and not helpful anyway. I use the dialog to add the class and and the static method, as well as the path to the .jar file holding the relevant classes.
When I hit test connection I get an error saying it cannot find the class ....
Yes the jar file is at that path. Do I need to further at that path somewhere else in the project properties or something??
Here's a link to the part of the docs that is supposed to describe this process
I think your problem in full name of class - probably the package is missing in your case.
Sample
Here is the sample how it works in Jaspersoft Studio 6.2.1 (JSS).
Java code
Bean Order:
Bean Product:
And the factory for getting Collection of Order objects with static method:
All classes are at ru.alex package.
Data adapter settings
The settings of Collection of JavaBeans type data adapter in JSS:
This data adapter was created with help of wizard:
I did not add the beans.jar to the project's Java Build Path in JSS and everything (adapter) works ok. It can be checked by pressing of Test button.
The checkbox Use field description does not play any role in this game.
I used the full class name:
ru.alex.OrderFactory
in settings.And now this adapter can be used in report.
Creating report's template
Since the adapter is ready we can use it.
At Dataset and Query Dailog we can ignore message that
class not found by ....
and manually add the fields after setting the class name.The report will be something like this:
If we add the jar with our beans to the IDE build path, like this:
the behaviour will be changed. The list of fields will be appear automatically after typing the class name at Dataset and Query Dailog:
After adding second jar we can got the ClassCastException trouble. Only single jar with same classes should be added to classpath (JSS). Please look at the bottom of a post to find more information.
Templates
If we want to show only field from Order class we can use only the Dataset and Query Dailog to construct fields list.
The jrxml for showing prices & quantities of orders will be:
If we want to show, for example the product name we need to add the new field:
In this case the template be:
Beware! We can face the issue described at Why do I get error when trying to retrive bean from my data adapter? post. We should stay only one jar with Bean classes. For example, jar at Java Build Path.
The full desciption is at referenced post.