[Hibernate-JIRA] Created: (HV-452) Incorrect Paths when using fluent API to add constraints to a context
by Glen Hilton (JIRA)
Incorrect Paths when using fluent API to add constraints to a context
---------------------------------------------------------------------
Key: HV-452
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-452
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.2.0.Beta2, 4.2.0.Beta1
Reporter: Glen Hilton
The bug actually should be found by existing test cases in ConstraintValidatorContextTest, but there happens to be a bug there too.
First to the test case bug:
In ConstraintValidatorContextTest, within the testing utility method assertMessageAndPath there's a call to TestUtil.assertEqualPaths. TestUtil.assertEqualPaths doesn't assert anything it returns a boolean, this fact causes line 156:
{{assertEqualPaths( messageAndPath.getPath(), PathImpl.createPathFromString( expectedPath ) );}}
to not actually test anything. Given this testing bug, we don't know that ConstraintValidatorContextTest.testMultipleMessages line 144:
{{assertMessageAndPath( messageAndPathList.get( 1 ), message2, "" );}}
should actually fail. As a quick and dirty fix to the test cases, we could wrap the existing line 144 with assertTrue, so it would end up:
{{assertTrue(assertMessageAndPath( messageAndPathList.get( 1 ), message2, "" ))}}
Now two of the tests in ConstraintValidatorContextTest will fail.
These test cases appear to fail because within ConstraintValidatorContextImpl, all of the subclasses (ErrorBuilderImpl, NodeBuilderImpl, InIterableNodeBuilderImpl) are getting instantiated with a reference to the propertyPath at the "base" level (ConstraintValidatorContextImpl.propertyPath). Meaning when the subclasses update the propertyPath they are actually all updating the same underlying object, leading to incorrect paths being created.
This bug appears to have been introduced with HV-395 as before there was code to create a copy of the path when ErrorBuilderImpl.addNode was called. Sorry I don't have an actual fix to provide, as I don't fully grasp HV-395. p.s. thanks for all the hard work!
--
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
14 years, 11 months
[Hibernate-JIRA] Created: (HHH-3008) Cascade delete does not work with unidirectional @OneToMany and @JoinTable
by Daniel Dyer (JIRA)
Cascade delete does not work with unidirectional @OneToMany and @JoinTable
--------------------------------------------------------------------------
Key: HHH-3008
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3008
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.5
Environment: Standalone entity manager (JavaSE 5.0).
H2 database.
Reporter: Daniel Dyer
A unidirectional one-to-many relationship defined as follows:
public class Owner
{
@OneToMany(cascade = CascadeType.ALL)
@JoinTable(name = "owner_element",
joinColumns = @JoinColumn(name = "owner_id",
nullable = false,
updatable = false),
inverseJoinColumns = @JoinColumn(name = "element_id",
nullable = false,
updatable = false))
private List<Element> elements;
// ...
}
Attempting to delete an instance of Owner should also delete all associated instances of Element. Instead I get the following error:
SEVERE: Referential integrity constraint violation: FK56BBF9C487E817D: PUBLIC.OWNER_ELEMENT FOREIGN KEY(OWNER_ID) REFERENCES PUBLIC.OWNER(ID) [23003-63]
This is because Hibernate attempts to delete the Owner row without first removing the rows from the join table.
--
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
14 years, 11 months