Hi,
This is for the latest version of Hibernate Hibernate session factory creation
----------------------------------------------------------------------------------
package com.howtodoinjava.demo.util;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
public class HibernateUtil
{
private static SessionFactory sessionFactory = buildSessionFactory();
private static SessionFactory buildSessionFactory()
{
try
{
if (sessionFactory == null)
{
Configuration configuration = new Configuration().configure(HibernateUtil.class.getResource("/hibernate.cfg.xml"));
StandardServiceRegistryBuilder serviceRegistryBuilder = new StandardServiceRegistryBuilder();
serviceRegistryBuilder.applySettings(configuration.getProperties());
ServiceRegistry serviceRegistry = serviceRegistryBuilder.build();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
}
return sessionFactory;
} catch (Throwable ex)
{
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory()
{
return sessionFactory;
}
public static void shutdown()
{
getSessionFactory().close();
}
}
----------------------------------------------------------------------
Required code to bring out all the record from table to display in JSF2.2 OR PRIMEFACES5 data table like google like pagination using the above code
Thanks
Raichand Ray
Display records from table in datatable with google like pag
-
- Posts: 8
- Joined: 20 Jul 2015, 18:31
Hi,
In my first post I had requested for a Primefaces-Hibernate CRUD Tutorial but I did get any.So I have created one and I want that to be in the education material of primefaces so that newbies like me get benefited.Please help me to send to them.
Thanks
Raichand
In my first post I had requested for a Primefaces-Hibernate CRUD Tutorial but I did get any.So I have created one and I want that to be in the education material of primefaces so that newbies like me get benefited.Please help me to send to them.
Thanks
Raichand
This is a very 'old school' way of doing things... Nobody uses things like this anymore. Most of the things are automatic. And many use JPA instead of Hibernate directly and... So honestly (and I don't want to put down your effort) I doubt anyone will use this. And regarding PrimeFaces and Hibernate 'crud' tutorials, using google you can find a fair amount of examples, and even more if you search for jpa https://www.google.com/search?q=primefa ... te+example
-
- Information
-
Who is online
Users browsing this forum: No registered users and 29 guests