openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-1562) EntityManager:Refresh on Removed entity does not trigger IllegalArgumentException
Date Mon, 15 Mar 2010 21:33:27 GMT

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

Michael Dick commented on OPENJPA-1562:
---------------------------------------

Thanks for the patch Dianne, but I have a couple of questions. 

1. The javadoc for lock() and refresh() is very similar regarding detached entities : 

For lock() :
     @throws IllegalArgumentException if the instance is not an

             entity or is a detached entity

For refresh() : 
     @throws IllegalArgumentException if the instance is not

             an entity or the entity is not managed

Seems like we'd want to the same thing for refresh and lock (basically the if check for REFRESH
can be removed).

2. This is more of a general question - your patch didn't introduce it but the assertValidAttchedEntity()
method is very similar to contains(). There is a subtle difference in that contains checks
whether the type is managed by this persistence context, and assertValidAttachedEntity checks
whether the StateManager is persistent. There's also a slight difference in the exceptions
thrown. Still it seems like we'd want to reuse the logic, and rather than duplicating the
code.

> EntityManager:Refresh on Removed entity does not trigger IllegalArgumentException
> ---------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1562
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1562
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.0-beta2
>         Environment: Mac OS X, OpenJPA 2.0.0-beta2, Spring 3.0
>            Reporter: Jerry Carter
>            Assignee: Dianne Richards
>            Priority: Minor
>         Attachments: openjpa1562.tar.zip, patch.txt, simple_entity_tests.txt
>
>
> My application unit tests turned up some unexpected behavior from basic OpenJPA entity
manager functions.  It appears, for instance, that a detached entity can still be refreshed.
 I decided to write a few basic tests (attached) which report five potential errors.  This
does not go into the testing of cascading behavior which would require additional work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message