---
title: "How to generate a UUID column with JDL and JHipster"
date: 2020-05-23T00:00:00+00:00
author: "poornerd"
tags: ["java", "jhipster"]
canonical: https://www.poornerd.com/2020/05/23/creating-uuid-columns-with-jhipster-jdl.html
source: Raw Markdown twin of the HTML article; content is the original source.
---
Not satisified with the standard autoincrement implementation of the default ID columns with the [JHipster](https://www.jhipster.tech/) generator, I did some digging to see what was possible.

I got a tip in the JHipster issues comments on Github, that I could create my own column (not named ID) with the UUID type. This is what I was trying for the ID : ```id UUID```

![JHipster JDL UUID](/images/posts/JHipster-UUID.png){:class="img-fluid w-100"}

Unfortunatly it seems that Julien Dubois (one of the primary JHipster contributors) is against having ID columns be UUID's (or strings/varchar/blobs) because of performance and efficiency reasons, so all feature requests in this direction have been closed.

So instead the recommendation was to leave the ```id``` and create an additional ```uuid``` column (with the type UUID).  While this might work in some cases, I really want the UUID to be the primary key.

I still have a few more tips to try, like:
- just modify the generated code myself (not so great if I want to iterate)
- use the [Jhipster Generator DB Helper Blueprint](https://www.npmjs.com/package/generator-jhipster-db-helper) to rename the ID and possibly the type (but I could not get this working with JHipster 6.9.0)
- use the [JHipster Postgres UUID Converter Blueprint](https://github.com/amitjindal/generator-jhipster-postgresuuid-converter) (but I am not using postgres)
- wait for a new, proposed feature for compound indexes

I'll report back if I discover more. In the mean time you can at least used the UUID column.
