I'm currently working on a web app project using java Play 2.3.2 framwork and spring data jpa using postgresql database. I've installed the play sample from activator called play-spring-data-jpa and can be found here:
play-spring-data-jpa
The problem I'm facing is to auto generate the table, this feature for some reason is not working displaying the following Error:
[error] o.h.t.h.SchemaUpdate - Unsuccessful: create table public.Person (id bigint generated by default as identity, firstname varchar(255), surname varchar(255), primary key (id))
[error] o.h.t.h.SchemaUpdate - ERROR: syntax error at or near "generated"
Position: 39
[info] play - Application started (Dev)
[error] o.h.u.JDBCExceptionReporter - ERROR: relation "public.person" does not exist
Position: 13
[error] play - Cannot invoke the action, eventually got an error: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not insert:[models.Person]
[error] application -
my persistance.xml:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>DefaultDS</non-jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
my application.conf:
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://localhost:5432/MyTest"
db.default.user=postgres
db.default.password="2580"
db.default.jndiName=DefaultDS
applyEvolutions.default=true
When I create the table my self everything goes normal. I dont want to recreate the table my self each time I delete it.
Update: Removing Generated has solved the issue. However, id has to be manually inserted! How can I auto generate an id?
2nd update: problem was solved with the help of this stackoverflow link