hibernate - spring-boot is not creating hsqldb database -
hibernate - spring-boot is not creating hsqldb database -
in current spring project, start utilize spring-boot spring-jpa create , manage hsqldb database.
i have hibernate.properties
in thee folder src/main/resources
project:
# jdbc.x jdbc.driverclassname=org.hsqldb.jdbc.jdbcdriver jdbc.url=jdbc:hsqldb:file:/home/kleber/.webapp/testedb jdbc.user=sa jdbc.pass= # hibernate.x hibernate.dialect=org.hibernate.dialect.hsqldialect hibernate.show_sql=false hibernate.hbm2ddl.auto=create
my pom.xml have dependencies:
<dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-actuator</artifactid> </dependency> <dependency> <groupid>org.apache.tomcat.embed</groupid> <artifactid>tomcat-embed-jasper</artifactid> <scope>provided</scope> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-data-jpa</artifactid> </dependency> <dependency> <groupid>org.hsqldb</groupid> <artifactid>hsqldb</artifactid> </dependency> <dependency> <groupid>jstl</groupid> <artifactid>jstl</artifactid> <version>1.2</version> </dependency> </dependencies>
my main class that:
@controller @enablejparepositories @enableautoconfiguration public class application { public static void main(string[] args) throws exception { springapplication.run(application.class, args); } @requestmapping(value = "/signin") public string signin(model model) { homecoming "acesso/signin"; } @requestmapping(value = "/admin") public string admin(model model) { homecoming "private/admin"; } @requestmapping(value = "/") public string index(model model) { homecoming "public/index"; } }
when run application, can see in console:
2014-10-30 17:58:51.708 info 31413 --- [ main] org.hibernate.version : hhh000412: hibernate core {4.3.6.final} 2014-10-30 17:58:51.713 info 31413 --- [ main] org.hibernate.cfg.environment : hhh000205: loaded properties resource hibernate.properties: {jdbc.url=jdbc:hsqldb:file:/home/kleber/.webapp/testedb, hibernate.dialect=org.hibernate.dialect.hsqldialect, hibernate.show_sql=false, jdbc.user=sa, hibernate.bytecode.use_reflection_optimizer=false, hibernate.hbm2ddl.auto=create, jdbc.driverclassname=org.hsqldb.jdbc.jdbcdriver, jdbc.pass=} 2014-10-30 17:58:51.714 info 31413 --- [ main] org.hibernate.cfg.environment : hhh000021: bytecode provider name : javassist 2014-10-30 17:58:52.089 info 31413 --- [ main] o.hibernate.annotations.common.version : hcann000001: hibernate commons annotations {4.0.5.final} 2014-10-30 17:58:52.191 info 31413 --- [ main] org.hibernate.dialect.dialect : hhh000400: using dialect: org.hibernate.dialect.hsqldialect 2014-10-30 17:58:52.385 info 31413 --- [ main] o.h.h.i.ast.astquerytranslatorfactory : hhh000397: using astquerytranslatorfactory 2014-10-30 17:58:52.838 info 31413 --- [ main] org.hibernate.tool.hbm2ddl.schemaexport : hhh000227: running hbm2ddl schema export 2014-10-30 17:58:52.845 info 31413 --- [ main] org.hibernate.tool.hbm2ddl.schemaexport : hhh000230: schema export finish
but no database created in path defined property jdbc.url
.
anyone can tell me doing wrong?
you'd improve using spring boot manage configuration. pass hibernate configuration hibernate while auto-creating datasource , database you.
i move of configuration src/main/resources/application.properties
:
# datasource spring.datasource.url=jdbc:hsqldb:file:/home/kleber/.webapp/testedb spring.datasource.username=sa # hibernate spring.jpa.show-sql=false spring.jpa.hibernate.ddl-auto=create
i've removed unnecessary configuration. example, configuration of driverclassname
spring boot infer url , empty datasource password that's default. can see documentation of configuration properties , default values here.
spring hibernate spring-mvc spring-boot spring-jpa
Comments
Post a Comment