Search This Blog

Friday, May 30, 2008

Integrating BIRT with hibernate and struts (deploy in server tomcat)

Download WebViewer Example inside birt-runtime-2_2_2.zip from eclipse web site.
if you are using jdbc driver in hibernate copy that driver into WebViewerExample\WEB-INF\platform\plugins\org.eclipse.birt.report.data.oda.jdbc_2.2.2.r22x_v20071206\drivers
then merge your application's web.xml with the webviewerExample's web.xml. Then Copy
\article\sources\sources\src\org\eclipse\birt\samples\scripted\hibernate\CustomerList to your class. use your own hibernate factory and Abstractclass inside your application.
Also you should add mail.jar to the lib

Now design your report with scripted data source,
and write following script at its open

importPackage(Packages.org.eclipse.birt.samples.scripted.hibernate);
(if you have out the customerList in yourpackage then write
importPackage(Packages.yourpackage)
cul = CustomerList();
customers = cul.listCustomers("from Customer");
iterator = customers.iterator();


The Customers should be updated to your Abstract Class


write following script at its fetch

if(iterator.hasNext() == false ){
return false;
}

var customer = iterator.next( );

row["CUSTOMERNUMBER"] = customer.getCustomerNumber();
row["COUNTRY"] = customer.getCountry();
row["CONTACTLASTNAME"] = customer.getContactLastName();
row["CONTACTFIRSTNAME"] = customer.getContactFirstName();
row["PHONE"] = customer.getPhone();
row["SALESREPEMPLOYEENUMBER"] = customer.getSalesRepEmployeeNumber();
row["CUSTOMERNAME"] = customer.getCustomerName();

return true;

write following script at its closecul = null;
customers = null;
iterator = null;



You should update (BIRT Report Tool from Eclipse Site)
Help»Find and Install»Find new»Castillo-&amp»Editor and Report»Birt

If you are connected through proxy
Go to Windows»preferences»Find and Install
Set up the proxy settings and enable it.

you should do it each time(Dont know why aand how to over come it)


The Report Designer comes with Birt is of great help. You can create a simple report.
Add columns to datasource for scripted data set.

Following Attachments will be of great help.

article.rar

This attatchment contains a good tutorial and a sample file , ie, enough for a starting with WebViewerExample from eclipse website


Technorati Tags:

2 comments:

Anonymous said...

You should have explained using Images , nice work. Thanks, artice is very useful.

hardiktechoworld said...

very sexy like u