You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by René Aravena <re...@gmail.com> on 2014/10/31 03:30:58 UTC

Cayenne+jasper reports

With cayenne 3.1, as I can get the connection to the database to pass it to
jasperreports?

René

Re: Cayenne+jasper reports

Posted by René Aravena <re...@gmail.com>.
Thanks for the help friends.
El 31/10/2014 01:37, "Andrus Adamchik" <an...@objectstyle.org> escribió:

> >
> ((DataContext)getObjectContext()).getParentDataDomain().getDefaultNode().getDataSource().getConnection();
>
>
> There is a shortcut in 3.1 for the code above:
>
>   ServerRuntime runtime = ..
>   DataSource ds = runtime.getDataSource("mynode");
>
> JNDI mentioned by Ari is an even better alternative.
>
> Andrus
>
> > On Oct 31, 2014, at 8:49 AM, Markus Reich <ma...@markusreich.at>
> wrote:
> >
> > Hi René,
> >
> > yes you can access a connection
> >
> > e.g.
> > public static Connection getConnection() throws Exception {
> >    return
> >
> ((DataContext)getObjectContext()).getParentDataDomain().getDefaultNode().getDataSource().getConnection();
> >  }
> >
> > 2014-10-31 3:30 GMT+01:00 René Aravena <re...@gmail.com>:
> >
> >> With cayenne 3.1, as I can get the connection to the database to pass
> it to
> >> jasperreports?
> >>
> >> René
> >>
> >
> >
> >
> > --
> > *Markus Reich*
> > Waldweg 62
> > 6393 St. Ulrich am Pillersee
> > www.markusreich.at / www.meeximum.at
> > markus.reich@markusreich.at
>
>

Re: Cayenne+jasper reports

Posted by Andrus Adamchik <an...@objectstyle.org>.
> ((DataContext)getObjectContext()).getParentDataDomain().getDefaultNode().getDataSource().getConnection();


There is a shortcut in 3.1 for the code above:

  ServerRuntime runtime = ..
  DataSource ds = runtime.getDataSource("mynode");

JNDI mentioned by Ari is an even better alternative.

Andrus

> On Oct 31, 2014, at 8:49 AM, Markus Reich <ma...@markusreich.at> wrote:
> 
> Hi René,
> 
> yes you can access a connection
> 
> e.g.
> public static Connection getConnection() throws Exception {
>    return
> ((DataContext)getObjectContext()).getParentDataDomain().getDefaultNode().getDataSource().getConnection();
>  }
> 
> 2014-10-31 3:30 GMT+01:00 René Aravena <re...@gmail.com>:
> 
>> With cayenne 3.1, as I can get the connection to the database to pass it to
>> jasperreports?
>> 
>> René
>> 
> 
> 
> 
> -- 
> *Markus Reich*
> Waldweg 62
> 6393 St. Ulrich am Pillersee
> www.markusreich.at / www.meeximum.at
> markus.reich@markusreich.at


Re: Cayenne+jasper reports

Posted by Markus Reich <ma...@markusreich.at>.
Hi René,

yes you can access a connection

e.g.
public static Connection getConnection() throws Exception {
    return
((DataContext)getObjectContext()).getParentDataDomain().getDefaultNode().getDataSource().getConnection();
  }

2014-10-31 3:30 GMT+01:00 René Aravena <re...@gmail.com>:

> With cayenne 3.1, as I can get the connection to the database to pass it to
> jasperreports?
>
> René
>



-- 
*Markus Reich*
Waldweg 62
6393 St. Ulrich am Pillersee
www.markusreich.at / www.meeximum.at
markus.reich@markusreich.at

Re: Cayenne+jasper reports

Posted by Aristedes Maniatis <ar...@maniatis.org>.
For many projects you'll put the database connection details into JNDI and have Cayenne and anything else get it from there. Of course you might like to give Jasper a read-only connection.

Alternatively we wrote a layer which has Jasper access the data model through Cayenne. A bit of work, but it gave us some nice advantages. JasperReports can access javabeans as a data source.

Ari


On 31/10/2014 1:30pm, René Aravena wrote:
> With cayenne 3.1, as I can get the connection to the database to pass it to
> jasperreports?
> 
> René
> 

-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A