Google News
logo
Java Hibernates - Interview Questions
How is SQL query is created in hibernate?
The entity manager interface provides a method called create native career avoid this method returns an implementation of equilibria interface which is same as if you call the create query method to create equity the code to a JPA.
 
Ex :
Call EntityManager.createNativeQuery(String query)method.

Query q=em.createNativeQuery(“SELECT a.firstname,a.lastname”+”FROM Author a”);

Create hibernate.cfg.xml configuration file 

Create Employee.hbm.xml mapping file 

Create Employee.java source file and compile it.

Create ManageEmployee.java source file and compile it.

Execute ManageEmployee binary to run the program.
Advertisement