On GeoFence startup, it states that it could not find relation geofence.gf_gfuser.
My schema name is geofence.
I am using SQL views instead of tables. This post states that Hibernate will not have a problem reading from views. So why does this error occur?
Any insight would be appreciated.
Stacktrace:
Caused by: org.postgresql.util.PSQLException: ERROR: relation "geofence.gf_gfuser" does not exist
Additional config
geofence-datasource-ovr.properties
geofenceVendorAdapter.databasePlatform=org.hibernatespatial.postgis.PostgisDialect
geofenceDataSource.driverClassName=org.postgresql.Driver
geofenceDataSource.url=jdbc:postgresql://<host>:<port>/<db>
geofenceDataSource.username=<username>
geofenceDataSource.password=<password>
geofenceEntityManagerFactory.jpaPropertyMap[hibernate.default_schema]=<schema>
geofenceEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=none
geofenceEntityManagerFactory.jpaPropertyMap[javax.persistence.validation.mode]=none
geofenceEntityManagerFactory.jpaPropertyMap[hibernate.validator.apply_to_ddl]=false
geofenceEntityManagerFactory.jpaPropertyMap[hibernate.validator.autoregister_listeners]=false
I ended up using the Foreign Data Wrapper PostgreSQL plugin to connect to the views.
Since the FDW connects to a database and references a table/view and creates a foreign table, linking GeoFence to those tables instead of the views fooled it into using the tables.
Note: My foreign tables and views are in seperate schemas, but in the same database.
Related
Is there a way to Skip Foreign Constraint check in Spring JPA.
In SQL ALTER TABLE TableName NOCHECK CONSTRAINT ForeignKeyName. How to achieve this programmatically using Spring JPA
I am working on a Sync tool using SpringBoot, Spring data JPA which copies data from one DB to Other and using Spring JPA, the tables in the schema have two many foreign key constraints and adding the mappings in all the entity classes is proving to be cumbersome. Any suggestion around skipping the constraint check and in general for the approach is appreciated.
I understand the consequence of data integrity, by removing the constraint check.
There is no special JPA way to do this, but you can simply use SQL.
Depending on if you want to do the change just for the sync process or always you'd put the statement either in the creation scripts of the database or you execute it using EntityManager.createNativeQueryenter
I am evaluating a Laravel/PHP component meant to manage tree data in a SQL database using the "closure Table" design pattern. Code repository: https://github.com/franzose/ClosureTable
Oh my, this component gives me endless headaches. After some installation hickups (Lifetime cost: 2 days ...) I got one little step forward, and ran into what seems to be a really serious compatibility problem with the Microsoft SQL server. When the database ist created through the migration provided by the component, I get the following fatal SQL error:
[Illuminate\Database\QueryException]
SQLSTATE[42000]: [Microsoft][ODBC Driver 11 for SQL Server][SQL
Server]Introducing FOREIGN KEY constraint 'pages_parent_id_foreign' on
table 'pages' may cause cycles or multiple cascade paths. Specify ON
DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY
constraints. (SQL: alter table "pages" add constraint
"pages_parent_id_foreign" foreign key ("parent_id") references "pages"
("id") on delete set null)
A similar problem has been described here:
Foreign key constraint may cause cycles or multiple cascade paths?
Anyone having an idea how I can fix this, without breaking the component?
Thnx, Armin.
P.S. I also filed an issue hoping to get teh developer's attraction: Link to Git issue
I am just trying to build a simple crud application using cakephp and oracle. But when i am trying to add a new data from my add.ctp its return with this error. can anyone help. Errors are below.
ORA-01400: cannot insert NULL into ("HR"."EMP"."EMP_ID")
CakeDC\OracleDriver\Database\OCI8\OCI8Exception
BTW here 'EMP_ID' is primary key of 'EMP' table and i have also created sequence.
You should try to create all tables strctures using cakephp migrations.
The reason of that - datasource when create table dditionally create not only sequence, but also a triger, to fill id field. Also driver written in way to follow cakephp table field naming conventions. So you can just take EMP schema and get everything work.
Options are: create all tables using migrations from cakephp side, or write trigger that will fill id fields manual on oracle side.
We have a legacy app that I am rewriting in .net. All of our databases are oracle and make use of database links. Is there any way for Entity Framework 6 to generate models based on tables located on a different database?
Currently the legacy app gets data from table like this
SELECT * FROM emp#foo2;
where its db connection is to database foo that has a database link to the database foo2.
I would like to reproduce this using EF6. So far all I have found regarding this is this question.
You can do two things that EF 4 or higher will work with:
CREATE VIEW EMP as SELECT * FROM emp#foo2;
CREATE MATERIALIZED VIEW EMP as SELECT * FROM emp#foo2;
LOBS are not accessible across a database link without some contorted PL/SQL processing to read the LOB piece by piece.
I believe fast refresh does not work across database links so you must consider the size of the table on the linked database. If you are refreshing a million rows you may find the time to do this is an issue. Most large tables are full of tombstone data that never changes so a timestamp column with the last modified date could help you create a package that only picks out the changed data.
If you are doing complicated joins for either ensure that Oracle considers the column that would be the primary key as not null.
You can add a primary key on views and materialized view but it must be disabled. See here for details.
I am working with Hibernate 4 and Spring 3.5 , so I want to do a delete operation in a table or entity, but a table has referential integrity with other tables. I want to know how I can know if a table has referential integrity, thus I can delete the record or not.
If there is a constraint and you are not aware and you try to delete a record that has a dependency to the other tables. You might get a ConstraintViolation Exception.
http://docs.oracle.com/javaee/6/api/javax/validation/ConstraintViolationException.html
Anyhow, I suggest you to look at table relationships (in the database) and make sure there is no PK/FK relationship before deleting any record.
Also if you are using JPA entities, you might have relationships in the JPA level (#OneToOne, #OneToMany, ...)