Monthly Archives: September 2014

How to map String to TEXT instead of String to VARCHAR(255) (Teneo/Hibernate)

Teneo/Hibernate maps String to VARCHAR(255) per default. If values with sizes of more than 255 characters are expected, this mapping strategy might¬†result in a lot of exceptions. A simple solution ¬†for this is to change the mapping from VARCHAR to TEXT of the EAttribute. Teneo supports such a mapping by looking for a specific annotation value (“@Lob” in “teneo.jpa” annotation).

1. Add an EAnnotation to the EAttribute
2. Set source of the EAnnotation to “teneo.jpa”
3. Add a Details Entry to the EAnnotation
4. Set the key of the Details Entry to “value”
5. Set the value of the Details Entry to “@Lob”
6. Regenerate your model
7. Recreate the database (Teneo will not update the table per default)