Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8330093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:00:49+00:00 2026-06-09T02:00:49+00:00

I inherited a project which uses EclipseLink JPA to persist objects into any SQL

  • 0

I inherited a project which uses EclipseLink JPA to persist objects into any SQL database. Currently it comes with a local Derby DB distribution. During some tests I found out that the program will throw the following exception:

012-08-03 10:21:11.357–UnitOfWork(32349505)–Exception
[EclipseLink-4002] (Eclipse Persistence Services –
2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException Internal
Exception: java.sql.SQLDataException: A truncation error was
encountered trying to shrink VARCHAR ‘some necessarily really long text’ to length 255. Error Code: 20000

Obviously VARCHAR isn’t (usually) suitable for storing Strings larger than 255 characters yet I didn’t find the code fragment where the objects variable is explicitely assigned to a VARCHAR field. I understand that JPA or EclipseLink automatically assigns this for you, so my question, where I couldn’t find a simple answer yet, is:

How can I make sure that EclipseLink / JPA stores Strings larger than 255 characters?

Cheers

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T02:00:51+00:00Added an answer on June 9, 2026 at 2:00 am

    You need to annotate the property so it gets persisted as Clob. Use @Lob; for Strings this will default to Clob. See here for the documentation. Of course you need to make sure that the database column type is correct (i.e. not VARCHAR) if you create the database manually.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've inherited a project which uses Entity Framework Database First. I'm trying to work
I've inherited a large project which uses Office.Interop.Excel to insert data into a spreadsheet.
I've inherited a project which saves the pages generated by php into database an
I'm currently working on an inherited project which uses Google's Visualization API (for both
I've inherited a project which uses JAXB heavily to map XML messages onto Java
I've just inherited (ahem) a QNX realtime project which uses a void*/downcasting/case statement mechanism
I have inherited a visual studio 2003 project which uses some custom build steps.
I have a Solution with a Project which uses a MSSQL Database and generated
Firstly - sorry for my English.. I've inherited a rather big project which uses
I inherited an access 2003 ADP file which uses sql 2000 as it's data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.