Results 1 to 4 of 4

Thread: UUID as Primary Key

  1. #1
    Join Date
    Dec 2011
    Posts
    28

    Question UUID as Primary Key

    Is is possible to have Roo generate a String field which is filled with an UUID as PK instead of the auto-incremented Integers?

  2. #2
    Join Date
    Nov 2011
    Location
    Glasgow, Scotland
    Posts
    18

    Default

    Hi,

    We have done this in our project. We are using Roo, with Hibernate as the persistence provider, and implemented the UUIDs by pushing in the id into our Entity classes, and annotating like this:

    Code:
        @Id
        @GenericGenerator(name = "HibernateUuidGenerator", strategy = "uuid2")
        @GeneratedValue(generator = "HibernateUuidGenerator")
        private String id;
    Andy

  3. #3
    Join Date
    Dec 2011
    Posts
    28

    Default

    Thanks for that piece of information!

    I wonder if it's possible to specify the generator in the roo script? I did not see any option for that. Maybe I should raise a JIRA-Ticket.

    I am about to set up a project with many tables and would prefer to have the right config from start

  4. #4
    Join Date
    Dec 2012
    Posts
    2

    Default

    @yglodt
    I think a JIRA ticket has been raised and declined.
    Just as an FYI.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •