Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Hibernate Basics Persisting Data with Hibernate Saving Data with Hibernate

for MYSQL (it workd )

to connect to MySQL server in hibernate.cj.xml

<hibernate-configuration>
    <session-factory>
        <!-- Database connection setting -->
        <property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>
        <property name="connection.url">jdbc:mysql://localhost:3306/nabil</property>
         <property name = "connection.username">root</property>
        <property name = "connection.password">root</property>
        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>

        <!-- Update the database schema on startup -->
        <property name="hbm2ddl.auto">update</property>

        <!-- Show the queries prepared by Hibernate -->
        <property name="show_sql">true</property>

        <!-- Names the annotated entity classes -->
        <mapping class="com.example.model.Contact" />
    </session-factory>
</hibernate-configuration>

and in build.gradel

dependencies {

    compile 'org.hibernate:hibernate-core:5.4.31.Final'

    compile 'mysql:mysql-connector-java:8.0.24'
}