Hi,
I'm using Hibernate2 on PostgreSQL7.2 for the first time (used to use MySQL), and I'm getting a very weird error:
01:33:10,001 INFO Dialect:37 - Using dialect: net.sf.hibernate.dialect.PostgreSQLDialect
01:33:10,005 INFO DriverManagerConnectionProvider:41 - Hibernate connection pool size: 20
01:33:10,008 INFO DriverManagerConnectionProvider:70 - using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost/mafo2?charSet=UNICODE
01:33:10,010 INFO DriverManagerConnectionProvider:71 - connection properties: {user=calle, password=###}
01:33:10,013 INFO SessionFactoryImpl:162 - Use outer join fetching: true
01:33:10,016 DEBUG DriverManagerConnectionProvider:77 - total checked-out connections: 0
01:33:10,019 DEBUG DriverManagerConnectionProvider:90 - opening new JDBC connection
01:33:10,047 DEBUG JDBCExceptionReporter:36 - SQL Exception
java.sql.SQLException:
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:482)
at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:461)
at org.postgresql.jdbc1.AbstractJdbc1Connection.setAutoCommit(AbstractJdbc1Connection.java:961)
at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:95)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:167)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:627)
at de.###.DAOTransaction.<init>(Unknown Source)
[...]
Apparently this happens when DriverManagerConnectionProvider wants to set AutoCommit on the first connection. I don't quite understand why that would be a problem, though. I tried a "manual" JDBC connection to the exact same database URL with the same user and password, and it easily let me set AutoCommit to on and off (not that I would want to use that in a real application ;-)), it even let me do a query there.
But since that works, I am suspecting a problem with Hibernate - I could be completely wrong, of course.
I'm using the following XML to configure Hibernate:
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost/mafo2?charSet=UNICODE</property>
<property name="hibernate.connection.username">calle</property>
<property name="hibernate.connection.password">###</property>
<property name="hibernate.dialect">net.sf.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.show_sql">true</property>
<!-- only some mappings snipped -->
</session-factory>
</hibernate-configuration>
And yes, I tried it with and without the ?charSet=UNICODE parameter ;-)
Any ideas? Do you need any more info?
Thanks
Carl-Eric
|