I am using Toplink 11g JPA to obtain pojos from a Sybase ASE (version 15) table. This programs run in Tomcat 6.0.14 on a Linux OS.
Each pojo represents a displayed row in a grid in the browser. After redisplaying the same 10 rows of pojos (with one column/field of size 500-600 characters) about three times successfully, the returned pojo column size is restricted to 255 characters.
I tried to set the annotation for column length to 1000, but it does not seem to care.
The column length within the annotation only affects DDL generation, so check what is used when the table is created - the default varchar size on the SybasePlatform class comes from the DatabasePlatform class and seems to be 255. Be sure you are dropping and recreating the tables when you make changes to the size so that the DDL is rerun on the database. Chances are that it is just the column size in the database table that is causing the trunctation. The cache will show the value initially set until it gets refreshed from the cache - which might explain why you only see this problem later on and not immediately. You can verify by calling persist, flush then refresh and check the string size.
If that is not the problem, TopLink/EclipseLink will not truncate data, so you will need to try and narrow when it is occuring. You might want to check that your JDBC driver allows inserting a string longer than 255 characters and that it will return the same string through a straight JDBC test case to rule that out as a cause.
Noticed something else, I have another installation of Sybase (same version; tables and fields create with same script) that runs this exact same scenario using the exact same software, toplink, java code, etc. without any problem. I get all 550 characters each time. The only difference could be was how the database was installed/configured (excluding the tables, permission, users).
Does toplink have some specific db configuration requirements? I did noticed that the database that works has "Stores mixed case identifiers" and "Support mixed case identifiers" set to "No" when comparing in DBVisual. Whereas, the non-working Sybase installation has this value set to "Invalid State."
Found the solution. It was the JDBC Driver version. We had both jconn2.jar and jconn3.jar in the WEB-INF/lib directory. jconn2.jar is version 5.5 - this version restricted varchar to 255 characters. jconn3.jar is version 6.0 removed that restriction.