Guest User

Untitled

a guest
Jan 18th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. /**
  2. * Defines common Id Generator that use PostgreSQL sequences properly.
  3. * It uses a separate sequence for the chosen ID, as opposed to using a single sequence for all IDs;
  4. * the same result can be achieved by simply using {@code @GeneratedValue(strategy = GenerationType.IDENTITY)}, but
  5. * that way hibernate would use a sequence as an identity, which would decrease performance.
  6. * <p>
  7. * Generates a sequence for each entity "entityName_seq"
  8. */
  9. @GenericGenerator(name = "SequencePerEntityGenerator", strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
  10. parameters = @Parameter(name = "prefer_sequence_per_entity", value = "true"))
  11. package com.samkruglov.entities;
Add Comment
Please, Sign In to add comment