fix issues for hibernate SQLGrammarException
fix issues for unique index