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

  • Home
  • SEARCH
  • 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 585749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:02:07+00:00 2026-05-13T15:02:07+00:00

I have a String in my Entity @Column(length=40000) @Lob private String introText; The column

  • 0

I have a String in my Entity

@Column(length=40000)
@Lob
private String introText;

The column in my MySQL database that Hibernate creates for introText is a varchar(255), which doesn’t jive with the column length or @Lob annotation. Any ideas? I’m relatively new to Hibernate, so I wonder if I’m missing any other settings or configurations.

  • 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-13T15:02:07+00:00Added an answer on May 13, 2026 at 3:02 pm

    After doing the following

    // Notice without @Lob
    @Column(length=4000)
    private String getIntroText() {
        return this.introText;
    }
    

    In script, i see

    IntroText TEXT
    

    So it does not work as expected. So my advice is: use columnDefinition attribute instead

    It allows you to define the exact DDL used to define the column type

    @Lob
    @Column(columnDefinition="TEXT (4000)")
    private String getIntroText() {
        return this.introText;
    }
    

    Now it works fine! You can test if you want

    AnnotationConfiguration configuration = new AnnotationConfiguration();
    
    configuration
        .addAnnotatedClass(<YOUR_ENTITY_GOES_HERE>.class)
        .setProperty(Environment.HBM2DDL_AUTO, "create")
        .setProperty(Environment.USER, "<USER_GOES_HERE>")
        .setProperty(Environment.PASS, "<USER_PASS_GOES_HERE>")
        .setProperty(Environment.SHOW_SQL, "true")
        .setProperty(Environment.FORMAT_SQL, "true")
        // Set up your dialect according to the Target MySQL
        .setProperty(Environment.DIALECT, "org.hibernate.dialect.MySQLDialect")
        .setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver")
        .setProperty(Environment.URL, "jdbc:mysql://127.0.0.1:3306/<YOUR_SCHEMA_GOES_HERE>");
    
    SchemaExport schema = new SchemaExport(configuration);
    schema.setOutputFile("schema.sql");
    
    schema.create(true, true);
    

    Just an advice: if possible, put annotation configuration in getter method instead of member field. Hibernate uses Proxies to do your job. And it works fine when using annotation configuration in getter method.

    regards,

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

Sidebar

Related Questions

I am trying to create an Entity that has a byte[12] id in hibernate.
I have this entity class, the first one I built to test Hibernate, it
Hi I have basically this mapping: @Entity @Table(schema=xas,name=billing) public class Billing implements Serializable{ private
I have a database with the following structure: CREATE TABLE entity ( id SERIAL,
I use Hyperjaxb3 to generate JPA entities from XSD schema. I have a xsd:string
I'm trying to get server-side validation of an Entity Framework String Property to work.
I've been wondering lately. Lets say we're doing a webapp with JSF+Spring+JPA/Hibernate (or well
My object model is given below and would like your inputs on the number
EDIT> i am at a dead end... so i can continue looking for the
Sorry about the title. I do realize it's not very descriptive. :| Here is

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.