Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Supporting "Joda-Time"
PostPosted: Fri Jun 23, 2017 6:35 am 
Newbie

Joined: Fri Jun 16, 2017 6:22 am
Posts: 3
Hi guys,

Is there a way to use JodaTime with Hibernate-OGM-MongoDB?
The code bellow :
Code:
  private DateTime date;

    @Column( name = "date" )
    @Type( type = "org.joda.time.contrib.hibernate.PersistentDateTime" )
    public DateTime getDate() {
        return date;
    }

Raised this exception :
Code:
Caused by: org.hibernate.HibernateException: OGM000059: Unable to find a GridType for org.hibernate.type.CustomType
   at org.hibernate.ogm.type.impl.TypeTranslatorImpl.getType(TypeTranslatorImpl.java:140)
   at org.hibernate.ogm.persister.impl.OgmEntityPersister.<init>(OgmEntityPersister.java:329)
   ... 40 more


Is there a way to add or define a new
Code:
GridType
to support Joda-Time or should I use the standard
Code:
java.util.Date
?


Top
 Profile  
 
 Post subject: Re: Supporting "Joda-Time"
PostPosted: Fri Jun 30, 2017 7:28 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 288
Hi,
at the moment you have two ways to do this:

1. Extends the MongoDBDialect and override the overrideType method
2. You can implements the TypeContributor service, have a look at the CouchDBTypeContributor or MongoDBTypeContributor for examples

I hope this helps,
Davide


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.