I am using SQL server Dialect. I am setting the value using a setter.
p.setEmpApproverEmail(approverEmail.trim()); When I check the value after the values are stored in the database I find space appended to it.
In the database the feild is set to nvarchar(500).
There is nothing in your code or in Hibernate that will do this. However SQL Server does have a frustrating mechanism to support ANSI padding (i.e. 'foo' == 'foo '), it will include a training space on the data inserted into an nvarchar field if you have ANSI_PADDING set to on. In older versions of SQL Server this defaulted to being on by default. Try updating your database properties to make sure ANSI_PADDING is off and see if it fixes it.