java - HibernateException when trying to access embedded Derby db -


i have deployed embedded derby database intellij in project enter image description here

i want access spring application, create hibernate config

@configuration @enabletransactionmanagement public class hibernateconfig {      @autowired     @bean     public sessionfactory getsessionfactory(final datasource datasource) {         final localsessionfactorybuilder sessionbuilder = new localsessionfactorybuilder(datasource);         sessionbuilder.scanpackages("com.em.daas.entity");         return sessionbuilder.buildsessionfactory();     } } 

wher com.em.daas location of entity classes, , datasource config:

@configuration @propertysource(testapplication.properties_path) public class localdatasourceconfig {      @bean     public drivermanagerdatasource derbydatasource() {         final drivermanagerdatasource datasource = new drivermanagerdatasource();         datasource.setdriverclassname("org.apache.derby.jdbc.embeddeddriver");         datasource.seturl("jdbc:derby:c:/users/timofb/documents/diploma/daas/src/test/resources/db/metadatastorage");         datasource.setusername("");         datasource.setpassword("123");         return datasource;     } } 

and add application.properties

spring.jpa.database-platform=org.hibernate.dialect.derbydialect spring.jpa.show-sql=false spring.jpa.hibernate.ddl-auto=create 

(changing derbytenfivedialect, derbytensixdialect , derbytensevendialect doesn't help) exception:

caused by: org.hibernate.service.spi.serviceexception: unable create requested service [org.hibernate.engine.jdbc.env.spi.jdbcenvironment] @ org.hibernate.service.internal.abstractserviceregistryimpl.createservice(abstractserviceregistryimpl.java:244) @ org.hibernate.service.internal.abstractserviceregistryimpl.initializeservice(abstractserviceregistryimpl.java:208) @ org.hibernate.service.internal.abstractserviceregistryimpl.getservice(abstractserviceregistryimpl.java:189) @ org.hibernate.engine.jdbc.internal.jdbcservicesimpl.configure(jdbcservicesimpl.java:51) @ org.hibernate.boot.registry.internal.standardserviceregistryimpl.configureservice(standardserviceregistryimpl.java:94) @ org.hibernate.service.internal.abstractserviceregistryimpl.initializeservice(abstractserviceregistryimpl.java:217) @ org.hibernate.service.internal.abstractserviceregistryimpl.getservice(abstractserviceregistryimpl.java:189) @ org.hibernate.boot.model.process.spi.metadatabuildingprocess.handletypes(metadatabuildingprocess.java:352) @ org.hibernate.boot.model.process.spi.metadatabuildingprocess.complete(metadatabuildingprocess.java:111) @ org.hibernate.boot.model.process.spi.metadatabuildingprocess.build(metadatabuildingprocess.java:83) @ org.hibernate.boot.internal.metadatabuilderimpl.build(metadatabuilderimpl.java:418) @ org.hibernate.boot.internal.metadatabuilderimpl.build(metadatabuilderimpl.java:87) @ org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:692) @ org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:724) @ org.springframework.orm.hibernate4.localsessionfactorybuilder.buildsessionfactory(localsessionfactorybuilder.java:372) @ com.emc.daas.config.hibernateconfig.getsessionfactory(hibernateconfig.java:24) @ com.emc.daas.config.hibernateconfig$$enhancerbyspringcglib$$f623976c.cglib$getsessionfactory$0(<generated>) @ com.emc.daas.config.hibernateconfig$$enhancerbyspringcglib$$f623976c$$fastclassbyspringcglib$$8ece3a4e.invoke(<generated>) @ org.springframework.cglib.proxy.methodproxy.invokesuper(methodproxy.java:228) @ org.springframework.context.annotation.configurationclassenhancer$beanmethodinterceptor.intercept(configurationclassenhancer.java:309) @ com.emc.daas.config.hibernateconfig$$enhancerbyspringcglib$$f623976c.getsessionfactory(<generated>) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ org.springframework.beans.factory.support.simpleinstantiationstrategy.instantiate(simpleinstantiationstrategy.java:162) ... 36 more caused by: org.hibernate.hibernateexception: access dialectresolutioninfo cannot null when 'hibernate.dialect' not set 

how can solve this?

i've changed hibernateconfig class like

public sessionfactory getsessionfactory(final datasource datasource) {     final localsessionfactorybuilder sessionbuilder = new localsessionfactorybuilder(datasource);     properties properties = new properties();     properties.setproperty("hibernate.dialect", "org.hibernate.dialect.derbydialect");     sessionbuilder.addproperties(properties);     sessionbuilder.scanpackages("com.em.daas.entity");     return sessionbuilder.buildsessionfactory(); } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -