Is it possible to use PersistenceContext as annotation for JPA in a normal JAVA class? If not, can you please tell me how to use the PersistenceContext without any annotation?
Share
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.
Yes, you can use @PersistenceContext in any Java class. However, you must specify annotation-config in your Spring configuration, as in the following example:
Once you have that specified, you can use @PersistenceContext as follows: