Hi guys, I am having a couple of questions based on Hibernate 4 use.
1. In Hibernate 3, we can get jdbc connection with following code
Code:
ConnectionProvider connectionProvider = ConnectionProviderFactory.newConnectionProvider(properties);
Connection connection = connectionProvider.getConnection();
These classes and apis have been duplicated in Hibernate 4. So the question is how to get the connection in Hibernate 4.
2. Another similar question is how to get a jdbc connection by a given session? In Hibernate 3, it is easy to get a connection by session.connection() method. I know there is a session.doWork() method but it only does things in the execute() method. How can I get the connection and use it outside of the execute() method?
3. When I am modifying some jbpm 3.1.4's source codes to work with Hibernate 4 (originally jbpm 3.1.4 worked with Hibnerate 3), I got this error messag when the jbpm is trying to close its resources:
Code:
No value specified for parameter 2
Can anybody give me some clue where I may get it wrong when modifying the codes? The most important place I have modified should be the method of getting connection. Originally it used session.connection() to get the connection directly but now I am using
Code:
Work work = new Work()
{
public void execute (Connection conn)
{
myConnection = conn;
}
};
session.doWork();
return myConnection;
This way to return a conection outside of execute method should be wrong, but I have not found evidence to confirm if this error is related to this change.
Much appreciated if someone can provide some ideas on how to resolve my issues above.