# Mapping primary key types in liquibase and hibernate

**URL:** <https://forum.liquibase.org/t/mapping-primary-key-types-in-liquibase-and-hibernate/2274>\
**Category:** General Discussion\
**Created:** [May 20, 2013, 1:40pm UTC](https://forum.liquibase.org/t/mapping-primary-key-types-in-liquibase-and-hibernate/2274 "2013-05-20T13:40:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://forum.liquibase.org/u/Guest)\
**Post date:** [May 20, 2013, 1:40pm UTC](https://forum.liquibase.org/t/mapping-primary-key-types-in-liquibase-and-hibernate/2274/1 "2013-05-20T13:40:00Z")

</div>

When I create a table via liquibase I have to use int type. And cannot use long cause it’s not supported:

1. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
2. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
3. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 

Which type should I use when I define an entity? Should it be long or int or something else?

1. @Id
2. &nbsp; &nbsp; private long id;

I’d like to have the same scheme generation script when I invoke liquibase:updateSQL or generate it via hibernate option. But it is not clear to me the mapping issue.

---

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://forum.liquibase.org/u/Guest)\
**Post date:** [May 20, 2013, 1:40pm UTC](https://forum.liquibase.org/t/mapping-primary-key-types-in-liquibase-and-hibernate/2274/2 "2013-05-20T13:40:00Z")

</div>

If I want to use long as type in Java code, I have to use bigint as type in the liquibase. So, the issue is resolved.
