[Hibernate-JIRA] Created: (HHH-3894) Loader.initializeEntitiesAndCollections() does not guarantee correct behavior of Lifecycle.onLoad()
by Michael Papadopoulos (JIRA)
Loader.initializeEntitiesAndCollections() does not guarantee correct behavior of Lifecycle.onLoad()
---------------------------------------------------------------------------------------------------
Key: HHH-3894
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3894
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Reporter: Michael Papadopoulos
Consider lines 871-879 of org.hibernate.loader.Loader (method initializeEntitiesAndCollections()) :
if ( hydratedObjects!=null ) {
int hydratedObjectsSize = hydratedObjects.size();
if ( log.isTraceEnabled() ) {
log.trace( "total objects hydrated: " + hydratedObjectsSize );
}
for ( int i = 0; i < hydratedObjectsSize; i++ ) {
TwoPhaseLoad.initializeEntity( hydratedObjects.get(i), readOnly, session, pre, post );
}
}
It is possible that hydratedObjects.get(1) is an entity contained in hydratedObjects.get(0). If hydratedObjects.get(0) implements org.hibernate.classic.Lifecycle, its onLoad() method will be called before the contained entity hydratedObjects.get(1) is initialized, thus breaking the contract of onLoad() (i.e. that onLoad() is called after the entity is loaded; in our case hydratedObjects.get(0) will not be fully loaded yet, since one of its properties will not have been initialized yet).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 8 months
[Hibernate-JIRA] Created: (HHH-2882) QueryKey.equals() returning false with distributed caching
by Daniel Campagnoli (JIRA)
QueryKey.equals() returning false with distributed caching
----------------------------------------------------------
Key: HHH-2882
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2882
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.5
Reporter: Daniel Campagnoli
We noticed some issues recently with the query cache when using Coherence as the cache provider. This was due to instances of org.hibernate.cache.QueryKey not being equal after being serialized then deserialized.
The equals check was failing on the [ResultTransformer customTransformer] field which in our case had an instance of RootEntityResultTransformer (which comes from the field CriteriaSpecification.ROOT_ENTITY). This is because RootEntityResultTransformer doesnt override equals, so the check is done by reference equality. When the QueryKey has been serialized and deserialized out of the cache, the instance will always be different, so the equals check will fail.
A fix for this to be implement equals for RootEntityResultTransformer (and possibly the other ResultTransformer's). I used the following which worked fine.
public boolean equals(Object obj) {
return obj != null && this.getClass() == obj.getClass();
}
ps. I created HHH-1665 a while ago, a real simple fix, could that be looked at :)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 8 months
[Hibernate-JIRA] Created: (BVAL-152) TraversableResolver should differentiate reachability and cascadability
by Emmanuel Bernard (JIRA)
TraversableResolver should differentiate reachability and cascadability
-----------------------------------------------------------------------
Key: BVAL-152
URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-152
Project: Bean Validation
Issue Type: Improvement
Components: spec-general
Affects Versions: 1.0 proposed final draft
Reporter: Emmanuel Bernard
Fix For: 1.0 final
/**
* Contract determining if a property can be accessed by the Bean Validation provider
* This contract is called for each property either validated or traversed.
*
* A traversable resolver implementation must be thread-safe.
*
* @author Emmanuel Bernard
*/
public interface TraversableResolver {
/**
* Determine if Bean Validation is allowed to reach the property state
*
* @param traversableObject object hosting <code>traversableProperty</code>, null if validateValue is called
* @param traversableProperty name of the traversable property.
* @param rootBeanType type of the root object passed to the Validator.
* @param pathToTraversableObject path from the root object to
* <code>traversableObject</code> ("" if the <code>traversableObject</code>
* is the root object)
* (using the path specification defined by Bean Validator).
* @param elementType either <code>FIELD</code> or <code>METHOD</code>.
*
* @return <code>true</code> if Bean Validation is allowed to reach the property state,
* <code>false</code> otherwise.
*/
boolean isReachable(Object traversableObject,
String traversableProperty,
Class<?> rootBeanType,
String pathToTraversableObject,
ElementType elementType);
/**
* Determine if Bean Validation is allowed to cascade validation on
* the bean instance returned by the property value
* marked as <code>@Valid</code>.
* Note that this method is called only if isReachable returns true for the same set of
* arguments and if the property is marked as <code>@Valid</code>
*
* @param traversableObject object hosting <code>traversableProperty</code>, null if validateValue is called
* @param traversableProperty name of the traversable property.
* @param rootBeanType type of the root object passed to the Validator.
* @param pathToTraversableObject path from the root object to
* <code>traversableObject</code> ("" if the <code>traversableObject</code>
* is the root object)
* (using the path specification defined by Bean Validator).
* @param elementType either <code>FIELD</code> or <code>METHOD</code>.
*
* @return <code>true</code> if Bean Validation is allowed to cascade validation,
* <code>false</code> otherwise.
*/
boolean isCascadable(Object traversableObject,
String traversableProperty,
Class<?> rootBeanType,
String pathToTraversableObject,
ElementType elementType);
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 8 months
[Hibernate-JIRA] Created: (HV-146) ValidatorTypeHelper.resolveTypes ignores return value of recursive call
by Eddy Verbruggen (JIRA)
ValidatorTypeHelper.resolveTypes ignores return value of recursive call
-----------------------------------------------------------------------
Key: HV-146
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-146
Project: Hibernate Validator
Issue Type: Bug
Affects Versions: 4.0.0.Alpha3
Reporter: Eddy Verbruggen
My Validator classes extend a common superclass, which in turn implements the ConstraintValidator interface. This version of Hibernate Validator can't cope with that class structure due to a little bug in ValidatorTypeHelper.resolveTypes.
The last bit of that method calls itself recursively, but ignores returnvalues, so the code always falls through to "return null".
else {
resolveTypes( resolvedTypes, rawType.getGenericSuperclass() );
for ( Type genericInterface : rawType.getGenericInterfaces() ) {
resolveTypes( resolvedTypes, genericInterface );
}
}
}
//else we don't care I think
return null;
Can it be changed to something like this please:
else {
Type returnedType = resolveTypes( resolvedTypes, rawType.getGenericSuperclass() );
if ( returnedType != null ) {
return returnedType;
}
for ( Type genericInterface : rawType.getGenericInterfaces() ) {
returnedType = resolveTypes( resolvedTypes, genericInterface );
if ( returnedType != null ) {
return returnedType;
}
}
}
}
//else we don't care I think
return null;
The stacktrace is:
java.lang.NullPointerException
at org.hibernate.validation.util.ValidatorTypeHelper.extractType(ValidatorTypeHelper.java:68)
at org.hibernate.validation.util.ValidatorTypeHelper.getValidatorsTypes(ValidatorTypeHelper.java:57)
at org.hibernate.validation.engine.ConstraintTree.findMatchingValidatorClass(ConstraintTree.java:163)
at org.hibernate.validation.engine.ConstraintTree.getInitalizedValidator(ConstraintTree.java:144)
at org.hibernate.validation.engine.ConstraintTree.validateConstraints(ConstraintTree.java:113)
at org.hibernate.validation.engine.MetaConstraint.validateConstraint(MetaConstraint.java:126)
at org.hibernate.validation.engine.ValidatorImpl.validatePropertyForGroup(ValidatorImpl.java:419)
at org.hibernate.validation.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:373)
at org.hibernate.validation.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:132)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 8 months