openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Ringel (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-1787) Bean validation fails merging a new entity
Date Tue, 15 Mar 2011 16:25:29 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-1787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006993#comment-13006993
] 

Oliver Ringel commented on OPENJPA-1787:
----------------------------------------

Perfect. You fixed the issue. Both my test case as well as my real project are working now.
Thank you very much.

BTW. I found something probably wrong in the ValidatingLifecycleEventManager

...
    @Override
    public boolean hasUpdateListeners(Object source, ClassMetaData meta) {
        if (_validator == null) {            
            return super.hasUpdateListeners(source, meta);
        }
        return _validator.validating(source, LifecycleEvent.BEFORE_PERSIST) ||    <---
LifecycleEvent.BEFORE_UPDATE
            super.hasUpdateListeners(source, meta);
    }

    @Override
    public boolean hasPersistListeners(Object source, ClassMetaData meta) {
        if (_validator == null) {            
            return super.hasPersistListeners(source, meta);
        }
        return _validator.validating(source, LifecycleEvent.BEFORE_UPDATE) ||    <--- LifecycleEvent.BEFORE_PERSIST
            super.hasPersistListeners(source, meta);        
    }
...

Although it has no effect for my testcase, it looks not correct. Maybe you verify this.



> Bean validation fails merging a new entity
> ------------------------------------------
>
>                 Key: OPENJPA-1787
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1787
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa, kernel
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0
>            Reporter: Oliver Ringel
>            Assignee: Jeremy Bauer
>            Priority: Critical
>         Attachments: OPENJPA-1787_2.1.x.patch, OPENJPA-1787_jUnits_2.1.x.patch, com.example.TestEmployeeDAO.txt,
openjpa-1787.tar, testcase-openjpa-1787.tar
>
>
> The bean validation is not working correctly
> If you try to merge a new entity.
>         EntityManager em = entityManagerFactory.createEntityManager();
>         Person person = new Person();
>         person.setName("Oliver");                               // Employee.name is annotated
@NotNull 
>         person = em.merge(person);                            
> you get a ConstraintValidationException, although name is set. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message