annotations - Hibernate not creating correct fields for Clobs in MySQL -


I have a string in my unit

  @ column (length = 40000) @ lobe Private string intro text;  

column in my MySQL database that makes hibernate introText is a varchar (255), which does not leap with the column length or @Lob annotation Any ideas? I'm relatively new to hibernate, so I wonder if I can not find any other settings or configuration.

after doing

  // @ lb @ column Without notice (length = 4000) private string getIntroText () {this.introText; }  

In the script, I

  IntroText TEXT  

If it does not work as expected. So my advice is:

  @lob @       

Columns (columnDefinition = "TEXT (4000)") Private string getIntroText () {return this.introText; }

Now it works fine! If you want you can test

  lecture configuration configuration = new interpretation configuration (); Configuration .addAnnotatedClass (& lt; YOUR_ENTITY_GOES_HERE & gt; class) .setProperty (environment. Acbim 2 Deediel_autio, "Create") .setProperty (environmental .USER, "& lt; USER_GOES_HERE & gt;") .setProperty (environmental .PASS, "& Lt; USER_PASS_GOES_HERE & gt;") .setProperty (Environment.SHOW_SQL, "true") .setProperty (Environment.FORMAT_SQL, "true") // Target MySQL .setProperty (Environmental. IDALECT, "org.hibernate.dialect. MySQLDialect "). .setProperty (environment. driver, "com.mysql.jdbc.Driver") .setProperty (Environment.URL, "jdbc: mysql: //127.0.0.1: 3306 / & lt; YOUR_SCHEMA_GOES_HERE & gt;"); Schema Export Schema = New Schemaxport (Configuration); Schema.setOutputFile ("schema.sql"); Schema.create (true, true); Just one advice: If possible, insert the annotation configuration in the gator method instead of the member field. Being in hibernation uses a proxy to do its job 

Regards,

and it works fine when the configuration of the encryption is done using the gateter method.

Comments

Popular posts from this blog

Indexing in SQL -

objective c - iPhone and it's wireless area -

multithreading - Do lock objects in Java need to be static? -