• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Field Size

 
Patrick McDonogh
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there all,

I am storing a large ammount of formatted data i.e. it has html tags in it, etc. In my POJO which is mapped to the database i am storing this information in a java.lang.String. I have this property mapped to the database column using xml i.e. <property name="theProperty" column="column_name"/>

When i persist the object it throws an exception saying that the data in the field is too large for the column.
I have been looking in the hibernate manual for something about this, i thought i may need to specify a different type and length but couldnt find out how to do it.
Does anyone know where i am going wrong.

I am using MySql as the database and know that mysql has datatypes longblob and longtext. How do i tell the mapping file to use these types and what should the value in the pojo be i.e. should it still be java.lang.String?

Therefore, i guess i am asking how to model large amounts of data and how to set explicit database datatypes using the mapping files? If you have a solution and know where this info is in the online hibernate manual could you please let me know where?

Thanks for your help and have a great day.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the Hibernate mapping point of view your property is a String. See this.
 
karthick swami
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This exception occurs when the Database field size mentioned is less than the size of the field i.e to be stored.
The size has to be changed in the DB.Nothing to do with the mapping file.

Regards,
Karthick Swaminathan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic