Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

Re : Liquibase handling Default data and then adding data from hibernate in same table gives error

$
0
0
Hello, if i understand,

1 - you added a new user in admin table by a changeset that ran.
2 - After this, you tried to add a new user via your web application in the same table.

At my first read, it seems to be an error in your code.
The error is explicit : You tried to insert a user with a unique id already existing in your table.

- Verify that the PRIMARY_KEY (admin.ID or admin.ADMIN_ID or the column name you chose) has AUTO_INCREMENT setted.
- Verify that you didn't set an ID explicitly in your DAO query which inserts a new user and your changeset that creates the default user. Normally it is automatically generated by mysql.
With AUTO_INCREMENT you don't need to specify explicitly this column and value in your insert query.

- Verify the annotation or strategy generation of your id attribute in your entity Admin :
@Id @GeneratedValue(strategy=GenerationType.AUTO)
or
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)

Hoping that it helped you.
Regards

Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>