7 Replies Latest reply on Feb 18, 2013 1:53 PM by vasilievip

    Any Example for ModeShape JPA for 3.1.1.Final or EhCache

    mrhaneef

      Does any one has a example for JPA or EhCache in version 3.1.1.Final.

       

      Thanks

      Haan

        • 1. Re: Any Example for ModeShape JPA for 3.1.1.Final or EhCache
          rhauch

          Can you be more specific?

          • 2. Re: Any Example for ModeShape JPA for 3.1.1.Final or EhCache
            mrhaneef

            I wanted to use DB as my storage. I could not find any docs or example for latest release (3.1.1). Also  wanted to find out how to configure ehcache insted of infinispan.

             

            Thanks

            Haan

            • 3. Re: Any Example for ModeShape JPA for 3.1.1.Final or EhCache
              rhauch

              ModeShape 3 uses Infinispan for transactional storage (not just as an in-memory cache). EhCache doesn't have the set of features ModeShape needs, and therefore ModeShape cannot use EhCache.

               

              To configure ModeShape 3 to store the content in a database, simply configure the Infinispan cache to use a DB cache store. For details, see this example which uses a local/embedded H2 database (but you can choose your other locations).

              • 4. Re: Any Example for ModeShape JPA for 3.1.1.Final or EhCache
                mrhaneef

                Your are good, The example works.

                I tried to switch to oracle 11, its failing

                 

                ERROR: ISPN008011: Error while creating table; used DDL statement: 'CREATE TABLE ISPN_STRING_TABLE_persisted_repository(ID_COLUMN VARCHAR(255) NOT NULL, DATA_COLUMN BINARY, TIMESTAMP_COLUMN BIGINT, PRIMARY KEY (ID_COLUMN))'

                java.sql.SQLSyntaxErrorException: ORA-00972: identifier is too long

                 

                I ran the ddl in oracle with shorter table name, i am getting

                ERROR: ORA-00902: invalid datatype

                 

                Error Code: 902

                Query =

                CREATE TABLE ISPN_STRING_TABLE_persisted(ID_COLUMN VARCHAR(255)

                NOT NULL, DATA_COLUMN BINARY, TIMESTAMP_COLUMN BIGINT, PRIMARY

                KEY (ID_COLUMN))

                 

                 

                <properties>

                                 <property name="stringsTableNamePrefix" value="ISPN_STRING_TABLE"/>

                                 <property name="idColumnName" value="ID_COLUMN"/>

                                 <property name="dataColumnName" value="DATA_COLUMN"/>

                                 <property name="timestampColumnName" value="TIMESTAMP_COLUMN"/>

                                 <property name="timestampColumnType" value="BIGINT"/>

                                 <property name="connectionFactoryClass" value="org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory"/>

                                 <!--   property name="connectionUrl" value="jdbc:h2:file:target/content/db;DB_CLOSE_DELAY=-1"/ -->

                                 <property name="connectionUrl" value="jdbc:oracle:thin:@f-oradb701lp.abc.com:1521:Dev01"/>

                                 <!--  property name="userName" value="sa"/ -->

                                 <property name="userName" value="user_"/>

                                 <property name="password" value="password_"/>

                                 <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/>

                                 <property name="idColumnType" value="VARCHAR(255)"/>

                                 <property name="dataColumnType" value="BINARY"/>

                                 <property name="dropTableOnExit" value="false"/>

                                 <property name="createTableOnStart" value="true"/>

                              </properties>

                 

                pom

                <dependency>
                <groupId>com.oracle</groupId>
                <artifactId>ojdbc6</artifactId>
                <version>11.1.0.6.0</version>
                <scope>provided</scope>
                </dependency>

                 

                Any help please.

                Haan

                • 5. Re: Any Example for ModeShape JPA for 3.1.1.Final or EhCache
                  rhauch

                  I've not used Oracle myself, but perhaps someone else has.

                   

                  But doesn't Oracle use BLOB for the binary large object type? And IIRC they use "NUMBER(19)" for a big integer. Maybe try the following:

                   

                       <property name="dataColumnType" value="BLOB"/>

                       <property name="timestampColumnType" value="NUMBER(19)"/>

                  1 of 1 people found this helpful
                  • 6. Re: Any Example for ModeShape JPA for 3.1.1.Final or EhCache
                    mrhaneef

                    That worked. Thanks for create a examples and your help.

                    • 7. Re: Any Example for ModeShape JPA for 3.1.1.Final or EhCache
                      vasilievip

                      Here is what works for me:

                      {code:xml}

                      <loader class="org.infinispan.loaders.jdbc.binary.JdbcBinaryCacheStore" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">               <properties>                     <property name="connectionFactoryClass" value="org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory"/>                     <property name="connectionUrl" value="jdbc:oracle:thin:@192.168.32.70:1521:MODE3"/>                     <property name="userName" value="MODE3"/>                     <property name="password" value="MODE3"/>                     <property name="driverClass" value="oracle.jdbc.OracleDriver"/>                     <property name="bucketTableNamePrefix" value="MODE3"/>                     <property name="idColumnName" value="ID_COLUMN"/>                     <property name="idColumnType" value="VARCHAR2(500)"/>                     <property name="dataColumnName" value="DATA_COLUMN"/>                     <property name="dataColumnType" value="BLOB"/>                     <property name="timestampColumnName" value="TIMESTAMP_COLUMN"/>                     <property name="timestampColumnType" value="NUMERIC"/>                     <property name="dropTableOnExit" value="false"/>                     <property name="createTableOnStart" value="true"/>                 </properties>                      </loader>

                      {code}