In Hibernate how do i pass in my own id even though the column is auto increment

时间:2019-03-17 22:32:05

标签: mysql hibernate

I have a mysql table with a id column, it is of type auto_increment. I have a corresponding bean and field has annotation @GeneratedValue(strategy=GenerationType.AUTO)

Sometimes i will set the id value myself. When i set the id in the bean and save it (HibernateManager.currentSession().save(object)), i find that id in the Db is different from what i have set. I looked at the sql generated by hibernate. List of fields in the insert statement does not contain ID. Question is how do i pass in my own id even though the column is auto increment

0 个答案:

没有答案