Skip to content

Instantly share code, notes, and snippets.

View abitgen's full-sized avatar
🎯
Focusing

Abinandhan abitgen

🎯
Focusing
View GitHub Profile
@abitgen
abitgen / HibernateValidationUtils.java
Last active December 28, 2019 19:53
Validating entity manually, accepts entityManager and the entity to validate as parameters
public static <T> String validateEntity(final EntityManager entityManager, T obj){
Validator validator = new HibernateValidator().buildValidatorFactory(new ConfigurationState() {
@Override
public boolean isIgnoreXmlConfiguration() {
return true;
}
@Override
public MessageInterpolator getMessageInterpolator() {
return new ResourceBundleMessageInterpolator();
@abitgen
abitgen / EntityManagerJpaTraversable.java
Created December 28, 2019 19:47
Custom TraversableResolver which works with EntityManager. If you are facing with "TraversableResolver.IsReachable() threw Exception" especially with WAS 8.5
package com.asianpaints.ms.cms.custom;
/**
* Custom TraversableResolver which work with EntityManager.
*/
import org.jboss.logging.Logger;
import javax.persistence.EntityManager;
import javax.validation.Path;