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

Albert Lee commented on OPENJPA-905:
------------------------------------

The spec docuemnt that:

2.1.1 Persistent Fields and Properties
Collection-valued persistent fields and properties must be defined in terms of 
one of the following collection-
valued interfaces regardless of whether the entity class otherwise adheres to 
the JavaBeans
method conventions noted above and whether field or property-based access is 
used:
java.util.Collection, java.util.Set, java.util.List[4], java.util.Map.[5]

[4] Portable applications should not expect the order of lists to be maintained 
across persistence contexts unless the OrderBy construct
is used and the modifications to the list observe the specified ordering. The 
order is not otherwise persistent.
[5] The implementation type may be used by the application to initialize fields 
or properties before the entity is made persistent; subsequent
access must be through the interface type once the entity becomes managed (or 
detached).

So you are correct that the test is not quite correct. However the change has 
negated the intent of the test and become not quite meaningful.
I would suggest the following:

1) 
public class ProxiesPC implements Comparable {

    @PersistentCollection
    @OrderBy   // <<<<<  enforce ordering of the List<String>
    private List<String> list = new ArrayList();

2)
public class TestProxies2 extends BaseKernelTest {

    public void testChangeListOrder() {

        // re-retrieve to check ordering
        pm = getPM(false, false);
        pc = pm.find(ProxiesPC.class, _oid);

        list = pc.getList();
        assertEquals(5, list.size());
        assertEquals("val1", list.get(0));
        assertEquals("val1", list.get(1));
        assertEquals("val2", list.get(2));   //  <<<< make sure it is in the 
expected order after remove/add
        assertEquals("val3", list.get(3));
        assertEquals("val3", list.get(4));

If you think this is correct, can you please erify this patch works against the 
databases that had problems?

Thanks,
Albert Lee.

> org.apache.openjpa.persistence.kernel.TestProxies2
> --------------------------------------------------
>
>                 Key: OPENJPA-905
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-905
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Tim McConnell
>            Assignee: Tim McConnell
>         Attachments: OPENJPA-905.patch
>
>


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

Reply via email to