[JIRA] Updated: (CAY-884) Add support for H2 Database

From: Siarhei Kaneuski (JIRA) ("Siarhei)
Date: Mon Jan 07 2008 - 11:19:32 EST

  • Next message: Siarhei Kaneuski (JIRA): "[JIRA] Issue Comment Edited: (CAY-884) Add support for H2 Database"

         [ https://issues.apache.org/cayenne/browse/CAY-884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Siarhei Kaneuski updated CAY-884:
    ---------------------------------

        Attachment: h2adapter.zip

    1. Changes were done against revision 609573.

    2. For new H2 adapter, all tests are passed with connection string:
    jdbc:h2:mem:myTestMem;MVCC=TRUE - in-memory database with MVCC mode

    If we use default settings, 1 test fails (DataContextCrossDBTest):
    org.h2.jdbc.JdbcSQLException: Timeout trying to lock table AUTO_PK_SUPPORT [HYT00-63] ...
             at org.h2.command.Command.executeQuery(Command.java:59)
             at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java :157)
             at org.apache.cayenne.access.jdbc.SQLTemplateAction.execute(SQLTemplateAction.java:133)
             ...
    H2 supports table locks only (see Locking, Lock-Timeout, Deadlocks section of http://www.h2database.com/html/frame.html?features.html&main). Row locks are in wish-list for next release: http://groups.google.com/group/h2-database/web/roadmap

    I was playing with available isolation settings (with new in-memory database for every test, to avoid interference):
         • jdbc:h2:mem:myTestMem2;LOCK_MODE=0 - "read uncommitted" mode; as expected, there is no the error in this mode
         • jdbc:h2:mem:myTestMem3;LOCK_MODE=3 - "read committed" mode (default); fails with lock error
         • jdbc:h2:mem:myTestMem4;LOCK_MODE=1 - "read serializable" mode; strict mode, so fails as expected
         • jdbc:h2:mem:myTestMem5;MVCC=TRUE - Multi-Version Concurrency Control; no lock errors ("When using MVCC, delete, insert and
     update operations will only issue a shared lock on the table. Table are still locked exclusively when adding or removing columns, when dropping the table, and when using SELECT ... FOR UPDATE. Connections only 'see' committed data, and own changes")

    3. types.xml. The only issue with types is support of LONGVARCHAR. When we write LONGVARCHAR to database, and read it again - I receive INTEGER (?!). So I map LONGVARCHAR to CLOB:
       <jdbc-type name="LONGVARCHAR">
           <db-type name="CLOB"/>
       </jdbc-type>

    > Add support for H2 Database
    > ---------------------------
    >
    > Key: CAY-884
    > URL: https://issues.apache.org/cayenne/browse/CAY-884
    > Project: Cayenne
    > Issue Type: New Feature
    > Reporter: Ahmed Mohombe
    > Assignee: Andrus Adamchik
    > Attachments: h2adapter.zip
    >
    >
    > Please add support for H2 Database.
    > H2 database can be found here:
    > http://h2database.com/
    > and it resambles greatly to HSQLDB (H2 means "HSQLDB 2") but it's much faster and can handle
    > much more content.
    > Thanks in advance,
    > Ahmed.

    -- 
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
    



    This archive was generated by hypermail 2.0.0 : Mon Jan 07 2008 - 11:20:18 EST