l-Satz

sed commands useful for hibernate

Posted by: sathyz on: May 26, 2009

After generating hibernate files using ant tasks the column names and table names has to be edited.

say generated code

This has to be edited as,

I use the following sed commands to do this.


sed -i 's|table="\([a-zA-Z_]*\)"|table="\"\1\""|g' table.hbm.xml
sed -i 's|column name="\([a-zA-Z_]*\)"|column name="\"\1\""|g' table.hbl.xml
sed -i 's|schema="\([a-zA-Z_]*\)"|column name="\"\1\""|g' table.hbm.xml

Leave a Reply