The beginning of my "Sample" class looks like:
@Entity @SequenceGenerator(name = "sampleSeqGenerator", initialValue = 1, allocationSize = 100) public class Sample implements Serializable { private static final long serialVersionUID = 1L; private String sampleName; @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sampleSeqGenerator") @Id long id;
The id field is as expected when I browse the database: 1,2,3,4 etc.
I would like the field sampleName to be: SPL1, SPL2, SPL3 etc. that makes use of the id.
How do I capture that id without roundtripping?
I see pre and post commit, but pre the id isn't generated yet, and post I would have to somehow resave.