nattaliahi
nattaliahi

Reputation: 31

Error while trying to run Junit test with Hibernate 5.2.1

Trying to run a Junit test with Hibernate 5.2.1 and the following error has occurred:

java.lang.AbstractMethodError: Method org/jadira/usertype/dateandtime/joda/PersistentDateTime.nullSafeSet(Ljava/sql/PreparedStatement;Ljava/lang/Object;ILorg/hibernate/engine/spi/SharedSessionContractImplementor;)V is abstract
  at org.jadira.usertype.dateandtime.joda.PersistentDateTime.nullSafeSet(PersistentDateTime.java)
  at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:160)
  at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2646)
  at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2621)
  at org.hibernate.persister.entity.AbstractEntityPersister$4.bindValues(AbstractEntityPersister.java:2832)
  at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:41)
  at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2840)
  at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3411)

    .....

In our pom we have the next dependencies:

<dependency>
    <groupId>org.jadira.usertype</groupId>
    <artifactId>usertype.spi</artifactId>
    <version>2.0.1</version>
</dependency>
<dependency>
    <groupId>org.jadira.usertype</groupId>
    <artifactId>usertype.jodatime</artifactId>
    <version>2.0.1</version>
</dependency> 
<dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>2.8.2</version>
</dependency>

Upvotes: 3

Views: 867

Answers (1)

NealeU
NealeU

Reputation: 1315

That project doesn't support the most recent Hibernate and relied on deprecated methods which were removed in Hibernate 5.2.

Instead you need to use the usertype.core version 6.0.0 or later as that was when support for Hibernate 5.2 was introduced.

The classes in the usertype.jodatime Maven artifact have been moved to usertype.core, so you'll need:

<dependency>
  <groupId>org.jadira.usertype</groupId>
  <artifactId>usertype.core</artifactId>
  <version>6.0.1.GA</version>
</dependency>

Upvotes: 3

Related Questions