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.<br><br>To access the OpenCms Database properties I've simply extended the Spring <i>DriverManagerDatasource </i>and filled with the data from the OpenCms <i>CmsConfigurationManager:<br>
<br></i><font size="2"><span style="font-family: courier new,monospace;">public class WorkflowDataSource extends org.springframework.jdbc.datasource.DriverManagerDataSource {<br>    private static Map data;<br>    <br>    public WorkflowDataSource() {<br>
<br>        if (data != null) {<br>            setUrl((String)data.get("db.pool.default.jdbcUrl")<br>                   +(String) data.get("db.pool.default.jdbcUrl.params"));<br>            setUsername((String) data.get("db.pool.default.user"));<br>
            setPassword((String) data.get("db.pool.default.password"));<br>            setDriverClassName((String) data.get("db.pool.default.jdbcDriver"));<br>        }<br>    }<br>    <br>    public static void initDatasourceData(CmsConfigurationManager config) {<br>
        data = config.getConfiguration();<br>    }<br>}<br><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">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: <a href="http://sourceforge.net/project/showfiles.php?group_id=180314">http://sourceforge.net/project/showfiles.php?group_id=180314</a></span><br>
</span></font><br>Cheers<br>David<br><br><div class="gmail_quote">2008/3/1 Arash Kaffamanesh <<a href="mailto:arash.kaffamanesh@pomegranate.de">arash.kaffamanesh@pomegranate.de</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
additionally you need some util classes to manage an configure your<br>
connection and you can use the same connection pool in your module classes.<br>
have a look also in com.bearingpoint.springmanager module, perhaps you<br>
can find more hints there:<br>
<br>
<a href="http://sourceforge.net/project/showfiles.php?group_id=180314" target="_blank">http://sourceforge.net/project/showfiles.php?group_id=180314</a><br>
<div><div></div><div class="Wj3C7c"><br>
Best,<br>
Arash<br>
<br>
<br>
Jordi Martí schrieb:<br>
> Mmmh... not exactly... I would like to tell hibernate to use opencms<br>
> database pool... is it possible? I don't want to create another database<br>
> pool for the same database...<br>
><br>
><br>
> JORDI MARTÍ<br>
> Email: jmarti AT theinit dot com<br>
><br>
><br>
><br>
> PRIVADO Y CONFIDENCIAL<br>
> Este mensaje va dirigido a la persona(s) indicada(s). Puede contener<br>
> información confidencial de carácter legal o personal de THE INIT SERVICES,<br>
> La transmisión errónea del presente mensaje en ningún momento supone<br>
> renuncia a su confidencialidad. Si el lector del mensaje no es el<br>
> destinatario indicado, o el empleado encargado de su entrega a dicha<br>
> persona, por favor, notifíquelo inmediatamente por teléfono y remita el<br>
> mensaje original a la dirección de correo electrónico indicada. Cualquier<br>
> copia o distribución de esta comunicación queda estrictamente prohibida.<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> -----Mensaje original-----<br>
> De: <a href="mailto:opencms-dev-bounces@opencms.org">opencms-dev-bounces@opencms.org</a> [mailto:<a href="mailto:opencms-dev-bounces@opencms.org">opencms-dev-bounces@opencms.org</a>]<br>
> En nombre de Arash Kaffamanesh<br>
> Enviado el: viernes, 29 de febrero de 2008 18:09<br>
> Para: The OpenCms mailing list<br>
> Asunto: Re: [opencms-dev] hibernate and opencms<br>
><br>
> Jordi,<br>
> just wrote a small howto:<br>
><br>
> <a href="http://www.pomegranate.de:9000/cms/forum/viewthread?thread=137" target="_blank">http://www.pomegranate.de:9000/cms/forum/viewthread?thread=137</a><br>
><br>
> Best,<br>
> Arash<br>
><br>
><br>
> Jordi Martí schrieb:<br>
><br>
>> Hi,<br>
>><br>
>> Talking about sql connections….<br>
>><br>
>> Does anybody know if there's a way to hook up opencms database pool with<br>
>> hibernate and spring?<br>
>><br>
>> Thanks.<br>
>><br>
>><br>
>> JORDI MARTÍ<br>
>> Skype ID: jmarti.theinit<br>
>><br>
>><br>
>><br>
>> PRIVADO Y CONFIDENCIAL<br>
>> Este mensaje va dirigido a la persona(s) indicada(s). Puede contener<br>
>> información confidencial de carácter legal o personal de THE INIT<br>
>><br>
> SERVICES,<br>
><br>
>> La transmisión errónea del presente mensaje en ningún momento supone<br>
>> renuncia a su confidencialidad. Si el lector del mensaje no es el<br>
>> destinatario indicado, o el empleado encargado de su entrega a dicha<br>
>> persona, por favor, notifíquelo inmediatamente por teléfono y remita el<br>
>> mensaje original a la dirección de correo electrónico indicada. Cualquier<br>
>> copia o distribución de esta comunicación queda estrictamente prohibida.<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> This mail is sent to you from the opencms-dev mailing list<br>
>> To change your list options, or to unsubscribe from the list, please visit<br>
>> <a href="http://lists.opencms.org/mailman/listinfo/opencms-dev" target="_blank">http://lists.opencms.org/mailman/listinfo/opencms-dev</a><br>
>><br>
>><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> This mail is sent to you from the opencms-dev mailing list<br>
> To change your list options, or to unsubscribe from the list, please visit<br>
> <a href="http://lists.opencms.org/mailman/listinfo/opencms-dev" target="_blank">http://lists.opencms.org/mailman/listinfo/opencms-dev</a><br>
><br>
><br>
> _______________________________________________<br>
> This mail is sent to you from the opencms-dev mailing list<br>
> To change your list options, or to unsubscribe from the list, please visit<br>
> <a href="http://lists.opencms.org/mailman/listinfo/opencms-dev" target="_blank">http://lists.opencms.org/mailman/listinfo/opencms-dev</a><br>
><br>
><br>
<br>
<br>
<br>
_______________________________________________<br>
This mail is sent to you from the opencms-dev mailing list<br>
To change your list options, or to unsubscribe from the list, please visit<br>
<a href="http://lists.opencms.org/mailman/listinfo/opencms-dev" target="_blank">http://lists.opencms.org/mailman/listinfo/opencms-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>