1 / 6

Hibernate Java Configuration Example

Here we will show you how to create a Hibernate Application using Java configuration without using hibernate.cfg.xml to connect the MySQL database.<br><br>ServiceRegistry holds the services that Hibernate will need during bootstrapping and at runtime.<br>StandardServiceRegistryBuilder u2013 Builder for standard ServiceRegistry instances.<br>HibernateUtil u2013 This is the helper class to bootstrap hibernate SessionFactory. In most Hibernate applications, the SessionFactory should be instantiated once during application initialization.

Ducat1
Download Presentation

Hibernate Java Configuration Example

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Welcome to Ducat India Language | Industrial Training | Digital Marketing | Web Technology | Testing+ | Database | Networking | Mobile Application | ERP | Graphic | Big Data | Cloud Computing Apply Now Training & Certification Call Now: 70-70-90-50-90 www.ducatindia.com

  2. Hibernate Java Configuration Example Here we will show you how to create a Hibernate Application using Java configuration without using hibernate.cfg.xml to connect the MySQL database. ServiceRegistry holds the services that Hibernate will need during bootstrapping and at runtime. StandardServiceRegistryBuilder – Builder for standard ServiceRegistry instances. HibernateUtil – This is the helper class to bootstrap hibernate SessionFactory. In most Hibernate applications, the SessionFactory should be instantiated once during application initialization. The single instance should then be used by all code in a particular process, and any Session should be created using this single SessionFactory. The SessionFactory is thread-safe and can be shared; a Session is a single-threaded object.

  3. Add jar Dependencies to pom.xml < project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> < modelVersion>4.0.0< /modelVersion> < parent> < groupId>net.ducatindia.hibernate< /groupId> < artifactId>hibernate-tutorial< /artifactId> < version>0.0.1-SNAPSHOT< /version> < /parent> < artifactId>hibernate-java-config-example< /artifactId> < properties> < project.build.sourceEncoding>UTF-8< /project.build.sourceEncoding> < /properties> < dependencies> < !-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> < dependency>

  4. < groupId>mysql< /groupId> < artifactId>mysql-connector-java< /artifactId> < version>8.0.13< /version> < /dependency> < !-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core --> < dependency> < groupId>org.hibernate< /groupId> < artifactId>hibernate-core< /artifactId> < version>5.3.7.Final< /version> < /dependency> < /dependencies> < build> < sourceDirectory>src/main/java< /sourceDirectory> < plugins> < plugin> < artifactId>maven-compiler-plugin< /artifactId> < version>3.5.1< /version> < configuration> < source>1.8< /source>

  5. < target>1.8< /target> < /configuration> < /plugin> < /plugins> < /build> < /project> Read More: https://tutorials.ducatindia.com/java/hibernate-java-configuration-example/

  6. Thank you Call Now: 70-70-90-50-90 www.ducatindia.com

More Related