-
-
Save yusufcakmak/aefef12a7fe4518043ec to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE hibernate-configuration PUBLIC | |
"-//Hibernate/Hibernate Configuration DTD 3.0//EN" | |
"http://hibernate.org/dtd/hibernate-configuration-3.0.dtd"> | |
<hibernate-configuration> | |
<session-factory> | |
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> | |
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/Book</property> | |
<property name="hibernate.connection.username">root</property> | |
<property name="hibernate.connection.password"></property> | |
<property name="hibernate.connection.pool_size">1</property> | |
<property name="hibernate.current_session_context_class">thread</property> | |
<property name="hibernate.show_sql">true</property> | |
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> | |
<mapping resource="book.hbm.xml" /> | |
</session-factory> | |
</hibernate-configuration> |
Thanks a lot!
``
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
at StoreData.main(StoreData.java:16)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql:localhost:3306/test
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
... 5 more
iam getting error like this can you help to learn hibernate
Thanks a lot!
Thank you!! :D
HI . Thank you for the configuration file. Small addition..
In case if we are using @entity annotation style of mapping + xml style of hibernate configuration, then, we can include the resource of that class as <mapping class="<FULLY_QUALIFIED_CLASSNAME_ANNOTATED_WITH_ENTITY>" instead of <mapping resource="<CONFIG_FILE_NAME_IN_src/main/resources>"
Thank You
Thanks!!
Thanks!
THANKS
Thanks!
Thanks
teşekkür ederim:)
why always hibernae.cfg,xml file will be for Mysql DB, is there any internal relationship between particular DB.
teşekkürler
jdbc:mysql://localhost:3306/Book
above Book name where we get? why we give Book there
👍👍👍Thanks
thanks
thanks
Thank you!!!
thanks
Thanks!
thanks
thanks
Thanks a lot!
thanks, but it is better that you set the hbm2ddl property