cancel
Showing results for 
Search instead for 
Did you mean: 

POJO Data Source where POJO includes reference to another POJO

Former Member
0 Kudos

<p>All of the samples and webinars I have seen that deal with using a POJO as a data source, use a POJO that includes int, String, or Date fields. Suppose you have an OrderItem class, which contains a product (class Product) and numOrdered (type int). The Product class has a description and so forth. Is it possible to use both POJOs in the report? For example, can you link the two classes together? In the demos I&#39;ve seen, one POJO is dragged to the report, then a productId is linked to a column in a database table. We want to design reports that are database-independent, so we would like to use POJOs. Also, can you use POJOs in reports outside of Crystal Reports for Eclipse?</p>

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

<p>&nbsp;</p><p>The POJO factory maps POJO class properties to Java SQL types, and, by itself, will not be able to automatically walk down a OO relationship link hierarchy.</p><p>One way to expose OrderItem class properties and it referenced Product instance properties would be to create a wrapper class to flatten it, such that the desired properties are exposed by getters of the wrapping class. Then you can pass a collection of the wrapped objects to the POJO factory. </p><p>Sincerely,</p><p>TUeda </p>

Former Member
0 Kudos

Hi,

I am new to Crystal.

I have similar requirements as the original post. POJO in Crystal is useful only when you can transparently deal with your existing POJO model and navigate all the relationships you need for the report. If I have to "flatten" complex object graph of my complex POJO model, then what benefit am I getting here?

We already have mechanism in our webapp to populate our POJOs with data from our Database using JPA/JDO queries. Basically, we dont want to hardcode any SQL or direct knowledge of database.

ReportMill (another report engine) lets you navigate all relationships in your OO model as you would in any Java class. Without such support, for each report, I have to "somehow" flatten complex model into essentially a "Row" object to satisfy Crystal? Is that what I am hearing?

Someone please help with what is possible or what is not.

Thanks

-Chris

Former Member
0 Kudos

Ted,

Thanks for your response. Do we still have this limitation in Crsytal Release II. Can't we use hierarchical Java object.

If Customer object consists of Address object. Can I refer Address object field in crystal template like Customer.getAddress.getZipcode. Is it allowed or still do I need to convert these object to monolithic object by using wrapper class. I apprecaite your help

Thanks

Mohan