Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation on RelationshipEntity fails [DATAGRAPH-451] #1015

Closed
spring-projects-issues opened this issue Mar 17, 2014 · 6 comments
Closed

Validation on RelationshipEntity fails [DATAGRAPH-451] #1015

spring-projects-issues opened this issue Mar 17, 2014 · 6 comments
Labels
in: core type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Mar 17, 2014

Timmy Storms opened DATAGRAPH-451 and commented

I'm using SDN in the advanced mapping mode. Everything is working fine, except validation in a RelationshipEntity. It looks like this:

@RelationshipEntity(type = Vote.TYPE)
public class Vote extends Entity {
    
    public static final String TYPE = "LIKES";

    @StartNode
    private Person person;

    @EndNode
    private Post post;

    @Min(0)
    @Max(5)
    private int score;

...
}

When I create a relationship between two nodes with an invalid score, the validation isn't triggered. An example:

final Person john = new Person("John", "Doe").persist();
final Post post = new Post("SDN Example", "Description").persist();
new Vote(john, post, 20).persist();

For the record, validation works in the Person and Post NodeEntities. See reference URL above for the entire test project


Affects: 3.0.1 (Codd SR1)

Reference URL: https://github.com/TimmyStorms/spring-data-neo4j-example/

Backported to: 3.0.2 (Codd SR2)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 17, 2014

Timmy Storms commented

After some further investigation, "RelationshipDelegatingFieldAccessorFactory" does not initiate a listener like "ValidatingNodePropertyFieldAccessorListenerFactory" that is used for node property changes

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 17, 2014

Michael Hunger commented

Thanks Timmy for the Investigation, must have been an oversight

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 17, 2014

Timmy Storms commented

HTH! Verified that it works after I've added a custom FieldAccessorFactoryFactory for RelationshipNodes in my Configuration class

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 17, 2014

Michael Hunger commented

Cool, would be great if you could just send in a pull request with that change and a test.

Thanks so much

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 17, 2014

Timmy Storms commented

Sure on "master" or "310" branch?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 17, 2014

Michael Hunger commented

Best on the 3.0.x branch and then I can cherry pick the commit into master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: bug
Projects
None yet
Development

No branches or pull requests

1 participant