[Geoserver-users] Unable to edit geofence rule (layer details) when using Oracle for hibernation

Using geoserver 2.7.2 and matching geofence…

With an Oracle schema targeted for geofence data-persistence it is impossible to edit-details for a given geofence layer rule. The problem happens because geofence fails to successfully create the gf_layer_attributes table in Oracle, as its create-table statement is not valid SQL for an Oracle 11g database.

I can create users, groups, instance, rules in general and it all saves to Oracle and behaves as expected.

During startup of geofence I see the following in my tomcat log:

17:25:09,357 ERROR SchemaUpdate:212 - Unsuccessful: create table FDOTWEBSVC.gf_layer_attributes (details_id number(19,0) not null, access_type varchar2(255 char), data_type varchar2(255 char), name varchar2(255 char) not null, primary key (details_id, name), unique (details_id, name))
17:25:09,358 ERROR SchemaUpdate:213 - ORA-02261: such unique or primary key already exists in the table

If I execute the SQL that’s shown in Oracle’s sqlDev I see this error output:

SQL Error: ORA-02261: such unique or primary key already exists in the table
02261. 00000 - “such unique or primary key already exists in the table”
*Cause: Self-evident.
*Action: Remove the extra key.

The problem is apparently that the “primary key” has already established that details_id, name are unique. So the “unique” statement is rejected.

I can workaround the problem entirely by creating the table manually as follows and then restart tomcat.

CREATE TABLE gf_layer_attributes

(

details_id NUMBER(19,0) NOT NULL,

access_type VARCHAR2(255 CHAR),

data_type VARCHAR2(255 CHAR),

name VARCHAR2(255 CHAR) NOT NULL,

PRIMARY KEY(details_id, name)

);

Walter

Hi Walter,

it's definitely an issue with hibernate creating the Oracle schema.

A DDL file should be provided, and we should only rely on that and not on the
automatic schema generation.

I added your findings on this issue:
   https://github.com/geoserver/geofence/issues/22

   Thanks,
   Emanuele

Alle 12:03:46 di Wednesday 30 September 2015, Walter Stovall ha scritto:

Using geoserver 2.7.2 and matching geofence...

With an Oracle schema targeted for geofence data-persistence it is
impossible to edit-details for a given geofence layer rule. The problem
happens because geofence fails to successfully create the
gf_layer_attributes table in Oracle, as its create-table statement is not
valid SQL for an Oracle 11g database.

I can create users, groups, instance, rules in general and it all saves to
Oracle and behaves as expected.

During startup of geofence I see the following in my tomcat log:
17:25:09,357 ERROR SchemaUpdate:212 - Unsuccessful: create table
FDOTWEBSVC.gf_layer_attributes (details_id number(19,0) not null,
access_type varchar2(255 char), data_type varchar2(255 char), name
varchar2(255 char) not null, primary key (details_id, name), unique
(details_id, name)) 17:25:09,358 ERROR SchemaUpdate:213 - ORA-02261: such
unique or primary key already exists in the table

If I execute the SQL that's shown in Oracle's sqlDev I see this error
output: SQL Error: ORA-02261: such unique or primary key already exists in
the table 02261. 00000 - "such unique or primary key already exists in
the table" *Cause: Self-evident.
*Action: Remove the extra key.

The problem is apparently that the "primary key" has already established
that details_id, name are unique. So the "unique" statement is rejected.

I can workaround the problem entirely by creating the table manually as
follows and then restart tomcat. CREATE TABLE gf_layer_attributes
  (
    details_id NUMBER(19,0) NOT NULL,
    access_type VARCHAR2(255 CHAR),
    data_type VARCHAR2(255 CHAR),
    name VARCHAR2(255 CHAR) NOT NULL,
    PRIMARY KEY(details_id, name)
  );

Walter

--

GeoServer Professional Services from the experts!
Visit http://goo.gl/NWWaa2 for more information.

Ing. Emanuele Tajariol
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 380 2116282

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------