How to change Serializable to String when use Hibernate

后端 未结 1 1071
伪装坚强ぢ
伪装坚强ぢ 2021-01-20 20:16

I\'m using Hibernate to create entities class from MS SQL. But with NVARCHAR Hibernate changes to Serializable type. It makes some errors, exeptions because conflict between

相关标签:
1条回答
  • 2021-01-20 21:12

    Edit your hibernate.reveng.xml file & add the following entry in the <type-mapping> section of the file:-

    <sql-type jdbc-type="NVARCHAR" hibernate-type="string"/>
    

    When the Hibernate Generation Wizard will generate the classes for you then it uses hibernate.reveng.xml for type conversion. So when the generator encounter NVARCHAR datatype it check for it's equivalent hibernate data type & convert it into String type.

    0 讨论(0)
提交回复
热议问题