Jump to content
JasperReports Library 7.0 is now available ×

Reporting off EJB Data Source


Recommended Posts

By: Milton Taylor - ingennia

Reporting off EJB Data Source

2005-11-21 20:04

We're currently looking at using jasper running off an ejb server (such as jboss). We've scanned the web looking for others that are doing this, and how they're doing it, but not all issues seem to have been fully resolved.

 

1. We want to be able to embed the actual ejb query statement in report definition file. Is this possible today? (i.e. in jr1.1) [without custom mods to jasper engine]

 

2. We want to be able to work with nested ejb data bean objects. There seem to be approaches to this such as translating dots to underscores so that jasper field names remain legal, but can still directly reference accessor methods. Is this the best pattern currently being used?

 

3. We need this to work in subreports. i.e execute the query in the main report and pass the 'result set' collection etc into the subreport.

 

4. There seems to be no documentation for the JBoss Reporting Portal. Is anyone actually using this, and does it address all of these issues?

 

Thanks...

MT

 

 

 

 

By: Teodor Danciu - teodord

RE: Reporting off EJB Data Source

2005-11-22 00:25

 

Hi,

 

1. We are currently studying the possibility to

support other query languages than SQL, such as

Hibernate QL, etc.

http://sourceforge.net/tracker/index.php?func=detail&aid=1348390&group_id=36382&atid=416706

 

2. Report field names can contain spaces these days

and you can use that to reference nested JavaBean

properties in the data source objects.

 

3. Support for new query languages will work with

subreports when ready.

 

4. There is no documentation for the

JBoss Reporting Portal application except for the

Installation Guide shipped inside the distribution. The application works like a report

runner and does not address the EJB query

functionality.

 

I hope this helps.

Teodor

 

 

 

By: Milton Taylor - ingennia

RE: Reporting off EJB Data Source

2005-11-22 15:56

OK,

 

Do you have any feeling for where this RFE sits in the relative priorities? i.e. Is it up there near the top, in the middle or down the bottom?

 

I really don't want to have to go straight to database, so we might have to figure out another way around this issue...

 

Cheers,

MT

 

 

By: Teodor Danciu - teodord

RE: Reporting off EJB Data Source

2005-11-23 00:46

 

Hi,

 

I would say the priority for this functionality

is quite high.

So we should expect to see something coming up

in a matter of weeks.

 

Thanks,

Teodor

 

 

 

By: Milton Taylor - ingennia

RE: Reporting off EJB Data Source

2005-11-23 13:44

Excellent...look forward to seeing this.

 

 

By: Milton Taylor - ingennia

Also: dotted field names?

2005-11-22 22:52

Teodor,

 

Why is it that field names can contain spaces but not dots?

 

MT

 

 

By: Teodor Danciu - teodord

RE: Also: dotted field names?

2005-11-23 04:48

 

Hi,

 

Did you try this and it did not work?

Dots are supported in report field names

since JR 0.6.7.

 

Thank you,

Teodor

 

 

 

By: Milton Taylor - ingennia

RE: Also: dotted field names?

2005-11-23 13:45

That is good news too. No I didn't try it...just assumed that it couldn't because of the hibernate to jasper examples showed people using underscores or double underscores to represent object nesting.

 

 

By: macoute3 - macoute3

RE: Reporting off EJB Data Source

2005-11-28 02:12

Hi,

 

I've the same problem than you with HQL query.

Today, I solve this problem temporarily by using a DataSourceProvider wich open the report execute the query and create the DataSource.

For sub report, I'm using an other way, with an other class.

DataSource.create(report, parameters)

 

 

By: Peter F. - pe_f

RE: Reporting off EJB Data Source

2005-11-28 03:14

Hi,

 

I solved the EJB reporting by implementing a quite simple DataSource based on JXPath. That is, you're able to address your data in the report with an XPath-Query in the field description like:

 

<field name="lastname" class="java.lang.String">

<fieldDescription><![CDATA[/server/users/lastname]]></fieldDescription>

</field>

 

In the example, I assumed an "Server"-EJB with a method "getUsers()" and a "getLastName()" for each user(-EJB).

 

You have to prepare the datasource with so-called "report" and "cursor" beans (or collections or whatever has JXPath-support). The latter are scanned first, so you can separate between data for your detail bands, and stuff for the rest.

 

Additionally, I introduced a "meta"-prefix for meta-information, which is not used for the data part but for e.g. titles.

 

Due to JXPath I18N support it supports different locales, too.

 

Currently, the class contains app-specific code and other stuff like German comments, and it's not fit to be released. If you and Teodor are interested, I could rework the class to and provide Teodor with a more "open" version of it.

 

But be warned: To use it, you really need to know your Beans by heart, since a misspelling in your XPath Query will give you empty or "null" result fields! There's no warning or whatever, that you're requesting unavailable data, because how should the datasource differ between a misspelling and a XPath-expression, which should intentionally return nothing?

 

cu

Peter

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...