openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fayw...@apache.org
Subject svn commit: r772528 - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/meta/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/
Date Thu, 07 May 2009 07:16:40 GMT
Author: faywang
Date: Thu May  7 07:16:31 2009
New Revision: 772528

URL: http://svn.apache.org/viewvc?rev=772528&view=rev
Log:
OPENJPA-1069: orderBy on ElementCollection of basic types

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/EmergencyContactInfo.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverrides.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java?rev=772528&r1=772527&r2=772528&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java
Thu May  7 07:16:31 2009
@@ -1861,6 +1861,7 @@
         _mappedByIdValue = field._mappedByIdValue;
         _isElementCollection = field._isElementCollection;
         _access = field._access;
+        _orderDec = field._orderDec;
 
         // embedded fields can't be versions
         if (_owner.getEmbeddingMetaData() == null && _version == null)

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/EmergencyContactInfo.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/EmergencyContactInfo.java?rev=772528&r1=772527&r2=772528&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/EmergencyContactInfo.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/EmergencyContactInfo.java
Thu May  7 07:16:31 2009
@@ -18,6 +18,9 @@
  */
 package org.apache.openjpa.persistence.embed.attrOverrides;
 
+import java.util.ArrayList;
+import java.util.Collection;
+
 import javax.persistence.*;
 
 
@@ -30,6 +33,10 @@
 	
 	@OneToOne
     PhoneNumber phoneNumber; 
+	
+	@ElementCollection
+	@OrderBy
+	Collection<String> nickNames = new ArrayList<String>();
     
     public PhoneNumber getPhoneNumber() {
         return phoneNumber;
@@ -62,4 +69,16 @@
     public void setLName(String lName) {
     	this.lName = lName;
     }
+    
+    public Collection<String> getNickNames() {
+        return nickNames;
+    }
+    
+    public void setNickNames(Collection<String> nickNames) {
+        this.nickNames = nickNames;
+    }
+    
+    public void addNickName(String nickName) {
+        nickNames.add(nickName);
+    }
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverrides.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverrides.java?rev=772528&r1=772527&r2=772528&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverrides.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverrides.java
Thu May  7 07:16:31 2009
@@ -111,6 +111,9 @@
         EmergencyContactInfo ecInfo = new EmergencyContactInfo();
         ecInfo.setFName("fName_" + id);
         ecInfo.setLName("lName_" + id);
+        for (int i = 5; i > 0; i--) {
+            ecInfo.addNickName("nickName" + i);
+        }
         Address eaddr = new Address();
         eaddr.setId(addrId++);
         eaddr.setCity("city_" + eaddr.getId());
@@ -174,6 +177,13 @@
         for (PhoneNumber p : phones) {
             assertPhoneNumber(p, e.getEmpId());
         }
+        Collection<String> nickNames = c.getEmergencyContactInfo().
+            getNickNames();
+        int i = 1;
+        for (String nickName : nickNames) {
+            assertEquals("nickName" + i, nickName);
+            i++;
+        }
     }
 	
     public void assertPhoneNumber(PhoneNumber p, int empId) {



Mime
View raw message