[opencms-dev] hibernate and opencms
Jordi Martí
jmarti at theinit.com
Mon Mar 3 10:58:31 CET 2008
Great example, thanks!
JORDI MARTÍ
Skype ID: jmarti.theinit
________________________________________
De: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org]
En nombre de David Trattnig
Enviado el: lunes, 03 de marzo de 2008 10:06
Para: The OpenCms mailing list
Asunto: Re: [opencms-dev] hibernate and opencms
As Arash wrote the Springmanager Module is a good starting point to use
Spring/Hibernate in OpenCms. It offers the possiblity to configure and
reload your spring beans from the OpenCms VFS.
To access the OpenCms Database properties I've simply extended the Spring
DriverManagerDatasource and filled with the data from the OpenCms
CmsConfigurationManager:
public class WorkflowDataSource extends
org.springframework.jdbc.datasource.DriverManagerDataSource {
private static Map data;
public WorkflowDataSource() {
if (data != null) {
setUrl((String)data.get("db.pool.default.jdbcUrl")
+(String) data.get("db.pool.default.jdbcUrl.params"));
setUsername((String) data.get("db.pool.default.user"));
setPassword((String) data.get("db.pool.default.password"));
setDriverClassName((String)
data.get("db.pool.default.jdbcDriver"));
}
}
public static void initDatasourceData(CmsConfigurationManager config) {
data = config.getConfiguration();
}
}
Don't forget to load the initDatasourceData method on Tomcat Startup. Now
you have a fully configured Datasource Bean you can use with other Spring
Beans needing Database Connectivity. If you need other details checkout the
workflow 2 module:
http://sourceforge.net/project/showfiles.php?group_id=180314
Cheers
David
2008/3/1 Arash Kaffamanesh <arash.kaffamanesh at pomegranate.de>:
additionally you need some util classes to manage an configure your
connection and you can use the same connection pool in your module classes.
have a look also in com.bearingpoint.springmanager module, perhaps you
can find more hints there:
http://sourceforge.net/project/showfiles.php?group_id=180314
Best,
Arash
Jordi Martí schrieb:
> Mmmh... not exactly... I would like to tell hibernate to use opencms
> database pool... is it possible? I don't want to create another database
> pool for the same database...
>
>
> JORDI MARTÍ
> Email: jmarti AT theinit dot com
>
>
>
> PRIVADO Y CONFIDENCIAL
> Este mensaje va dirigido a la persona(s) indicada(s). Puede contener
> información confidencial de carácter legal o personal de THE INIT
SERVICES,
> La transmisión errónea del presente mensaje en ningún momento supone
> renuncia a su confidencialidad. Si el lector del mensaje no es el
> destinatario indicado, o el empleado encargado de su entrega a dicha
> persona, por favor, notifíquelo inmediatamente por teléfono y remita el
> mensaje original a la dirección de correo electrónico indicada. Cualquier
> copia o distribución de esta comunicación queda estrictamente prohibida.
>
>
>
>
>
>
>
> -----Mensaje original-----
> De: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org]
> En nombre de Arash Kaffamanesh
> Enviado el: viernes, 29 de febrero de 2008 18:09
> Para: The OpenCms mailing list
> Asunto: Re: [opencms-dev] hibernate and opencms
>
> Jordi,
> just wrote a small howto:
>
> http://www.pomegranate.de:9000/cms/forum/viewthread?thread=137
>
> Best,
> Arash
>
>
> Jordi Martí schrieb:
>
>> Hi,
>>
>> Talking about sql connections
.
>>
>> Does anybody know if there's a way to hook up opencms database pool with
>> hibernate and spring?
>>
>> Thanks.
>>
>>
>> JORDI MARTÍ
>> Skype ID: jmarti.theinit
>>
>>
>>
>> PRIVADO Y CONFIDENCIAL
>> Este mensaje va dirigido a la persona(s) indicada(s). Puede contener
>> información confidencial de carácter legal o personal de THE INIT
>>
> SERVICES,
>
>> La transmisión errónea del presente mensaje en ningún momento supone
>> renuncia a su confidencialidad. Si el lector del mensaje no es el
>> destinatario indicado, o el empleado encargado de su entrega a dicha
>> persona, por favor, notifíquelo inmediatamente por teléfono y remita el
>> mensaje original a la dirección de correo electrónico indicada. Cualquier
>> copia o distribución de esta comunicación queda estrictamente prohibida.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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/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/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/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/mailman/listinfo/opencms-dev
More information about the opencms-dev
mailing list