Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
JPA ODA Driver
Clovis Wichoski
<p>Hi</p><p> </p><p>Anyone knows the better way to integrate JPA with BIRT? Like a JPA ODA Driver to avoid rewriting SQL statements?</p><p> </p><p>I'm using EclipseLink JPA and BIRT 4.3</p><p> </p><p>Thanks for any help.</p>
Find more posts tagged with
Comments
mwilliams
Looks like there's a Google project out there. Looks like it's pretty old though:
<a data-ipb='nomediaparse' href='
https://code.google.com/p/birt-jpa-connector/'>https://code.google.com/p/birt-jpa-connector/</a>
;
You could always submit an enhancement request at eclipse.org/birt, too.
Clovis Wichoski
<p>Hi Michael,</p><p> </p><p>I see that jpa connector but as its too old I will use scripted data sources, I think that will do the job.</p><p> </p><p>Best regards.</p>
mwilliams
Okay. If you feel like writing a custom ODA, you could always put it in the devShare for others looking for the same type of connector.
Clovis Wichoski
<pre class="_prettyXprint"><data-sources> <script-data-source name="JPA" id="117"> <method name="open"> <![CDATA[ importPackage(Packages.com.neoinix.helper); importPackage(Packages.com.neoinix.util); var pm = PersistenceManager.getInstance(); var em = pm.createEntityManager(); var q = em.createQuery("SELECT entity FROM com.neoinix.domain.financeiro.TituloFinanceiro entity WHERE entity.contrato.id = :idContrato ORDER BY entity.numero"); q.setParameter("idContrato",parseInt(params["idContrato"])); myIterator = q.getResultList().listIterator(); ]]> </method> <method name="close"> <![CDATA[ pm = null; em = null; q = null; myIterator = null; ]]> </method> </script-data-source> </data-sources> <data-sets> <script-data-set name="dataSetJPA" id="118"> <structure name="cachedMetaData"/> <property name="dataSource">JPA</property> <method name="fetch"> <![CDATA[ if(myIterator.hasNext()){ tituloFinanceiro = myIterator.next(); beneficiario = tituloFinanceiro.getEmpresa(); pagador = tituloFinanceiro.getPessoa(); contaCorrente = tituloFinanceiro.getContaCorrente(); return true; } else return false; ]]> </method> </script-data-set> </data-sets></pre><p>Then just call in report the POJO methods directly for example in HTML expressions <VALUE-OF>tituloFinanceiro.getValor()</VALUE-OF></p><p> </p><p>This isnt the better solution as you can use the designer, but for me its better to work at XML source.</p><p> </p><p>The code above its based on: <a data-ipb='nomediaparse' href='
http://java.dzone.com/articles/eclipses-birt-scripted-data'>http://java.dzone.com/articles/eclipses-birt-scripted-data</a></p>
;
mwilliams
<p>Thanks for updating the thread with your solution!
</p>