I am pumping existing JDBC connection using SessionFactory.openSession(Connection)
. Now in 4.0 this method is not available. Which method should I use for this?
You can use SessionFactory.withOptions() and SessionBuilder.connection(Connection connection) .
SessionBuilder connection(Connection connection)
Adds a specific connection to the session options
Parameters : connection - The connection to use.
Returns : this, for method chaining
Example:
SessionBuilder sb = SessionFactory.withOptions();
Session session = sb.connection(connection).openSession();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.