[ 
https://issues.apache.org/jira/browse/OPENJPA-1420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Marc Boudreau updated OPENJPA-1420:
-----------------------------------

    Attachment:     (was: OPENJPA-1420.v2.diff.txt)

> Long strings are improperly mapped on Informix
> ----------------------------------------------
>
>                 Key: OPENJPA-1420
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1420
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.2.1
>         Environment: Windows XP 32-bit, Informix 11.5 database
>            Reporter: Marc Boudreau
>            Priority: Minor
>         Attachments: OPENJPA-1420.diff.txt
>
>
> The field:
> @Basic
> @Column(length=4000)
> private String description;
> gets mapped to VARCHAR(4000) which is illegal on Informix.  The limit for 
> VARCHAR on Informix is 255.  The field should be mapped to LVARCHAR, which 
> supports up to 32767 characters on Informix. TEXT  should only be used if the 
> @Lob annotation is included, because this type can't be indexed.
> This is my test entity:
> MyEntity.java: 
> @Entity 
> public class MyEntity { 
>       @Id 
>       private int id; 
>       @Basic 
>       @Column(length=4000) 
>       private String description; 
>       public int getId() { 
>             return id; 
>       } 
>       public void setId(int value) { 
>             id = value; 
>       } 
>       public String getDescription() { 
>             return description; 
>       } 
>       public void setDescription(String value) { 
>             description = value; 
>       } 
> }
> This is what is dumped to the console:
> 2737  isvi  INFO   [main] openjpa.Runtime - Starting OpenJPA 1.2.1, 
> 2951  isvi  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class 
> "org.apache.openjpa.jdbc.sql.InformixDictionary". 
> Exception in thread "main" <openjpa-1.2.1-r752877:753278 nonfatal general 
> error> org.apache.openjpa.persistence.PersistenceException: IDS SQL Error: 
> SQLCODE=-650, SQLSTATE=IX000, SQLERRMC=null, DRIVER=3.51.90 {stmnt 
> 809054265 CREATE TABLE MyEntity (id INTEGER NOT NULL, description VARCHAR 
> (4000), PRIMARY KEY (id)) LOCK MODE ROW} [code=-650, state=IX000] 
>       at org.apache.openjpa.jdbc.meta.MappingTool.record 
> (MappingTool.java:553) 
>       at org.apache.openjpa.jdbc.meta.MappingTool.record 
> (MappingTool.java:453) 
>       at 
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings 
> (JDBCBrokerFactory.java:159) 
>       at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl 
> (JDBCBrokerFactory.java:119) 
>       at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker 
> (AbstractBrokerFactory.java:189)) 
>       at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker 
> (DelegatingBrokerFactory.java:142) 
>       at 
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager 
> (EntityManagerFactoryImpl.java:192) 
>       at 
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager 
> (EntityManagerFactoryImpl.java:145) 
>       at 
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager 
> (EntityManagerFactoryImpl.java:56)) 
>       at jpa.test.isvi.Main.run(Main.java:12) 
>       at jpa.test.isvi.Main.main(Main.java:53) 
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: IDS SQL 
> Error: SQLCODE=-650, SQLSTATE=IX000, SQLERRMC=null, DRIVER=3.51.90 {stmnt 
> 809054265 CREATE TABLE MyEntity (id INTEGER NOT NULL, description VARCHAR 
> (4000), PRIMARY KEY (id)) LOCK MODE ROW} [code=-650, state=IX000] 
>       at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap 
> (LoggingConnectionDecorator.java:192) 
>       at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700 
> (LoggingConnectionDecorator.java:57), 
>       at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator 
> $LoggingConnection$LoggingStatement.executeUpdate 
> (LoggingConnectionDecorator.java:762) 
>       at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate 
> (DelegatingStatement.java:114) 
>       at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL 
> (SchemaTool.java:1191) 
>       at org.apache.openjpa.jdbc.schema.SchemaTool.createTable 
> (SchemaTool.java:949) 
>       at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:526) 
>       at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344) 
>       at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321) 
>       at org.apache.openjpa.jdbc.meta.MappingTool.record 
> (MappingTool.java:501): 
>       ... 10 more 

-- 
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