How to get the automatically generated field before saving in Hibernate mode


I am using this in my pojo

@Column(name = "uuid")
public String getUuid() {
    return UUID.randomUUID().toString();

Now i have not binded this in jsp form.

Now the problem is i have to send this uuid in the email , when the user fills the form.

But can i get that because in my opinion

1)First i have to save the user detail in database

Session session = sessionFactory.getCurrentSession();;

Now it means i have to again query the databse get the id of person and then get the generated id. won't it waste resources of again querying database.

any easy solution

Can't you pass the UUID to whatever generates the email or store it temporarily with a session attribute?