Problem with class org.hibernate.Validator.Invalidvalue when upgrading from Hibernate 3.X to 4.X

Asked

Viewed 276 times

0

I have a project developed using Jboss Seam 2.2.2.Final along with Hibernate 3.6. I’m trying to upgrade this project by upgrading and migrating the component versions that it uses. One of these migrations is to climb the version of Hibernate for version 4.6.3.Final, which on the date of this posting is the latest stable version.

As the project is in Maven, the first thing I did was to update the project dependencies by going up the Hibernate versions. As follows:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>4.3.4.Final</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>4.3.4.Final</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-envers</artifactId>
    <version>4.3.4.Final</version>
    <scope>provided</scope>
</dependency>

However, when doing version updates on pom.xml, the project started to show compilation error precisely in something related to Hibernate. See the code snippet below:

ResourceBundle bundle = SeamResourceBundle.getBundleNamed(NOME_BUNDLE);
StringBuilder msg = new StringBuilder("");
msg.append(bundle.getString(MSG_GERAL));
StatusMessages.instance().add(msg.toString()); //Erro ocorre aqui

In the fourth line of the above section, there is an error related to class org.hibernate.validator.InvalidValue (link documentation). The error that occurs is shown by Eclipse:

The type org.hibernate.Validator.Invalidvalue cannot be resolved. It is Indirectly referenced from required . class files

Does anyone know how to fix this problem? Or do they know any workaround for that reason?

1 answer

1

Hibernate Validator has been updated in version 4 of Hibernate.

Add to your dependencies:

  <dependency>
     <groupId>org.hibernate</groupId>
     <version>4.0.2.GA</version>
     <artifactId>hibernate-validator-legacy</artifactId>
   </dependency>

To maintain compatibility.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.