I am getting the following error when using Hibernate:
'hibernate.dialect' must be set when no Connection available
And I am using a datasource for database connection.
I am getting the following error when using Hibernate:
'hibernate.dialect' must be set when no Connection available
And I am using a datasource for database connection.
This error is hibernate doing a poor job of telling you what went wrong with your attempted connection with database.
In my case it was as simple as having a wrong password in config file.
In the Hibernate configuration dialog has a tab "options" it is possible to select some. In this case I was using Oracle Enterprise Pack for Eclipse that already had configured connector, but was still getting the error. Select an option on the list was enough to solve.
You need to set the property
In the hibernate (persistence.xml or bean declaration) configuration, the value depends on your database, for example:
All posible options are listen here
For example, a sample persistence.xml looks like:
In some cases just using a wrong name for the database results in this Exception. Hibernate is apparently trying to determine the dialect before doing anything else, and as the DB cannot be reached, the error message comes from the part responsible for the dialect select. Bad error messaging on part of Hibernate.
I had this problem too. The reason was missing
<property name="dataSource" ref="dataSource" />
element in<bean id="sessionFactory">
definition.You will get this issue even if you have your configuration files having proper value but you don't configure it in the code.
I was explaining hibernate, I forgot to use
configure()
beforebuildSessionFactory()
so I was getting the error.You might want to recheck it.
Previous code which was giving me error
Changed code No Error