The new feature for type safe queries generates a metamodel for the classes, but why these fields aren’t final instead of volatile ?
public static volatile SingularAttribute<Presentation, String> topic;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Fields in metamodel class cannot be final, because static final field should be assigned:
This cannot be done, because value that should be assigned is not known to the one that creates metamodel class. Values are assigned by provider when EntityManagerFactory is created.
Consequence is that attributes must be volatile to guarantee that other threads can see values assigned by provider.