Yup, I have the same comment.

By the way Christian, any plan to donate your examples/tutorial in pax-jdbc and/or karaf ?

It would be part of the itests and dev guide and valuable for the devs IMHO.

Just my $0.01 ;)

Regards
JB

On 26/10/2019 17:37, Christian Schneider wrote:
Hi Steinar,

you do not have to build your own layer to use liquibase. Pax-jdbc-config has a preHook that can help with this.

See https://github.com/cschneider/Karaf-Tutorial/blob/master/liquibase/service/src/main/java/net/lr/tutorial/db/service/Migrator.java
and
https://github.com/cschneider/Karaf-Tutorial/blob/master/liquibase/org.ops4j.datasource-person.cfg#L4

The preHook attribute allows to select a PreHook service by name.
This service is called before the DataSource is published.

Christian


Am Sa., 26. Okt. 2019 um 16:06 Uhr schrieb Steinar Bang <[email protected] <mailto:[email protected]>>:

    >>>>> [email protected] <mailto:[email protected]>:

    > Hi
    > Thanks for sharing, I will take a look.

    > The purpose is to have a service layer ?

    The purpose is to have a database that is ready to be used
    (ie. connected and with a schema) by the business logic code, and to
    make it easy to switch databases.

    > What's the difference with pax-jdbc and karaf JDBC feature ?

    It builds on top of them.

    pax-jdbc provides a DataSourceFactory.

    The components described in the blog post provides a DataSource.

    The addition to pax-jdbc is actually connecting to the database and
    using liquibase to set up/modify the schema and insert initial data.

    Ie. my application specific database DS components use pax-jdbc
    (in the
    case of derby) and the PostgreSQL driver to get the DataSourceFactory

    When the application specific database DS components receive a
    DataSourceFactory injection and they are activated, the first
    thing they
    do is get a DataSource from the DataSourceFactory. This DataSource is
    kept around while the DS component is active.

    Before exposing any service, the application specific database DS
    component will run liquibase scripts to set up/update the schema (and
    add initial data), and when the scripts have run expose the
    application
    specific database service.



--
--
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com

Reply via email to