Change entitymanager to hibernate session in java

Monday, April 3rd, 2017 (0 Comment)

We have some projects use Entitymanager or SessionFactory of hibernate on Spring mvc or others, we need to change entitymanager to hibernate session to execute some statement sql insert/update/delete.

In this article, we will focus on change entitymanager to hibernate session, it will help us manage connection database more easily.

1) Change entitymanager to hibernate session to execute sql statement by java.sql.Connection

We need to use Hibernate library or use maven.

 

Declare SqlExecute class implements Work class of org.hibernate.jdbc package.

Run SqlExecute class

2) Change entitymanager to hibernate session to get list objects by sql query

Declare SqlStatement class implements Work class of org.hibernate.jdbc package.

Run SqlStatement class

Tags: , , , ,

Related Posts

core java
Export Crystal Report with Subreport in java
core java
Convert xml to object java and vice versa
core java
Java basic tutorial on lvtutorial.com
core java
Java hibernate manytomany to manage user role

Related Posts

core java
Export Crystal Report with Subreport in java
core java
Convert xml to object java and vice versa
core java
Java basic tutorial on lvtutorial.com
core java
Java hibernate manytomany to manage user role

Leave a Reply

Your email address will not be published. Required fields are marked *