Display records from table in datatable with google like pag

UI Components for JSF
Post Reply
raichand70
Posts: 8
Joined: 20 Jul 2015, 18:31

01 Aug 2015, 06:55

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

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

01 Aug 2015, 14:37

How is this PrimeFaces related? All I see is Hibernate code

raichand70
Posts: 8
Joined: 20 Jul 2015, 18:31

08 Sep 2015, 12:24

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

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

08 Sep 2015, 13:35

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

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests