Diferencia entre revisiones de «Usuario:Lmorillas/desarrollo web servidor/jee/intro hibernate»
De WikiEducator
Línea 25: | Línea 25: | ||
}} | }} | ||
}} | }} | ||
+ | |||
+ | == BuildSessionFactory == | ||
+ | <source lang="java"> | ||
+ | Configuration hibConfiguration = new Configuration() | ||
+ | .addResource("wp4core/hibernate/config/table.hbm.xml") | ||
+ | .configure(); | ||
+ | |||
+ | serviceRegistry = new ServiceRegistryBuilder() | ||
+ | .applySettings(hibConfiguration.getProperties()) | ||
+ | .buildServiceRegistry(); | ||
+ | |||
+ | sessionFactory = hibConfiguration.buildSessionFactory(serviceRegistry); | ||
+ | session = sessionFactory.withOptions().openSession(); | ||
+ | |||
+ | </source> |
Revisión de 22:45 30 ene 2013
Objetivos
Tareas
Guión
|
BuildSessionFactory
Configuration hibConfiguration = new Configuration() .addResource("wp4core/hibernate/config/table.hbm.xml") .configure(); serviceRegistry = new ServiceRegistryBuilder() .applySettings(hibConfiguration.getProperties()) .buildServiceRegistry(); sessionFactory = hibConfiguration.buildSessionFactory(serviceRegistry); session = sessionFactory.withOptions().openSession();