vendredi 20 février 2015

hibernate.cfg.xml and hibernate dialect



I am new to hibernate and i was wondering if someone can help me out on this.I tried all the dialect but i cant figure it out. please help


when i run simple java using hibernate to store data to a table...Feb 20, 2015 3:12:19 PM org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found Feb 20, 2015 3:12:19 PM org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist Feb 20, 2015 3:12:19 PM org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator initiateService WARN: HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections Exception in thread "main" org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:98) at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:68) at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:174) at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:85) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:184) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:156) at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1827) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1785) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870) at org.mikias.kidane.hi.HibernateTest.main(HibernateTest.java:18)


here is my hibernate.cfg.xml code



<?xml version='1.0' encoding='utf-8'?>

<hibernate-configuration
xmlns="http://ift.tt/1pBfdC0"
xsi:schemaLocation="http://ift.tt/1pBfdC0 hibernate-configuration-4.0.xsd"
xmlns:xsi="http://ift.tt/ra1lAU">
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/konohashop</property>
<property name="connection.username">root</property>
<property name="connection.password">pass</property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>

<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">update</property>
<mapping resource="org.m.mi.UserDetails"/>
</session-factory>
</hibernate-configuration>



Aucun commentaire:

Enregistrer un commentaire