Good morning
For a project:
a varchar table column entitled 'description' in the database contains a special token
to specify carriage return,
for example @return@ (customer wishes to not put real carriage return in the database column).
For the interface application views, we need to replace the special tokens @return@ by a carriage return
to display correctly the value extracted from the column table 'description'
We see at least 2 strategies:
- first strategy :
extend the POJO corresponding to the table with column 'description', to modify the accesor method
getDescription(
output = super.getDescription();
replace in string output the @return@ tokens with a viewable value
return output
)
we do not like this strategy because the POJO will be explicitly linked to details about
the database (@return@ token in a column of a table) so less reusable.
- second strategy:
use an hibernate custom mapping type to do the string replacement
when a new POJO is initialised by an insert in the database.
Is the second strategy too exotic for this problem
or should we use an other approach ?
thank you for any advise
F
|