HHH-8674 - fixed usage of deprecated method Configuration#buildSessionFactory() in documentation
This commit is contained in:
parent
f815f70f51
commit
cb215c468d
|
@ -553,7 +553,7 @@ public class Event {
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section xml:id="tutorial-firstapp-helpers" revision="3">
|
<section xml:id="tutorial-firstapp-helpers" revision="4">
|
||||||
<title>Startup and helpers</title>
|
<title>Startup and helpers</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
@ -579,6 +579,7 @@ public class Event {
|
||||||
<programlisting role="JAVA"><![CDATA[package org.hibernate.tutorial.util;
|
<programlisting role="JAVA"><![CDATA[package org.hibernate.tutorial.util;
|
||||||
|
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.cfg.Configuration;
|
||||||
|
|
||||||
public class HibernateUtil {
|
public class HibernateUtil {
|
||||||
|
@ -588,7 +589,9 @@ public class HibernateUtil {
|
||||||
private static SessionFactory buildSessionFactory() {
|
private static SessionFactory buildSessionFactory() {
|
||||||
try {
|
try {
|
||||||
// Create the SessionFactory from hibernate.cfg.xml
|
// Create the SessionFactory from hibernate.cfg.xml
|
||||||
return new Configuration().configure().buildSessionFactory();
|
Configuration configuration = new Configuration();
|
||||||
|
return configuration.configure().buildSessionFactory(new StandardServiceRegistryBuilder()
|
||||||
|
.applySettings(configuration.getProperties()).build());
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Throwable ex) {
|
||||||
// Make sure you log the exception, as it might be swallowed
|
// Make sure you log the exception, as it might be swallowed
|
||||||
|
|
Loading…
Reference in New Issue