hibernate - Spring Boot Jpa and Jdbc configuration not working as expected -


i'm working on spring-boot application needs create brand new database , information another, think need configurate two datasources.

after few intents create wanna , having no success here questions , code have created far, please guide me if i'm wrong on configuration.

first question, despite new database gonna use jpa, , existing jdbctemplate, config file still same both right? here config class file:

dbconfig.java

@configuration public class dbconfig {  @bean(name="bitacoradb") @primary @configurationproperties("bitacora.datasource") public datasourceproperties bitacoradatasourceproperties() {     return new datasourceproperties(); }  @bean @primary @configurationproperties("bitacora.datasource") public datasource bitacoradatasource() {     return bitacoradatasourceproperties().initializedatasourcebuilder().build(); }  @bean(name="siadb") @configurationproperties("sia.datasource") public datasource siadatasource() {      return datasourcebuilder.create().build(); }  @bean(name="siajdbctemplate") public jdbctemplate jdbctemplate(@qualifier("siadb") datasource datasource) {      jdbctemplate jdbctemplate = new jdbctemplate(datasource);      jdbctemplate.setresultsmapcaseinsensitive(true);      return jdbctemplate; } } 

then, application.properties, here don't know if hibernate properties working correctly:

bitacora.datasource.url=jdbc:postgresql://192.168.1.202:5432/bitacorapp bitacora.datasource.driverclassname=org.postgresql.driver bitacora.datasource.username=argos_admin bitacora.datasource.password=argos@27467 bitacora.jpa.hibernate.show_sql=true bitacora.jpa.hibernate.format_sql=true bitacora.jpa.hibernate.hbm2ddl.import_files_sql_extractor=org.hibernate.tool.hbm2ddl.multiplelinessqlcommandextractor bitacora.jpa.hibernate.dialect=org.hibernate.dialect.postgresql92dialect bitacora.jpa.hibernate.ddl-auto=create-drop  # -------------------- # second datasource # -------------------- sia.datasource.url=jdbc:postgresql://192.168.1.202:5432/argosrr-serv sia.datasource.driverclassname=org.postgresql.driver sia.datasource.username=argos_admin sia.datasource.password=argos@27467 

the thing new database created in second datasource don't want to, controllers , repositories works expected, need separate databases. don't know if after solve problem lead others because bad configuration.

thanks help.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -