I am using a Spring MVC server and i need to drop the database.
I use this configuration on application.properties:
spring.datasource.url=jdbc:h2:~/test;AUTO_SERVER=TRUE
spring.datasource.driverClassName=org.h2.Driver
spring.jpa.show-sql: true
spring.jpa.hibernate.ddl-auto=create-drop
And I ensure that it is used typing that in the Application's annotation:
#PropertySource("application.properties")
But the tables are not dropped, just they are loaded normally:
2014-11-18 13:30:28.231 INFO 7472 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2014-11-18 13:30:28.250 INFO 7472 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2014-11-18 13:30:28.306 INFO 7472 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {4.3.1.Final}
2014-11-18 13:30:28.307 INFO 7472 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2014-11-18 13:30:28.308 INFO 7472 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2014-11-18 13:30:28.471 INFO 7472 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
2014-11-18 13:30:32.894 INFO 7472 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2014-11-18 13:30:33.010 INFO 7472 --- [ main] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2014-11-18 13:30:33.280 INFO 7472 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2014-11-18 13:30:33.280 INFO 7472 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000102: Fetching database metadata
2014-11-18 13:30:33.281 INFO 7472 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000396: Updating schema
2014-11-18 13:30:33.289 INFO 7472 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000261: Table found: TEST.PUBLIC.CLIENTE
2014-11-18 13:30:33.289 INFO 7472 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000037: Columns: [creation_date, id, complete_name, logginname, loggin_name]
2014-11-18 13:30:33.289 INFO 7472 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000108: Foreign keys: []
2014-11-18 13:30:33.289 INFO 7472 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000126: Indexes: [primary_key_9]
etc...
I need to force for deleting the database.
You should try setting spring.jpa.hibernate.hbm2ddl.auto=create-drop as per this question.
Also note you need to set the generateDdl to false, due to https://jira.spring.io/browse/SPR-6836 .
Related
I am learning spring boot by working on a spring project and attempting to use h2 as an embedded database. Below are the details:
Project Structure:
application.properties file contain:
logging.level.springframework.jdbc.datasource.init.ScriptUtils=debug
spring.jpa.hibernate.ddl-auto=none
The problem is spring boot doesn't show logs for queries inside schema.sql and data.sql.
Logs for reference:
INFO 19121 --- [ main] c.v.l.l.LearningSpringApplication : No active profile set, falling back to default profiles: default
INFO 19121 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
INFO 19121 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 10 ms. Found 0 JPA repository interfaces.
INFO 19121 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
INFO 19121 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
INFO 19121 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.54]
INFO 19121 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
INFO 19121 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1534 ms
INFO 19121 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
INFO 19121 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
INFO 19121 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
INFO 19121 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.32.Final
INFO 19121 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
INFO 19121 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
INFO 19121 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
INFO 19121 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
WARN 19121 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
INFO 19121 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]
INFO 19121 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
INFO 19121 --- [ main] c.v.l.l.LearningSpringApplication : Started LearningSpringApplication in 3.858 seconds (JVM running for 4.364)
If you use h2 inmemory db with spring-data-jpa, you can see all query in console when hibernate use query to db.
You can see query by add spring.jpa.properties.hibernate.show_sql=true in application.properties.
I use schema.sql and data.sql at developing step, but I need to release a version to the server, so I modify the ddl-auto=none to ddl-auto=update, But after I re-execute, schema.sql and data.sql are still executed, why?
there's my config:
server:
port: 8081
spring:
jpa:
hibernate:
ddl-auto: update
show-sql: true
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
profiles:
active: prod
and here is my log:
2020-05-26 12:57:49.412 INFO 3642 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executing SQL script from URL [file:/Users/shawnwu4mac/IdeaProjects/UTM-system-LSTM/target/classes/schema.sql]
2020-05-26 12:57:52.587 INFO 3642 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executed SQL script from URL [file:/Users/shawnwu4mac/IdeaProjects/UTM-system-LSTM/target/classes/schema.sql] in 3175 ms.
2020-05-26 12:57:52.592 INFO 3642 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executing SQL script from URL [file:/Users/shawnwu4mac/IdeaProjects/UTM-system-LSTM/target/classes/data.sql]
2020-05-26 12:57:53.785 INFO 3642 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executed SQL script from URL [file:/Users/shawnwu4mac/IdeaProjects/UTM-system-LSTM/target/classes/data.sql] in 1193 ms.
2020-05-26 12:57:53.962 INFO 3642 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2020-05-26 12:57:53.972 INFO 3642 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2020-05-26 12:57:54.028 INFO 3642 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2020-05-26 12:57:54.029 INFO 3642 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2020-05-26 12:57:54.030 INFO 3642 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2020-05-26 12:57:54.060 INFO 3642 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2020-05-26 12:57:54.137 INFO 3642 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
2020-05-26 12:57:54.527 INFO 3642 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2020-05-26 12:58:00.756 INFO 3642 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
you must also add below property for your yml. it works well for me.
spring:
jpa:
generate-ddl: true
These are the current dependencies included in my web application.
dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-data-rest")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-web-services")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.google.firebase:firebase-admin:6.10.0")
}
Every time I run the application I get the following error:
2019-09-30 13:32:38.385 INFO 17104 --- [ restartedMain] unito.taas.project.ProjectApplicationKt : Starting ProjectApplicationKt on LAPTOP-K1DHEJQ6 with PID 17104 (C:\Users\beppe\Desktop\project\TAAS_project\project\build\classes\kotlin\main started by beppe in C:\Users\beppe\Desktop\project\TAAS_project)
2019-09-30 13:32:38.388 INFO 17104 --- [ restartedMain] unito.taas.project.ProjectApplicationKt : No active profile set, falling back to default profiles: default
2019-09-30 13:32:38.444 INFO 17104 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2019-09-30 13:32:39.177 INFO 17104 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-09-30 13:32:39.263 INFO 17104 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 77ms. Found 3 repository interfaces.
2019-09-30 13:32:39.785 INFO 17104 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-09-30 13:32:39.976 INFO 17104 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2019-09-30 13:32:40.045 INFO 17104 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-09-30 13:32:40.127 INFO 17104 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.3.11.Final}
2019-09-30 13:32:40.128 INFO 17104 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-09-30 13:32:40.317 INFO 17104 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2019-09-30 13:32:40.734 INFO 17104 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2019-09-30 13:32:41.419 INFO 17104 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-09-30 13:32:41.439 INFO 17104 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2019-09-30 13:32:43.049 INFO 17104 --- [ restartedMain] unito.taas.project.ProjectApplicationKt : Started ProjectApplicationKt in 5.053 seconds (JVM running for 5.806)
2019-09-30 13:32:43.063 INFO 17104 --- [ Thread-9] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2019-09-30 13:32:43.068 INFO 17104 --- [ Thread-9] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2019-09-30 13:32:43.073 INFO 17104 --- [ Thread-9] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
How can I avoid the application closing?
EDIT:
The following is my SpringBoot annotated class
package unito.taas.project
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
#SpringBootApplication
class ProjectApplication
fun main(args: Array<String>) {
runApplication<ProjectApplication>(*args)
}
I'm trying to run my Spring Boot in local profile with bootstrap-local.properties but It seems not working.
In src/main/resourses I have 2 file: bootstrap.properties and bootstrap-local.properties.
bootstrap.properties
#Application Name
spring.application.name=configserver
#Server port
server.port=8888
# Github URL to connect remote Repository
spring.cloud.config.server.git.uri=https://github.com/TranNgocKhoa/config-respo
# Search path in the remote Repository
spring.cloud.config.server.git.search-paths=config-files*
bootstrap-local.properties
#Application Name
spring.application.name=configserver
#Server port
server.port=8888
# Github URL to connect remote Repository
spring.cloud.config.server.native.search-locations=classpath:/config-respo/config-files
But when I run it with local profile:
2019-03-22 11:20:14.398 INFO 11676 --- [ main] c.h.c.HellodoctorConfigserverApplication : The following profiles are active: local
2019-03-22 11:20:15.185 INFO 11676 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=ce04fc74-ea60-3e26-a1e0-957e7be20901
2019-03-22 11:20:15.210 INFO 11676 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$74797a93] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-22 11:20:15.489 INFO 11676 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8888 (http)
2019-03-22 11:20:15.514 INFO 11676 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-03-22 11:20:15.514 INFO 11676 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.16]
2019-03-22 11:20:15.523 INFO 11676 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_201\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Java\jdk1.8.0_201\bin;C:\Program Files\PowerShell\6-preview\preview;C:\Program Files (x86)\VietPN;C:\Program Files\nodejs\;C:\Program Files\apache-maven-3.6.0\bin;C:\Program Files\Git\cmd;C:\Users\khoa1\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\khoa1\AppData\Local\Programs\Python\Python37\;C:\Users\khoa1\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\JetBrains\IntelliJ IDEA 2018.3.3\bin;;C:\Users\khoa1\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\khoa1\AppData\Roaming\npm;.]
2019-03-22 11:20:15.631 INFO 11676 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-03-22 11:20:15.631 INFO 11676 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1222 ms
2019-03-22 11:20:17.030 INFO 11676 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-03-22 11:20:18.049 INFO 11676 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2019-03-22 11:20:18.159 INFO 11676 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8888 (http) with context path ''
2019-03-22 11:20:18.162 INFO 11676 --- [ main] c.h.c.HellodoctorConfigserverApplication : Started HellodoctorConfigserverApplication in 7.492 seconds (JVM running for 9.255)
2019-03-22 11:20:19.073 INFO 11676 --- [on(1)-10.0.75.1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-03-22 11:20:19.073 INFO 11676 --- [on(1)-10.0.75.1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2019-03-22 11:20:19.082 INFO 11676 --- [on(1)-10.0.75.1] o.s.web.servlet.DispatcherServlet : Completed initialization in 9 ms
When I request to get a configuration, I get a config data that corresponding with when I run in default profile:
http://localhost:8888/hellodoctor-test-service/local
"name": "hellodoctor-test-service",
"profiles": [
"local"
],
"label": null,
"version": "826b53db8aa62950cc42030ba19da8c1a39d3bc7",
"state": null,
"propertySources": [
{
"name": "https://github.com/TranNgocKhoa/config-respo/config-files/hellodoctor-test-service.yml",
"source": {
"spring.zipkin.baseUrl": "http://tracing-server:9411",
"spring.application.name": "hellodoctor-test-service",
"server.port": 8082,
"eureka.client.serviceUrl.defaultZone": "http://${DNS_DISCOVERY_SERVER}:8761/eureka/"
}
}
]
}
You can see that in config data: name": "https://github.com/TranNgocKhoa/config-respo/config-files/hellodoctor-test-service.yml
I'd like to get from local repository.
How can I fix it?
Thank you.
I have created a spring application with MySql db connected and I want the hibernate to create tables using Innodb engine but it always creates the table using MyISAM engine.
the application.properties file:
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/spring?autoReconnect=true&useSSL=false
spring.datasource.username=root
spring.datasource.password=
The hibernate.properties file:
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
hibernate.dialect.storage_engine=innodb
The console output:
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.3.RELEASE)
2017-12-18 13:54:19.460 INFO 9144 --- [ main] hello.Application : Starting Application on webc13 with PID 9144 (C:\spring\gs-rest-service\complete\build\classes\main started by Arielb in C:\spring\gs-rest-service\complete)
2017-12-18 13:54:19.465 INFO 9144 --- [ main] hello.Application : No active profile set, falling back to default profiles: default
2017-12-18 13:54:19.506 INFO 9144 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#44a3ec6b: startup date [Mon Dec 18 13:54:19 IST 2017]; root of context hierarchy
2017-12-18 13:54:20.802 WARN 9144 --- [ main] o.h.v.m.ParameterMessageInterpolator : HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported
2017-12-18 13:54:21.102 WARN 9144 --- [ main] o.h.v.m.ParameterMessageInterpolator : HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported
2017-12-18 13:54:21.371 INFO 9144 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-12-18 13:54:21.380 INFO 9144 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2017-12-18 13:54:21.381 INFO 9144 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.14
2017-12-18 13:54:21.517 INFO 9144 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-12-18 13:54:21.518 INFO 9144 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2014 ms
2017-12-18 13:54:21.634 INFO 9144 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-12-18 13:54:21.638 INFO 9144 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-12-18 13:54:21.639 INFO 9144 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-12-18 13:54:21.639 INFO 9144 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-12-18 13:54:21.639 INFO 9144 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-12-18 13:54:22.051 INFO 9144 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-12-18 13:54:22.060 INFO 9144 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2017-12-18 13:54:22.114 INFO 9144 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2017-12-18 13:54:22.116 INFO 9144 --- [ main] org.hibernate.cfg.Environment : HHH000205: Loaded properties from resource hibernate.properties: {hibernate.dialect=org.hibernate.dialect.MySQLMyISAMDialect, spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLMyISAMDialect, hibernate.bytecode.use_reflection_optimizer=false, hibernate.dialect.storage_engine=myisam}
2017-12-18 13:54:22.117 INFO 9144 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2017-12-18 13:54:22.151 INFO 9144 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-12-18 13:54:22.236 INFO 9144 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2017-12-18 13:54:22.527 INFO 9144 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2017-12-18 13:54:22.555 INFO 9144 --- [ main] rmationExtractorJdbcDatabaseMetaDataImpl : HHH000262: Table not found: logs
2017-12-18 13:54:22.555 INFO 9144 --- [ main] rmationExtractorJdbcDatabaseMetaDataImpl : HHH000262: Table not found: logs
2017-12-18 13:54:22.741 INFO 9144 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-12-18 13:54:23.178 INFO 9144 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#44a3ec6b: startup date [Mon Dec 18 13:54:19 IST 2017]; root of context hierarchy
2017-12-18 13:54:23.231 INFO 9144 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/dd/one/{id}],methods=[GET]}" onto public hello.Files hello.controller.InspectorController.getFile(java.lang.Integer)
2017-12-18 13:54:23.232 INFO 9144 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/dd/all],methods=[GET]}" onto public java.lang.Iterable<hello.Files> hello.controller.InspectorController.getAllUsers()
2017-12-18 13:54:23.232 INFO 9144 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/dd/insert],methods=[POST]}" onto public hello.Files hello.controller.InspectorController.saveFiles(java.lang.String,java.util.Date,java.lang.String,java.lang.String,javax.servlet.http.HttpServletRequest) throws javassist.tools.web.BadHttpRequest
2017-12-18 13:54:23.232 INFO 9144 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/greeting]}" onto public hello.Greeting hello.GreetingController.greeting(java.lang.String)
2017-12-18 13:54:23.234 INFO 9144 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-12-18 13:54:23.234 INFO 9144 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-12-18 13:54:23.259 INFO 9144 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-12-18 13:54:23.259 INFO 9144 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-12-18 13:54:23.287 INFO 9144 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-12-18 13:54:23.459 INFO 9144 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2017-12-18 13:54:23.504 INFO 9144 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-12-18 13:54:23.508 INFO 9144 --- [ main] hello.Application : Started Application in 4.291 seconds (JVM running for 4.77)
Any idea?
Edit
finally, the only way I managed to reach the desired engine was to set the my.conf file:
default-storage-engine=InnoDB
According to this post, the MySQL5InnoDBDialect has been deprecated, the class to use is MySQL5Dialect.
So you need to change the dialect :
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.dialect.storage_engine=innodb
If it doesn't work, try using the spring jpa properties :
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
change your hibernate.properties file to
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.dialect.storage_engine=innodb
and then try it. MySQL5InnoDBDialect is deprecated .
spring.jpa.database-platform: org.hibernate.dialect.MySQL57InnoDBDialect work for me, but MySQL57InnoDBDialect was marked as deprecated.
It suggested that using hibernate.dialect.storage_engine=innodb but it is not working for me.
So I keep MySQL57InnoDBDialect.