I've setup my hibernate app to use the following properties:
spring.datasource.url: jdbc:postgresql://localhost:5432/users
spring.datasource.username=james
spring.datasource.password=root
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=create-drop
#spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.naming_strategy: org.hibernate.cfg.ImprovedNamingStrategy
#spring.jpa.database: MySql
spring.jpa.database = postgresql
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
I've also created a postgres database users, but when I run my application, it throws all these unsuccessful alter table errors?!
Hibernate: drop table if exists user cascade
2016-06-23 10:46:05.406 ERROR 3364 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: drop table if exists user cascade
2016-06-23 10:46:05.407 ERROR 3364 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : ERROR: syntax error at or near "user"
Position: 22
Hibernate: alter table user_credential drop constraint FK_14ncv1m0gqncrbiagrs4uaqo8
2016-06-23 10:36:36.199 ERROR 3235 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_credential drop constraint FK_14ncv1m0gqncrbiagrs4uaqo8
2016-06-23 10:36:36.199 ERROR 3235 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : ERROR: relation "user_credential" does not exist
Hibernate: alter table user_roles drop constraint FK_5q4rc4fh1on6567qk69uesvyf
2016-06-23 10:36:36.200 ERROR 3235 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_roles drop constraint FK_5q4rc4fh1on6567qk69uesvyf
2016-06-23 10:36:36.200 ERROR 3235 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : ERROR: relation "user_roles" does not exist
Hibernate: alter table user_roles drop constraint FK_g1uebn6mqk9qiaw45vnacmyo2
2016-06-23 10:36:36.200 ERROR 3235 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_roles drop constraint FK_g1uebn6mqk9qiaw45vnacmyo2
2016-06-23 10:36:36.200 ERROR 3235 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : ERROR: relation "user_roles" does not exist
Everything works fine on mysql, it creates the tables without any dramas, I was using the following properties with mysql:
#spring.datasource.url: jdbc:mysql://localhost/users
#spring.datasource.username=root
#spring.datasource.password=root
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#spring.jpa.hibernate.ddl-auto=create-drop
##spring.jpa.hibernate.ddl-auto=update
#spring.jpa.hibernate.naming_strategy: org.hibernate.cfg.ImprovedNamingStrategy
#spring.jpa.database: MySql
#spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
##spring.jpa.database-platform=org.hibernate.spatial.dialect.mysql.MySQLSpatialDialect
Could it be because I'm using a Point data type from vividsolutions?
import com.vividsolutions.jts.geom.Point;
@Column(name = "coords", columnDefinition="Geometry", nullable = true)
private Point location;
Do I have todo anything else to allow hibernate to use postgres? I've setup postgis on my postgres server as well.
I removed the Point declaration, and it still throws the same errors...So that's not the problem.