If session.connect()
is now deprecated, how am I supposed to do that?
You have to use Session#doWork(Work)
and the Work
API, as mentioned in the Javadoc:
connection()
Deprecated. (scheduled for removal in 4.x). Replacement depends on need; for doing direct JDBC stuff use doWork(org.hibernate.jdbc.Work)
; for opening a 'temporary Session' use (TBD).
You have some time before Hibernate 4.x but, well, using a deprecated API somehow looks like that:
:)
Update: According to RE: [hibernate-dev] Connection proxying on the hibernate-dev list, it seems that the initial intention of the deprecation was to discourage the use of Session#connection()
because it was/is considered as a "bad" API, but it was supposed to stay at that time. I guess they changed their mind...