You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Jason Tesser <ja...@dotmarketing.com> on 2008/01/24 19:45:17 UTC

schema creation not working

I am using

<PersistenceManager class="
org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager">
               <param name="bundleCacheSize" value="8"/>
            <param name="consistencyCheck" value="false"/>
            <param name="consistencyFix" value="false"/>
            <param name="driver" value="javax.naming.InitialContext"/>
            <param name="url" value="java:comp/env/jdbc/LiferayPool"/>
            <param name="schema" value="postgresql"/>
            <param name="schemaObjectPrefix" value="jr_ws_"/>
            <param name="errorHandling" value=""/>
            <param name="blockOnConnectionLoss" value="false"/>
        </PersistenceManager>

and for versions

<PersistenceManager class="
org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager">
               <param name="bundleCacheSize" value="8"/>
            <param name="consistencyCheck" value="false"/>
            <param name="consistencyFix" value="false"/>
            <param name="driver" value="javax.naming.InitialContext"/>
            <param name="url" value="java:comp/env/jdbc/LiferayPool"/>
            <param name="schema" value="postgresql"/>
            <param name="schemaObjectPrefix" value="jr_ver_"/>
            <param name="errorHandling" value=""/>
            <param name="blockOnConnectionLoss" value="false"/>
        </PersistenceManager>


it is creating 4 tables but apparently not the ones it needs.  It is
creating the tables with the jr_ver_ prefix but none with jr_ws.  I tried to
make the scema prefixes the same different nothing seems to work.   I
noticed that there is postgresql.ddl which should create the Node table and
a few others.  This is not happening.  I thought it should happen
automatically.  any ideas?



-- 
Jason S. Tesser
Lead Programmer
www.dotmarketing.com
www.dotcms.org
Dotmarketing, Inc.
3059 Grand Avenue
Suite 440
Miami, FL 33133
T: 305.858.1422  x279
F: 786.594.5288

Re: schema creation not working

Posted by Thomas Mueller <th...@gmail.com>.
Hi,

Just for completeness, as I wrote in the other thread: using

org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager

should solve the problem.

Regards,
Thomas

Re: schema creation not working

Posted by Jason Tesser <ja...@dotmarketing.com>.
Basically the problem is that the ddl for Postgres creates the schema

create table ${schemaObjectPrefix}BUNDLE (NODE_ID_HI bigint not null,
NODE_ID_LO bigint not null, BUNDLE_DATA bytea not null, PRIMARY KEY
(NODE_ID_HI, NODE_ID_LO))
create table ${schemaObjectPrefix}REFS (NODE_ID_HI bigint not null,
NODE_ID_LO bigint not null, REFS_DATA bytea not null, PRIMARY KEY
(NODE_ID_HI, NODE_ID_LO))
create table ${schemaObjectPrefix}BINVAL (BINVAL_ID varchar(64) not null,
BINVAL_DATA bytea not null)
create unique index ${schemaObjectPrefix}BINVAL_IDX on
${schemaObjectPrefix}BINVAL (BINVAL_ID)
create table ${schemaObjectPrefix}NAMES (ID SERIAL PRIMARY KEY, NAME
varchar(255) not null)

The problem is the in the
org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager

it cannot ever call the sql for this kind of SQL See code below

public int getStorageModel() {
        return SM_BINARY_KEYS;
    }

String sql;
            if (getStorageModel() == SM_BINARY_KEYS) {
                sql = "select NODE_ID, BUNDLE_DATA from " +
schemaObjectPrefix + "BUNDLE";
            } else {
                sql = "select NODE_ID_HI, NODE_ID_LO, BUNDLE_DATA from " +
schemaObjectPrefix + "BUNDLE";
            }

The else condition will never get hit.  This happens all over this class.

Secondly their is a problem in the DbNameIndex as it has the following

rs = stmt.getGeneratedKeys();

That method is not implemented in even the latest pgjdbcdriver So it will
never work with PostgreSQL






On 1/25/08, Thomas Mueller <th...@gmail.com> wrote:
>
> Hi,
>
> The tables should be created automatically. You should not create them
> manually.
> Are there any stack traces in the log file?
> Could you post them please?
>
> Regards,
> Thomas
>



-- 
Jason S. Tesser
Lead Programmer
www.dotmarketing.com
www.dotcms.org
Dotmarketing, Inc.
3059 Grand Avenue
Suite 440
Miami, FL 33133
T: 305.858.1422  x279
F: 786.594.5288

Re: schema creation not working

Posted by Thomas Mueller <th...@gmail.com>.
Hi,

The tables should be created automatically. You should not create them manually.
Are there any stack traces in the log file?
Could you post them please?

Regards,
Thomas

Re: schema creation not working

Posted by Jason Tesser <ja...@dotmarketing.com>.
Well on further looking around even if I manually create teh tables it
doesn't work.

The version tables being created have a schema are set differently.

I see in the class
org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager the
following code

     if (getStorageModel() == SM_BINARY_KEYS) {
            bundleInsertSQL = "insert into " + schemaObjectPrefix + "BUNDLE
(BUNDLE_DATA, NODE_ID) values (?, ?)";
            .....
        } else {
            bundleInsertSQL = "insert into " + schemaObjectPrefix + "BUNDLE
(BUNDLE_DATA, NODE_ID_HI, NODE_ID_LO) values (?, ?, ?)";
           ......
        }



The tables i have seem to have to have the schema for getStorageModel() !=
SM_BINARY_KEYS

Thing is getStroageModel() returns SM_BINARY_KEYS so it is always equal.

Where is the Version ddl sql stored. Do I have to use a different
persistence model for versions?

On 1/24/08, Jason Tesser <ja...@dotmarketing.com> wrote:
>
> I am using
>
> <PersistenceManager class="
> org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager">
>
>                <param name="bundleCacheSize" value="8"/>
>             <param name="consistencyCheck" value="false"/>
>             <param name="consistencyFix" value="false"/>
>             <param name="driver" value=" javax.naming.InitialContext"/>
>             <param name="url" value="java:comp/env/jdbc/LiferayPool"/>
>             <param name="schema" value="postgresql"/>
>             <param name="schemaObjectPrefix" value="jr_ws_"/>
>             <param name="errorHandling" value=""/>
>             <param name="blockOnConnectionLoss" value="false"/>
>         </PersistenceManager>
>
> and for versions
>
> <PersistenceManager class="
> org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager">
>
>                <param name="bundleCacheSize" value="8"/>
>             <param name="consistencyCheck" value="false"/>
>             <param name="consistencyFix" value="false"/>
>             <param name="driver" value=" javax.naming.InitialContext"/>
>             <param name="url" value="java:comp/env/jdbc/LiferayPool"/>
>             <param name="schema" value="postgresql"/>
>             <param name="schemaObjectPrefix" value="jr_ver_"/>
>             <param name="errorHandling" value=""/>
>             <param name="blockOnConnectionLoss" value="false"/>
>         </PersistenceManager>
>
>
> it is creating 4 tables but apparently not the ones it needs.  It is
> creating the tables with the jr_ver_ prefix but none with jr_ws.  I tried to
> make the scema prefixes the same different nothing seems to work.   I
> noticed that there is postgresql.ddl which should create the Node table
> and a few others.  This is not happening.  I thought it should happen
> automatically.  any ideas?
>
>
>
> --
> Jason S. Tesser
> Lead Programmer
> www.dotmarketing.com
> www.dotcms.org
> Dotmarketing, Inc.
> 3059 Grand Avenue
> Suite 440
> Miami, FL 33133
> T: 305.858.1422  x279
> F: 786.594.5288




-- 
Jason S. Tesser
Lead Programmer
www.dotmarketing.com
www.dotcms.org
Dotmarketing, Inc.
3059 Grand Avenue
Suite 440
Miami, FL 33133
T: 305.858.1422  x279
F: 786.594.5288