I have the data.sql as per below (500+ for testing purpose):
INSERT INTO app_user (id, useruuid, useremail ) VALUES ('1', '863db606-9af6-48a8-963a-07b9fe0fc4fc', 'user1@mydomain.com');
And I have the below in my Entity for uuid:
@NotEmpty
@Column(name = "useruuid")
@GenericGenerator(name = "uuid", strategy = "uuid4")
private String useruuid;
When the project starts I get my "hard-coded" uuid populated in DB. No issues here.
Question: Without using @PostConstuct, how can I autopopulate just by using data.sql? Any approach for this? so that my data.sql will look like this - INSERT INTO app_user (id, useremail ) VALUES ('1', 'user1@mydomain.com');
and UUID (random) should get populated when the project loads and starts in dev environment. To summarize, how can I avoid hard-coding UUIDs in my data.sql file? I dont want to use @PostConstruct as I want keep code and sample-data separate. Also for testing purpose, I will just restart the application and will get new UUIDs everytime. Any relevant links/info will be greatly appreciated.