Difference between revisions of "About : BIRT JPA or JDO Connector"

From Eclipsepedia

Jump to: navigation, search
(Work future)
(Participants)
 
(38 intermediate revisions by one user not shown)
Line 14: Line 14:
 
== Participants ==
 
== Participants ==
  
* Student: Victoriano Alfonso Phocco Diaz <vphocco@gmail.com> -
+
* Student: Victoriano Alfonso Phocco Diaz <[[vphocco@gmail.com]]> -
 
http://alfonso777.blogspot.com/
 
http://alfonso777.blogspot.com/
 +
* Student: Jorge Fabian Chuquitaype Zuñiga <[[jfabianchz@gmail.com]]>
 
* Mentor: Jason Weathersby <jweathersby@actuate.com> - http://www.blogger.com/profile/13114050439576571984  http://eclipse.sys-con.com/author/jasonweathersby.htm
 
* Mentor: Jason Weathersby <jweathersby@actuate.com> - http://www.blogger.com/profile/13114050439576571984  http://eclipse.sys-con.com/author/jasonweathersby.htm
 
* Project Hosting GSoC:
 
* Project Hosting GSoC:
Line 50: Line 51:
 
CVS: https://birt-jpa-connector.googlecode.com/svn/trunk/
 
CVS: https://birt-jpa-connector.googlecode.com/svn/trunk/
  
 +
== Getting Resources ==
 +
Here you get examples, examples and test for some modules. Moreover
 +
there are scripts for DB, JPA example, screenshots, videos demo , etc.
 +
*http://code.google.com/p/birt-jpa-connector/downloads/list
 +
 +
== JPA ODA plugin==
 +
 +
=== Source Code ===
 +
* http://code.google.com/p/birt-jpa-connector/source/browse/#svn/trunk/org.eclipse.birt.report.data.oda.jpa
  
== Developement ==
 
 
=== The "Statement" class  ===
 
=== The "Statement" class  ===
  
Line 112: Line 121:
  
 
  SELECT AVG(mag.price) FROM Magazine mag
 
  SELECT AVG(mag.price) FROM Magazine mag
 
  
 
* On JSR220: Enterprise Java Beans V3.0, Java Persistence API in Chapter
 
* On JSR220: Enterprise Java Beans V3.0, Java Persistence API in Chapter
  
=== Video Demo of demostration ===
+
=== Video Demo   ===
 +
 
 +
* In this video we are preparing all necesary for generate the report, like; install BIRT Runtime, deploy the ODA JPA plug-in, create the JPA test project, install the Sample database, configure the report, etc.:
 +
**http://www.puntoevolucion.com/GSoC/preparing_all.htm
 +
 
 +
* Here show the generation of report and the result:
 +
**http://www.puntoevolucion.com/GSoC/Generating_Report_from_ODA_JPA.htm
 +
 
 +
=== Screenshots ===
 +
*http://birt-jpa-connector.googlecode.com/files/ScreenShots%20-%20JPA%20ODA%20UI.rar
 +
 
 +
<gallery caption="">
 +
Image:Test_JPA_ODA_6.jpg|New JPA Project for example
 +
Image:Test_JPA_ODA_7_a.jpg|Specify Driver and Connection
 +
Image:Test_JPA_ODA_7.jpg|Generating Entities from Tables
 +
Image:Test_JPA_ODA_8.jpg|Editing persistence.xml with Toplink implementation
 +
Image:Test_JPA_ODA_9.jpg|Establishing APP_JPA and PERSISTENCE_UNIT properties in new_report_jpa.rptdesign
 +
Image:Test_JPA_ODA_10.jpg|Establishing Query
 +
Image:Test_JPA_ODA_11.jpg|Testing report with JPA ODA plugin
 +
Image:Test_JPA_ODA_12.jpg|Show Results(I) 
 +
Image:Test_JPA_ODA_13.jpg|Show Results(II) 
 +
Image:Test_JPA_ODA_13a.jpg|Viewing Report generated in Browser
 +
 
 +
</gallery>
 +
 
 +
== JPA ODA UI Plug-in ==
 +
 
 +
===Source Code ===
 +
*http://code.google.com/p/birt-jpa-connector/source/browse/#svn/trunk/org.eclipse.birt.report.data.oda.jpa.ui
 +
 
 +
=== Description ===
 +
 
 +
To use the data retrieved by the JPA ODA driver in a BIRT report design, One must extend the DTP design UI. To implement the JPA ODA UI, extend the following extension points:
 +
* org.eclipse.datatools.connectivity.oda.design.ui.dataSource
 +
* org.eclipse.ui.propertyPages
 +
* org.eclipse.datatools.connectivity.connectionProfile
 +
 
 +
===Video Demo ===
 +
* http://www.puntoevolucion.com/GSoC/JPA%20ODA%20UI.htm
 +
* http://birt-jpa-connector.googlecode.com/files/JPA%20ODA%20UI%20-%20plugin.rar
 +
 +
=== Screenshots ===
 +
 
 +
<gallery caption="">
 +
Image:Test_JPA_ODA_UI_1.png‎|Test Launching oda-jpa-ui
 +
Image:Test_JPA_ODA_UI_2.png‎|New JPA Data Source
 +
Image:Test_JPA_ODA_UI_3.png‎|Select JPA application directory
 +
Image:Test_JPA_ODA_UI_4.png‎|Insert Persistence Unit Name
 +
Image:Test_JPA_ODA_UI_5.png‎|New JPA Data Set
 +
Image:Test_JPA_ODA_UI_6.png‎|Enter and Verify JPQL Query
 +
Image:Test_JPA_ODA_UI_7.png‎|Output Columns of JPA Data Set
 +
Image:Test_JPA_ODA_UI_8.png‎|Preview Results of JPA Data Set
 +
Image:Test_JPA_ODA_UI_9.png‎|Attributes Visualization of JPA Data Set
 +
Image:Test_JPA_ODA_UI_10.png‎|Drag and Drop
 +
Image:Test_JPA_ODA_UI_11.png‎|Output Console in oda-jpa
 +
</gallery>
  
 
== References ==
 
== References ==

Latest revision as of 09:53, 19 September 2009

Contents

[edit] Abstract

The Java Persistence API (JPA)is the Java API for the management of persistence and object/relational mapping for Java EE and Java SE environments. The persistence consists of three areas:

  • the API, defined in the javax.persistence package
  • the Java Persistence Query Language
  • object/relational metadata

The purpose of this project proposal is to implement a Connector JPA for BIRT framework, and so able to handle data source from the persistence API. Is so great the importance of the project because JPA is a specification that is being used widely in the development of applications, precisely from the advantages it.

The implementation is to make the JPA ODA driver, extending each one of the interface required in the Data Tools Plataform given in the package org.eclipse.datatools.connectivity.oda.

Finalizing it first part will be an improvement approaching also advanced options in regard to the parameters and also will be implemented JPA ODA IU extensions.

[edit] Participants

http://alfonso777.blogspot.com/

http://code.google.com/p/birt-jpa-connector/

[edit] Planned Features

  1. Handling of configuration file: persistence.xml.
  2. JPA utilities for get current EntityManager and EntityManagerFactory
  3. JPQL queries validation.
  4. Get the metadata information such as column names, column types, column class for the query .
  5. Instantiation of ResulSetMetaData, DataSetMetaData, ResulSet.
  6. Soport in the preparement and execution of Queries.
  7. Working good with the implementations de JPA: Hibernate and TopLink.


[edit] Should Have

  • Handling of other configuration file: orm.xml
  • Soport more advance of Parameters into queries.

[edit] Nice to have

  • Soport JDO and JPA at the same time.


[edit] Community proposals

Feel free to add your comments and ideas.

[edit] Getting the source

ViewCVS: http://code.google.com/p/birt-jpa-connector/source/browse [1]

CVS: https://birt-jpa-connector.googlecode.com/svn/trunk/

[edit] Getting Resources

Here you get examples, examples and test for some modules. Moreover there are scripts for DB, JPA example, screenshots, videos demo , etc.

[edit] JPA ODA plugin

[edit] Source Code

[edit] The "Statement" class

The "Statement" class, prepare the result set metadata of the query (containing column name, column type, and entity name that belong), execute the query, and fetches the data rows from the Data Source.

[edit] Problems founded developing whit JPA in this class:

1. To get attributes of the entities (field names and field types) found into the query e.g.:

SELECT d.departmentIdentifier, d.name 
FROM Department d

Was necessary know the complete path, like “jfabian.model.department.entity.Department”, an option was write this in the query as is possible in hibernate but this idea was discard becouse JPA not allow it.

The solution was getting the name of entity and searches the complete path into “persistence.xml” file, this implemented in “JPAUtil.findEntityOnPersistenceXML(entityName, classNodes)” function.

2. Other aspect to take into consideration are the entity alias, this to retrieve the corresponding column e.g.:

SELECT d.departmentIdentifier, d.name, 
e.employeeIdentifier  , e.firstName
FROM Department d, Employee e

In this query the alias for Department is “d”, and its columns are “departmentIdentifier” and “name”, to retrieve the columns types I need know the entity name (with path complete), and column or field name.

And the functionality should be correct if the column order is not the same to instance of the entities, e.g.:

SELECT e.firstName, d.name, 
e.employeeIdentifier, d.departmentIdentifier
FROM Department d, Employee e

For this task was implemented “extractColumns(qry)”, that return a “List<List<String>>” containing the entity alias and column name. Other was “getReturnEntities( String query )”, that return a “List<List<String> >” containing entity name and entity alias.

[edit] Work future

A) Yet not support the recognition of alias with “as” like:

SELECT d.name FROM Department as d

B) Yet not support retrieve all columns of the entity (similarity to Selec *from department in JDBC):

SELECT d FROM Department as d

C) When a entity has a member variable to other entity, retrieve its metadata still is not possible:

SELECT d.director.firstName FROM Department d

In this case “director” is an entity “Employee”


D) Yet not distinguish some reserved words like:

SELECT DISTINCT d.name FROM Department d

E) Collection member declaration*

SELECT DISTINCT l.product FROM Order AS o, IN(o.lineItems) l

F) The possibility for retrieve metadata when use aggregate functions *

SELECT AVG(mag.price) FROM Magazine mag
  • On JSR220: Enterprise Java Beans V3.0, Java Persistence API in Chapter

[edit] Video Demo

  • In this video we are preparing all necesary for generate the report, like; install BIRT Runtime, deploy the ODA JPA plug-in, create the JPA test project, install the Sample database, configure the report, etc.:

[edit] Screenshots

[edit] JPA ODA UI Plug-in

[edit] Source Code

[edit] Description

To use the data retrieved by the JPA ODA driver in a BIRT report design, One must extend the DTP design UI. To implement the JPA ODA UI, extend the following extension points:

  • org.eclipse.datatools.connectivity.oda.design.ui.dataSource
  • org.eclipse.ui.propertyPages
  • org.eclipse.datatools.connectivity.connectionProfile

[edit] Video Demo

[edit] Screenshots

[edit] References

[edit] BIRT References

  • Eclipse Resources:

http://www.eclipse.org/resources/?category=BIRT

  • The plug-in extension examples from Integrating and Extending BIRT

http://www.actuate.com/products/products-resources.asp?ArticleId=11719

[edit] JPA References

  • JPA specification:

http://jcp.org/en/jsr/detail?id=317

  • Documentation JPA API:

http://java.sun.com/javaee/5/docs/api/javax/persistence/package-tree.html

  • GlassFish Project - Java Persistence Example:

https://glassfish.dev.java.net/javaee5/persistence/persistence-example.html

  • Master the New Persistence Paradigm with JPA

http://www.devx.com/Java/Article/33650

  • Persistence Pays Offs: Advanced Mapping with JPA

http://www.devx.com/Java/Article/33906

http://www.oracle.com/technology/pub/articles/marx-jpa.html

  • Book: Mike Keith, Merrick Schincariol, "Pro EJB 3: Java Persistence API", Apress.
  • JPQL

http://edocs.bea.com/kodo/docs40/full/html/ejb3_langref.html

[edit] Other Important References

  • Documentation Hibernate API:

http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Query.html

  • Documentation TopLink API:

http://www.oracle.com/technology/products/ias/toplink/doc/10131/main/b28219/index.html

  • JFire Project - BIRT datasource for JDO:

http://www.jpox.org/docs/1_2/examples/jfire.html

  • OpenMRS - BIRT ODA Plugin User Guide:

http://openmrs.org/wiki/BIRT_ODA_Plugin_User_Guide

  • Example about JasperReports with JPA:

http://www.jroller.com/marceloverdijk/entry/ejbql_query_support_added_in