sed commands useful for hibernate

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s