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 6691609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:46:18+00:00 2026-05-26T05:46:18+00:00

We need to store a long UTF-8 string into a MySQL database which has

  • 0

We need to store a long UTF-8 string into a MySQL database which has to be checked for uniqueness. This is the current configuration:

@Column(unique = true,length = 8000,columnDefinition="TEXT")
private String text;

but since MySQL needs an index prefix to be specified for both BLOB and TEXT fields, this fails with the following error:

BLOB/TEXT column 'path' used in key specification without a key length

How can I properly configure my ORM mapping to support such use case?

  • 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-05-26T05:46:18+00:00Added an answer on May 26, 2026 at 5:46 am

    Have you considered calculating a hash value for your text string? Then you could store the hash value and just check for uniqueness on the hash value. Any collisions you get with the hash value you then check the actual text strings. If they are different then you include a sequence value. if not you’ve found your error. So your table is

    Hash, Sequence (unique within the same Hash value), TextString

    and your unique index is

    Hash, Sequence

    To test for uniqueness calculate the Hash value and attempt to store it with a zero sequence. If you can’t store it at sequence zero then compare the text string at sequence zero. If they are the same you found a duplicate text. If they are different attempt to store at sequence 1. Repeat until you find a duplicate text string at that sequence number or you don’t fail on storing it in the database with the next available sequence number.

    The trick is figuring out a hash algorithm that doesn’t give you very many duplicates and can handle a long text string. Even better would be a great ORM that could do this for you.

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

Sidebar

Related Questions

I need to store long strings in a database. the string may be 5
I need to store app specific configuration in rails. But it has to be:
I have a spatially enabled database (DB2, in this case). I need to store
If I store a long string in a variable and need to test if
I need to geocode adresses (get lat/long from addresses) using in .Net, to store
I need to store products for an e-commerce solution in a database. Each product
I need to store phone numbers in a table. Please suggest which datatype should
It's a rather long story but to make it short I need to store
I need to store in memory a very long array.Each array item will be
I need to store potentially 100s of millions URLs in a database. Every URL

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.