[hibernate-dev] Correct way to build a session factory?

Steve Ebersole steve at hibernate.org
Wed Apr 10 08:43:51 EDT 2013


Which?

I've just explained why Configuration is considered deprecated.

buildSessionFactory() is physically deprecated mainly as a matter of 
timing.  What will be 5.0 (metamodel branch) was always intended to be 
4.0 actually.  But timing caused that to not happen exactly as I 
wanted.  It is the same reason that 4.0 has metamodel-based code that 
is not even "live".  At the time we (all, all of us) discussed and 
agreed to (a) leave the metamodel code in place as a "preview" (not my 
vote) and (b) leave this method as deprecated as an indication that 
changes were coming in 5.0 and to get comfortable building/using 
service registry.


On Wed 10 Apr 2013 07:34:49 AM CDT, Sanne Grinovero wrote:
> Ok but why deprecating it?
>
> On 10 April 2013 13:23, Steve Ebersole <steve at hibernate.org> wrote:
>> There is a cfg.buildSessionFactory()  Has been one for nearly 10 years. It
>> is deprecated (as is the whole Configuration class really when you get down
>> to it and start talking 5.0).  It is the deprecation that Galder asked
>> about.
>>
>> On 04/10/2013 04:17 AM, Sanne Grinovero wrote:
>>>
>>> Why don't we add a simplified
>>>
>>>       cfg.buildSessionFactory();
>>>
>>> as well?
>>>
>>> I understand the importance of the ServiceRegistry, still many won't
>>> need/understand it: thousands of students would be grateful.
>>>
>>> Sanne
>>>
>>>
>>> On 10 April 2013 02:31, Strong Liu <stliu at hibernate.org> wrote:
>>>>
>>>> StandardServiceRegistryBuilder builder = new
>>>> StandardServiceRegistryBuilder();
>>>> StandardServiceRegistry serviceRegistry = builder.build();
>>>> cfg.buildSessionFactory(serviceRegistry);
>>>>
>>>> On Apr 9, 2013, at 8:28 PM, Galder Zamarreño <galder at redhat.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Re:
>>>>> http://docs.jboss.org/hibernate/orm/4.2/quickstart/en-US/html_single/#hibernate-gsg-tutorial-basic-test
>>>>>
>>>>> The code there to build a session factory is deprecated, in particular
>>>>> the parameter-less buildSessionFactory(), what's the correct way to build a
>>>>> session factory?
>>>>>
>>>>> I'm doing this for a presentation, hence I want to avoid using
>>>>> deprecated methods :)
>>>>>
>>>>> Cheers,
>>>>> --
>>>>> Galder Zamarreño
>>>>> galder at redhat.com
>>>>> twitter.com/galderz
>>>>>
>>>>> Project Lead, Escalante
>>>>> http://escalante.io
>>>>>
>>>>> Engineer, Infinispan
>>>>> http://infinispan.org
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> hibernate-dev mailing list
>>>>> hibernate-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>>
>>>> -------------------------
>>>> Best Regards,
>>>>
>>>> Strong Liu <stliu at hibernate.org>
>>>> http://about.me/stliu/bio
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> hibernate-dev mailing list
>>>> hibernate-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>
>>> _______________________________________________
>>> hibernate-dev mailing list
>>> hibernate-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>
>>


More information about the hibernate-dev mailing list