How to configure database configuration and mapping in Java file without using hibernate.cfg.xml file?
How to configure database configuration and mapping in Java file without using hibernate.cfg.xml file?
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.
hibernate.cfg.xml is old school – I haven’t used it for years.
Use the javax.persistance annotations and annotate your classes – hibernate does the rest.
Here’s a very basic example:
See this documentation for an explanation of all hibernate annotations.