java - How to make Hibernate convert CLOB to a MySQL type -


In my code, there is a CLOB column in one area of ​​one unit square. It works well with Oracle, but when I try to use MySQL as a database, it looks like the Clip type creates a problem because MySQL does not support CLOB is a console error

13:35:27 Error [Main] org.hibernate.tool.hbm2ddl.SchemaUpdate You have an error in the SQL syntax; Check the manual that matches your message's SQL Server version for the correct code that has the 'CLOB, long message-related text, sender e-mail account varchar (255),' line 7 [main]

To use the Java code snippet:

  @ column (length = 4000) Private string message subject; @column (columnDefinition = "CLOB") private string message body;  

And here is my entity

   & Lt; Property Name = "Data Sources" & gt; & Lt; Bean square = "org.springframework.jndi.JndiObjectFactoryBean" & gt; & Lt; Property Name = "jndiName" value = "jdbc / cggruntime" /> & Lt; / Bean & gt; & Lt; / Property & gt; & Lt; Property Name = "JPAVENDER Adapter" & gt; & Lt; Bean square = "org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" & gt; & Lt; Property Name = "DatabasePlatform" Value = "org.hibernate.dialect.MySQLDialect" /> & Lt; Property Name = "Generated DDL" value = "True" /> & Lt; Property Name = "Show SQL" value = "False" /> & Lt; / Bean & gt; & Lt; / Property & gt; & Lt; Property Name = "JPAP Properties" & gt; & Lt; Theater Content & gt; & Lt; Prop key = "hibernate.hbm2ddl.auto" & gt; Update & lt; / Prop & gt; & Lt; Prop key = "hibernate.show_sql" & gt; False & lt; / Prop & gt; & Lt; Prop key = "hibernate.format_sql" & gt; True & lt; / Prop & gt; & Lt; Prop key = "hibernate.jdbc.batch_size" & gt; 10 & lt; / Prop & gt; & Lt; Prop key = "hibernate.archive.autodetection" & gt; Classroom & lt; / Prop & gt; & Lt ;! - Activate second-order cache for institutions and questions - & gt; & Lt; Prop key = "hibernate.cache.use_second_level_cache" & gt; Wrong & lt; / Prop & gt; & Lt; Key prop = "hibernate.cache.use_query_cache" & gt; False & lt; / Prop & gt; & Lt; / Theater & gt; & Lt; / Property & gt; & Lt; / Bean & gt;  

My question is whether there is a way to configure Hybrnate so that the COB can be automatically converted into other data types, which supports MySQL (like text) ?

Thanks

MySQL absolutely supports CLOB, a Java string MySQL CLOB The correct syntax for converting is as follows:

  @Lob @Column (name = "columnNameForTheMysqlColumnHere") private string message;  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -