Top Description Fields Constructors Methods
org.hibernate.cfg.beanvalidation

public Class HibernateTraversableResolver

extends Object
implements TraversableResolver
Class Inheritance
All Implemented Interfaces
javax.validation.TraversableResolver
Imports
java.lang.annotation.ElementType, java.util.Set, .HashSet, java.util.concurrent.ConcurrentHashMap, javax.validation.TraversableResolver, .Path, org.hibernate.persister.entity.EntityPersister, org.hibernate.Hibernate, org.hibernate.annotations.common.AssertionFailure, org.hibernate.engine.SessionFactoryImplementor, org.hibernate.type.CompositeType, .Type, .CollectionType

Use Hibernate metadata to ignore cascade on entities. cascade on embeddable objects or collection of embeddable objects are accepted Also use Hibernate's native isInitialized method call.
Author
Emmanuel Bernard

Field Summary

Modifier and TypeField and Description
private Set<String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
private void
private String
getStringBasedPath(Path.Node traversableProperty, Path pathToTraversableObject)

public boolean
isCascadable(Object
object hosting traversableProperty or null if validateValue is called
traversableObject
,
Path.Node
the traversable property
traversableProperty
,
Class<?>
type of the root object passed to the Validator or hosting the method or constructor validated
rootBeanType
,
Path
path from the root object to traversableObject (using the path specification defined by Bean Validator)
pathToTraversableObject
,
ElementType
either FIELD or METHOD
elementType
)

Implements javax.validation.TraversableResolver.isCascadable.

Determines if the Bean Validation provider is allowed to cascade validation on the bean instance returned by the property value marked as @Valid.
public boolean
isReachable(Object
object hosting traversableProperty or null if validateValue is called
traversableObject
,
Path.Node
the traversable property
traversableProperty
,
Class<?>
type of the root object passed to the Validator or hosting the method or constructor validated
rootBeanType
,
Path
path from the root object to traversableObject (using the path specification defined by Bean Validator)
pathToTraversableObject
,
ElementType
either FIELD or METHOD
elementType
)

Implements javax.validation.TraversableResolver.isReachable.

Determines if the Bean Validation provider is allowed to reach the property state.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

associationsback to summary
private Set<String> associations

Constructor Detail

HibernateTraversableResolverback to summary
public HibernateTraversableResolver(EntityPersister persister, ConcurrentHashMap<EntityPersister, Set<String>> associationsPerEntityPersister, SessionFactoryImplementor factory)

Method Detail

addAssociationsToTheSetForAllPropertiesback to summary
private void addAssociationsToTheSetForAllProperties(String[] names, Type[] types, String prefix, SessionFactoryImplementor factory)
addAssociationsToTheSetForOnePropertyback to summary
private void addAssociationsToTheSetForOneProperty(String name, Type type, String prefix, SessionFactoryImplementor factory)
getStringBasedPathback to summary
private String getStringBasedPath(Path.Node traversableProperty, Path pathToTraversableObject)
isCascadableback to summary
public boolean isCascadable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType)

Implements javax.validation.TraversableResolver.isCascadable.

Doc from javax.validation.TraversableResolver.isCascadable.

Determines if the Bean Validation provider is allowed to cascade validation on the bean instance returned by the property value marked as @Valid.

Note that this method is called only if isReachable(Object, javax.validation.Path.Node, Class, Path, java.lang.annotation.ElementType) returns true for the same set of arguments and if the property is marked as Valid.

Parameters
traversableObject:Object

object hosting traversableProperty or null if validateValue is called

traversableProperty:Path.Node

the traversable property

rootBeanType:Class<?>

type of the root object passed to the Validator or hosting the method or constructor validated

pathToTraversableObject:Path

path from the root object to traversableObject (using the path specification defined by Bean Validator)

elementType:ElementType

either FIELD or METHOD

Returns:boolean

true if the Bean Validation provider is allowed to cascade validation, false otherwise

isReachableback to summary
public boolean isReachable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType)

Implements javax.validation.TraversableResolver.isReachable.

Doc from javax.validation.TraversableResolver.isReachable.

Determines if the Bean Validation provider is allowed to reach the property state.

Parameters
traversableObject:Object

object hosting traversableProperty or null if validateValue is called

traversableProperty:Path.Node

the traversable property

rootBeanType:Class<?>

type of the root object passed to the Validator or hosting the method or constructor validated

pathToTraversableObject:Path

path from the root object to traversableObject (using the path specification defined by Bean Validator)

elementType:ElementType

either FIELD or METHOD

Returns:boolean

true if the Bean Validation provider is allowed to reach the property state, false otherwise