You need to modify the container configuration in jboss.xml and also make changes at the entity level in jbosscmp-jdbc.xml
I am using version based locking (there are other options also like timestamp and modified fields) .
I had to add the foll to each entity which required optimistic locking in jbosscmp-jdbc.xml
In jboss.xml the foll changes to the container configuration
Do I need to create any field on database table?
yes. in my case i created the VERSION_NO field . but if u are using locking strategy based on modified fields then u dont. for version locking and timestamp based locking u will need the field