-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Migrating Integrator from Hibernate 4 to 5
PostPosted: Tue Jun 07, 2016 10:59 pm 
Newbie

Joined: Tue Jun 07, 2016 10:38 pm
Posts: 3
Location: South East Asia
Hello.
In Hibernate to override the TimestampType to convert all timestamps to/from UTC when they are sent to/from the database.
Previously I used the Integrator to register the new type, but since v5.0 the method to retrieve the Configuration disappeared.

I.e. this no longer works;
Code:
public class HibernateUtcTimestampTypeIntegrator implements Integrator {
@Override // This method no longer exist in v5.0
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
  configuration.registerTypeOverride(new HibernateUtcTimestampType());
}
[...]
}


So my question is, where do I override types in 5.x?

Thank you.


Top
 Profile  
 
 Post subject: Re: Migrating custom types to from 4 to 5
PostPosted: Wed Jun 08, 2016 1:53 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1630
Location: Romania
This is how your Integrator should look like with Hibernate 5:

Code:
public class HibernateUtcTimestampTypeIntegrator implements Integrator {

    @Override
    public void integrate(
                Metadata metadata,
                SessionFactoryImplementor sessionFactory,
                SessionFactoryServiceRegistry serviceRegistry) {
               
        ConfigurationService cfgService = serviceRegistry.getService( ConfigurationService.class );
    }

}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.