1. Hibernate using an instance of javax.sql.DataSource stackoverflow.comIs it possible to configure Hibernate to use a javax.sql.DataSource instance? My application already has an instance of javax.sql.DataSource and I'd rather not re-configure the database url, user, password, driver etc just ... |
2. How 2 create hibernat entitymanger using java.sql.Connection forum.hibernate.org |
3. Get java.sql.Connection from ??? forum.hibernate.orgIf the Session got the connection from a JDBC pool, it will return it on close(), otherwise you can re-use the Connection you passed in with SessionFactory.openSession(myConnection). Don't manually commit() the the Connection. It is possible, but much more convenient to use the Hibernate Transaction API: Session session = sf.openSession(); // Get it from JDBC pool Transaction tx = session.beginTransaction(); // ... |
4. Choosing a Connection dependend on the SQL-command ? forum.hibernate.orgHello, MySQL has a possibility to run in a master/slave replication configuration. That means that there are 2 machine running a database-server-program. One is the master and one the slave. The master should take care of all UPDATE/DELETE/INSERT statements. The slave CAN be used to execute SELECT statements. So reads can be divided between master and slave which could be a ... |
5. should i close sql.Connection explicitly?? forum.hibernate.org |
6. SQL and Hibernate: Where/how do I close the Connection? forum.hibernate.orgHibernate 2 Basically, what I'm trying to do is something like this (this is just an example, please don't read into it beyond the connection issues): Code: //open session from factory Object o = session.find( finderHql ); connection = session.connection(); statement = connection.createStatement(); results = statement.executeQuery( reportSql ); //process report results //close Statement and ResultSet in finally Now I'm here with ... |