[opencms-dev] R: Add custom jpa pool

lruggeri at maticad.it lruggeri at maticad.it
Fri Jul 26 14:42:02 CEST 2013


Hi Georgi,
thanks for your answer.

Actually i have legacy code that access the same database with classic OpenCms.getSqlManager().getConnection()
So, i would like to avoid configuring the connection twice and my goal is to put all in opencms.properties (where it already is)

Do you know how to achieve that?
Thanks

Bye, Lisa

-----Messaggio originale-----
Da: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Per conto di Georgi Naplatanov
Inviato: venerdì 26 luglio 2013 12.31
A: The OpenCms mailing list
Oggetto: Re: [opencms-dev] Add custom jpa pool

Hi Lisa,

actually OpenCms' JPA layer uses 2 pools:
  - pool for database connections
  - pool for EntityManager instances

There is an example how db connection pool can be configured with Apache DBCP - http://openjpa.apache.org/faq.html#pooling.

If you want to use a pool for EntityManager instance, you have to do that yourself, it's not difficult for implementing.


On 07/26/2013 12:41 PM, lruggeri at maticad.it wrote:
> Hi,
>
> i’d like to use jpa to access some tables in an external database
> already accesible from openmcs.
>
> How i can configure my jpa unit in order to use connection pooling
> provided by opencms?
>
> And how to get the EntityManager? It seems to me that
> CmsSqlManager.createEntityManager does not support pooling.
>
> Database configuration is now in opencms.properties file
>

Yes, all db configuration parameters are in opencms.properties because 
of  easily configuration, but in your case - additional persistence 
unit, it is easier to configure that unit in persistence.xml file.

HTH

Best regards
Georgi

> Thanks
>
> Bye, Lisa
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>
_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev







More information about the opencms-dev mailing list