0

How to generate table in the Postgres database for the entity below? I'm using maven build.

Entity:

@Entity
@Table(name = "EMPLOYEE")
public class Employee {
   @Id @GeneratedValue
   @Column(name = "id")
   private int id;
}    

properties:

spring.jpa.properties.hibernate.cache.use_second_level_cache=true
spring.jpa.properties.hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory         
spring.datasource.url=jdbc:postgresql://localhost:5433/con_db        
spring.datasource.username=postgres
spring.datasource.password=root        
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.default_schema=as2
spring.jpa.hibernate.naming.physical-strategy=com.ds.entity.strategy.EntityNamingStrategy
spring.jpa.hibernate.ddl-auto=update
spring.jpa.generate-ddl=true                
spring.jpa.show-sql=true        
spring.h2.console.enabled=true          
logging.level.org.hibernate.SQL=DEBUG  
logging.level.org.hibernate.type=TRACE
4
  • please mention the error that you got Commented Mar 12, 2022 at 8:45
  • my maven build is success , but the issue is after maven build when i open postgres DB tables are not generated Commented Mar 12, 2022 at 8:51
  • 2
    you have to run the spring boot app to build your database structure in the postgres database, there is no relation of maven with that Commented Mar 12, 2022 at 13:05
  • @Spartan thanks much, i was new to java so confused on build and start of application. thanks am able to create tables after running the application. Commented Mar 13, 2022 at 7:47

2 Answers 2

1

Try to use hibernate default_schema to public instead of as2 like this: spring.jpa.properties.hibernate.default_schema=public then run your project.

Sign up to request clarification or add additional context in comments.

Comments

0

you have to run the spring boot app to build your database structure in the postgres database, there is no relation of maven with that. Thanks @Spartan for your help here.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.