persistence@glassfish.java.net

Code review for Issue 191

From: Pramod Gopinath <Pramod.Gopinath_at_Sun.COM>
Date: Fri, 10 Mar 2006 18:44:44 -0800

Hi Tom/Gordon
  These code changes are for issue 191. This is to tackle the issue
where we create VARCHAR(255) fields for byte[] and char[] fields in java2db.

Could U guys review these chages.

Gordon :
  Any updates on the code changes that I had sent yesterday.

Thanks
Pramod



Index: src/java/oracle/toplink/essentials/internal/databaseaccess/DatabasePlatform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/databaseaccess/DatabasePlatform.java,v
retrieving revision 1.6
diff -r1.6 DatabasePlatform.java
397c397,401
<
---
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("BLOB"));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("CLOB"));
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("BLOB"));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("CLOB"));
>         
Index: src/java/oracle/toplink/essentials/internal/ejb/cmp3/xml/EntityMappingsXMLWriter.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/ejb/cmp3/xml/EntityMappingsXMLWriter.java,v
retrieving revision 1.4
diff -r1.4 EntityMappingsXMLWriter.java
762a763,766
>         } else if (lobType == byte[].class) {
>             lobElt.setAttribute(TYPE, BLOB);
>         } else if (lobType == char[].class) {
>             lobElt.setAttribute(TYPE, CLOB);
Index: src/java/oracle/toplink/essentials/internal/helper/ConversionManager.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/helper/ConversionManager.java,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 ConversionManager.java
833,835c833,836
<             if (javaClass == ClassConstants.APBYTE) {
<                 return ClassConstants.BYTE;
<             }
---
>         } else if (javaClass == ClassConstants.APBYTE) {
>             return ClassConstants.APBYTE;
>         } else if (javaClass == ClassConstants.APCHAR) {
>             return ClassConstants.APCHAR;
838c839
<         }
---
>         }            
Index: src/java/oracle/toplink/essentials/platform/database/AccessPlatform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/AccessPlatform.java,v
retrieving revision 1.3
diff -r1.3 AccessPlatform.java
63a64
>         
66c67,71
< 
---
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("LONGBINARY", false));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("MEMO", false));
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("LONGBINARY", false));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("MEMO", false));
>         
Index: src/java/oracle/toplink/essentials/platform/database/AttunityPlatform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/AttunityPlatform.java,v
retrieving revision 1.2
diff -r1.2 AttunityPlatform.java
64c64,68
< 
---
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("IMAGE", false));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("TEXT", false));        
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("IMAGE", false));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("TEXT", false));
>         
Index: src/java/oracle/toplink/essentials/platform/database/CloudscapePlatform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/CloudscapePlatform.java,v
retrieving revision 1.2
diff -r1.2 CloudscapePlatform.java
57a58,61
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("BYTE", false));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("TEXT", false));
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("BYTE", false));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("TEXT", false));        
Index: src/java/oracle/toplink/essentials/platform/database/DB2Platform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/DB2Platform.java,v
retrieving revision 1.5
diff -r1.5 DB2Platform.java
259a260,263
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("BLOB", 64000));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("CLOB", 64000));        
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("BLOB", 64000));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("CLOB", 64000));  
Index: src/java/oracle/toplink/essentials/platform/database/DBasePlatform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/DBasePlatform.java,v
retrieving revision 1.2
diff -r1.2 DBasePlatform.java
57a58,61
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("BINARY"));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("MEMO"));
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("BINARY"));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("MEMO"));        
Index: src/java/oracle/toplink/essentials/platform/database/DerbyPlatform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/DerbyPlatform.java,v
retrieving revision 1.5
diff -r1.5 DerbyPlatform.java
206c206,210
< 
---
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("BLOB", 64000));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("CLOB", 64000));
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("BLOB", 64000));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("CLOB", 64000));        
>         
Index: src/java/oracle/toplink/essentials/platform/database/HSQLPlatform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/HSQLPlatform.java,v
retrieving revision 1.2
diff -r1.2 HSQLPlatform.java
52a53,56
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("BINARY", false));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("LONGVARCHAR", false));
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("BINARY", false));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("LONGVARCHAR", false));        
Index: src/java/oracle/toplink/essentials/platform/database/InformixPlatform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/InformixPlatform.java,v
retrieving revision 1.2
diff -r1.2 InformixPlatform.java
149a150
>         
151a153,156
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("BYTE", false));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("TEXT", false));
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("BYTE", false));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("TEXT", false));        
Index: src/java/oracle/toplink/essentials/platform/database/MySQL4Platform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/MySQL4Platform.java,v
retrieving revision 1.4
diff -r1.4 MySQL4Platform.java
132c132,136
< 
---
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("BLOB", 64000));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("TEXT", 64000));
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("BLOB", 64000));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("TEXT", 64000));
>         
Index: src/java/oracle/toplink/essentials/platform/database/PostgreSQLPlatform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/PostgreSQLPlatform.java,v
retrieving revision 1.4
diff -r1.4 PostgreSQLPlatform.java
200a201
>         
202a204,207
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("BYTEA"));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("TEXT"));
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("BYTEA"));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("TEXT"));        
Index: src/java/oracle/toplink/essentials/platform/database/SQLServerPlatform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/SQLServerPlatform.java,v
retrieving revision 1.3
diff -r1.3 SQLServerPlatform.java
164a165
>         
167c168,172
< 
---
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("IMAGE", false));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("TEXT", false));
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("IMAGE", false));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("TEXT", false));
>         
Index: src/java/oracle/toplink/essentials/platform/database/SybasePlatform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/SybasePlatform.java,v
retrieving revision 1.3
diff -r1.3 SybasePlatform.java
221a222
>         
223d223
< 
225c225,229
< 
---
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("IMAGE", false));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("TEXT", false));
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("IMAGE", false));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("TEXT", false));        
>         
Index: src/java/oracle/toplink/essentials/platform/database/TimesTenPlatform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/TimesTenPlatform.java,v
retrieving revision 1.2
diff -r1.2 TimesTenPlatform.java
136c136,140
< 
---
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("VARBINARY", 64000));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("VARCHAR", 64000));
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("VARBINARY", 64000));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("VARCHAR", 64000));        
>         
Index: src/java/oracle/toplink/essentials/platform/database/oracle/OraclePlatform.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/platform/database/oracle/OraclePlatform.java,v
retrieving revision 1.5
diff -r1.5 OraclePlatform.java
157a158,161
>         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("LONG RAW", false));
>         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("LONG", false)); 
>         fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("LONG RAW", false));
>         fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("LONG", false));