The entity has a generic ID generator,
Entity
@Entity
public class Customer {
@Id
@GenericGenerator(name = "seq_id", strategy = "com.yoncabt.abys.core.listener.CustomGenerator", parameters = { @Parameter(name = "sequence", value = "II_FIRM_DOC_PRM_SEQ") })
@GeneratedValue(generator = "seq_id")
private Long id;
private String name;
private String email;
private String token;
private string filepath;
private String value;
@PrePersist
private void prePersistFunction(){
log.info("PrePersist method called");
filepath = id+".txt";
write value to this file (filetpath)
value = null;
}
...
//getters
//equals and hashcode
}
The file path value gets id as null in this case.
How can I get the value of id in preperists since this is a custom genric generator not by database?
Thanks