openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r578867 - in /openjpa/trunk/openjpa-persistence-jdbc/src: main/java/org/apache/openjpa/persistence/jdbc/ test/java/org/apache/openjpa/persistence/discriminator/ test/java/org/apache/openjpa/persistence/test/ test/java/org/apache/openjpa/per...
Date Mon, 24 Sep 2007 16:14:13 GMT
Author: mikedd
Date: Mon Sep 24 09:14:12 2007
New Revision: 578867

URL: http://svn.apache.org/viewvc?rev=578867&view=rev
Log:
OPENJPA-382

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/discriminator/TestDiscriminatorTypes.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xml/TestXmlOverrideEntity.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xml/XmlOverrideEntity.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/xml/orm.xml

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java?rev=578867&r1=578866&r2=578867&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
Mon Sep 24 09:14:12 2007
@@ -541,9 +541,9 @@
         if (_cols != null) {
             switch (fm.getDeclaredTypeCode()) {
                 case JavaTypes.ARRAY:
-                    if (fm.getDeclaredType() == byte[].class
-                        || fm.getDeclaredType() == char[].class
-                        || fm.getDeclaredType() == Character[].class) {
+                    Class type = fm.getDeclaredType();
+                    if (type == byte[].class || type == Byte[].class
+                        || type == char[].class || type == Character[].class ) {
                         fm.getValueInfo().setColumns(_cols);
                         break;
                     }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/discriminator/TestDiscriminatorTypes.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/discriminator/TestDiscriminatorTypes.java?rev=578867&r1=578866&r2=578867&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/discriminator/TestDiscriminatorTypes.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/discriminator/TestDiscriminatorTypes.java
Mon Sep 24 09:14:12 2007
@@ -144,10 +144,4 @@
         assertNotNull(root2);
         em.close();
     }
-
-    private ClassMapping getMapping(String name) {
-        return (ClassMapping) emf.getConfiguration()
-                .getMetaDataRepositoryInstance().getMetaData(name,
-                        getClass().getClassLoader(), true);
-    }
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java?rev=578867&r1=578866&r2=578867&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java
Mon Sep 24 09:14:12 2007
@@ -18,6 +18,7 @@
  */
 package org.apache.openjpa.persistence.test;
 
+import org.apache.openjpa.jdbc.meta.ClassMapping;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 
 public abstract class SingleEMFTestCase
@@ -60,5 +61,11 @@
         } finally {
             closeEMF(emf);
         }
+    }
+    
+    protected ClassMapping getMapping(String name) {
+        return (ClassMapping) emf.getConfiguration()
+                .getMetaDataRepositoryInstance().getMetaData(name,
+                        getClass().getClassLoader(), true);
     }
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xml/TestXmlOverrideEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xml/TestXmlOverrideEntity.java?rev=578867&r1=578866&r2=578867&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xml/TestXmlOverrideEntity.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xml/TestXmlOverrideEntity.java
Mon Sep 24 09:14:12 2007
@@ -20,6 +20,9 @@
 
 import javax.persistence.EntityManager;
 
+import org.apache.openjpa.jdbc.meta.ClassMapping;
+import org.apache.openjpa.jdbc.meta.FieldMapping;
+import org.apache.openjpa.jdbc.schema.Column;
 import org.apache.openjpa.persistence.InvalidStateException;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 
@@ -62,6 +65,24 @@
         em.getTransaction().begin();
         em.remove(em.find(XmlOverrideEntity.class, optional.getId()));
         em.getTransaction().commit();
+        
+        em.close();
+    }
+    
+    
+    public void testColumnOverride() { 
+        EntityManager em = emf.createEntityManager();
+
+        ClassMapping mapping = getMapping("XmlOverride");
+        
+        FieldMapping fm = mapping.getFieldMapping("picture");
+        
+        Column[] columns = fm.getColumns();
+        
+        assertEquals(1, columns.length);
+        assertEquals("pic_xml", columns[0].getName());
+        
+        em.close();
     }
 }
 

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xml/XmlOverrideEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xml/XmlOverrideEntity.java?rev=578867&r1=578866&r2=578867&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xml/XmlOverrideEntity.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xml/XmlOverrideEntity.java
Mon Sep 24 09:14:12 2007
@@ -19,9 +19,11 @@
 package org.apache.openjpa.persistence.xml;
 
 import javax.persistence.Basic;
+import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.Id;
+import javax.persistence.Lob;
 
 @Entity
 public class XmlOverrideEntity {
@@ -35,6 +37,10 @@
     
     @Basic(optional=true)
     String description;
+    
+    @Column(name="PICTURE")
+    @Lob
+    private Byte[] picture;
 
     public int getId() {
         return id;
@@ -58,6 +64,14 @@
 
     public void setDescription(String description) {
         this.description = description;
+    }
+
+    public Byte[] getPicture() {
+        return picture;
+    }
+
+    public void setPicture(Byte[] picture) {
+        this.picture = picture;
     } 
 }
 

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/xml/orm.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/xml/orm.xml?rev=578867&r1=578866&r2=578867&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/xml/orm.xml
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/xml/orm.xml
Mon Sep 24 09:14:12 2007
@@ -43,6 +43,10 @@
     	<attributes>
 	    	<basic name="name" optional="true"></basic>
 	    	<basic name="description" optional="false"></basic>
+            <basic name="picture" fetch="EAGER"> 
+                <column name="pic_xml"/>
+                <lob/>
+            </basic>
     	</attributes>
     </entity>
     <entity name="AllFieldTypes" 



Mime
View raw message