# Auto-incremented primary key

**URL:** <https://discourse.hibernate.org/t/auto-incremented-primary-key/4537>\
**Category:** Hibernate ORM\
**Created:** [September 2, 2020, 2:01pm UTC](https://discourse.hibernate.org/t/auto-incremented-primary-key/4537 "2020-09-02T14:01:36Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![Philippe](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@Philippe](https://discourse.hibernate.org/u/Philippe)\
**Post date:** [September 15, 2020, 7:18am UTC](https://discourse.hibernate.org/t/auto-incremented-primary-key/4537/21 "2020-09-15T07:18:37Z")

</div>

You will/should see nextval as default value for the column “id” in the database :

default value : nextval(‘warehouses\_id\_seq’::regclass)

as the result of the automatic primary key generation thanks to hibernate

---

<div class="post-metadata">

**Author:** ![Philippe](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@Philippe](https://discourse.hibernate.org/u/Philippe)\
**Post date:** [September 17, 2020, 2:07pm UTC](https://discourse.hibernate.org/t/auto-incremented-primary-key/4537/22 "2020-09-17T14:07:56Z")

</div>

I add the line :  
@ColumnDefault(“nextval(‘public.warehouses\_id\_seq’)”);  
to fix the problem  
But I’m quite desapointed, I expected Hibernate to do it automaticaly with the SequenceGenerator…

[Previous page](https://discourse.hibernate.org/t/auto-incremented-primary-key/4537.md?page=1)
