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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:22:15+00:00 2026-06-12T17:22:15+00:00

One of my entities Machinery has got a String property called notes . JPA

  • 0

One of my entities Machinery has got a String property called notes. JPA 2-Hibernate generates the schema for me, in my case the RDBMS is a MySQL.

notes is created as a VARCHAR(255) column, which is right.

Users begin to create records and all works perfectly, but then some users get the infamous Data too long for column "notes" error.

That field hasn’t enough room for user’s machinery notes! Ok, no problem. Let’s change the schema!

So, I open my entity class and change my property to:

@Column(length=1000000)
@Lob
private String notes;

By the way, my persistence.xml declares:

<property name="hibernate.hbm2ddl.auto" value="update" />

After an application restart, I’m glad that Hibernate is altering my notes column to a LONGTEXT (it’s enough for me).

So I first try using my application to create a new “long-noted” record and I still the the error “Data too long” although is a LONGTEXT now.

Then, I try doing a raw INSERT from the MySQL command line and it works! I can insert long notes in that field!

Finally, I DROP my local/staging DB schema and change hibernate.hbm2ddl.auto in persistence.xml to create and it works.

Does JPA still think that it’s a VARCHAR? Does it have some sort of cache or some place in which it stores schema’s information?

I can’t drop my production db, obviously. So, what can I do to reset or change the column type?

I am using JBossAS7 JPA 2-Hibernate.

  • 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-12T17:22:16+00:00Added an answer on June 12, 2026 at 5:22 pm

    NOTHING! I ended up with:
    – DB backup
    – hbm2ddl => CREATE-DROP
    – hbm2ddl => UPDATE
    – DB restore

    Crazy! 🙁

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

Sidebar

Related Questions

i have two entities one called User and another called Membership which has a
In one of my entities, I have a protected property called insert_date which is
i am trying to persist two entities(with one to many relationship) using jpa but
I have a case where i have three entities with one-to-many and one-to-many relationships:
I want to create a custom property on one of my entities mapped from
In a project, one of my entities is House which has many enumeration properties
I am using Entity Framework. One of my Entities (MyEntity) has a dependency on
I have a Hibernate entity which has one or more <many-to-one mappings, e.g. <hibernate-mapping>
I have some entities with relationships: component name=Store persistent=true { property name=Products fieldtype=one-to-many cfc=Product;
I have a transformable attribute on one of my entities, called reminder. It's a

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.