Hibernate wrong column type 'geometry': Hibernate-Spatial + Multitenancy #40138
Replies: 3 comments 7 replies
-
So, first, you should remove this: quarkus.hibernate-orm.dialect=org.hibernate.dialect.PostgreSQLDialect It's not useful in your case, and can be harmful. See https://quarkus.io/guides/hibernate-orm#hibernate-dialect-supported-databases Now regarding your problem... I see your default schema is not quarkus.hibernate-orm.database.default-schema=spatial-test Which I'd expect not to work, since you say the postgis extension is installed only in the But... the error mentions a Regardless, there maybe one, or even two bugs here. Can you please provide a reproducer? |
Beta Was this translation helpful? Give feedback.
-
This is actually expected, I think. You need to make sure the extension can be found and for that, you either need to install it in the schema or you need to make the schema visible by adjusting the See this SO answer for more information: https://stackoverflow.com/questions/12986368/installing-postgresql-extension-to-all-schemas |
Beta Was this translation helpful? Give feedback.
-
I'm trying to run a Quarkus application with Postgis, Hibernate and Multitenancy. Without Multitenancy it's working fine, but as soon as I activate Multitenancy, Hibernate complains about the geometry column-type and I can't figure out why. This is a simplified version of my application:
application.properties (setup postgis database and let hibernate generate tables)
MyEntity.java (Simple entity with a Geolatte geometry. (No difference with JTS geometry))
When I start the application, everything is working fine. But as soon, as I use
quarkus.hibernate-orm.multitenant=SCHEMA
in my application.properties and provide a TenantResolver, hibernate complains about the geometry-datatype.:Schema-validation: wrong column type encountered in column [geometry] in table [MyEntity]; found ["public"."geometry" (Types#OTHER)], but expecting [geometry (Types#GEOMETRY)]
(The postgis extension comes with the postgis devservice image and installs the extension in my public-schema.)
Overview of schemas (left-side) and postgis extension (which is automatically installed for the public schema)
![image](https://private-user-images.githubusercontent.com/115630036/323600997-84874fc1-1a6a-419b-94c4-c4e50670c4d6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg4MjY3MDksIm5iZiI6MTcxODgyNjQwOSwicGF0aCI6Ii8xMTU2MzAwMzYvMzIzNjAwOTk3LTg0ODc0ZmMxLTFhNmEtNDE5Yi05NGM0LWM0ZTUwNjcwYzRkNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjE5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYxOVQxOTQ2NDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02OGE3MmZhNDdmZDhlNzc5MmYyMTNkMWUxMDRiYTk0YTU1NTNkNGQ1NzVkNGVjOWNmYmRmNzlkZjA1MTMyNDZkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.hLylOPiQh8PMbnVPOmawbU9X-1fttBunStUpvRkA5AM)
MyTenantResolver.java (Decides dynamically, what schema to use. Dummy version)
Exception, thrown when multitenancy is activated:
I'm using:
Does anyone know what I'm doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions