Custom Id Generators For Typed Id Values With Hibernate
OK, so you have your strongly typed values, but how can you generate them so they can be used as a numeric primary key?
Assuming you set up your typed ids as in: Using Typed Id Values With Hibernate, you don't have to do much to make them from sequences.
This example uses oracle sequences, but I'm sure the method applies to other stuff too.
Annotate your class to use custom sequence generator
This uses the hibernate-specific @GenericGenerator annotation.
Implement your sequence generator
Just delegate to the original implementation to get the number, then strongly type it.