v8.2p_2012-08-26/Pro Deployment (built 2012-08-26)
Hibernate 3.6.1
Spring 3.1.2
What i am trying to do is to make smartgwt buildinds example work with hibernate through spring.
things are quite simple:
web.xml
applicationContext-resources.xml
jdbc.properties
applicationContext-dao.xml
and in server.properties
hibernate.cfg.xml itself contains no confiuration, it's going to hold references to hibernate beans.
As the result in the log file i see 2 consecutive Hibernate initializations, 1- success, 2 - failure:
What am i doing wrong or what smartGwt doing wrong? Thx in advance.
Full log file is attached (RENAME TXT TO ZIP, i was not able to upload 90kb txt or .zip).
2. And small question in addtition:
Am i getting it right from some old forum posts about old versions, that it's not possible to force build-in hibernate datasource to work with sping session factory and transaction management and it only reads configuration from provided spring bean? Or things changed nowadays?
Hibernate 3.6.1
Spring 3.1.2
What i am trying to do is to make smartgwt buildinds example work with hibernate through spring.
things are quite simple:
web.xml
Code:
<context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:/applicationContext-resources.xml classpath:/applicationContext-dao.xml ... </param-value> </context-param>
Code:
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="ignoreUnresolvablePlaceholders" value="true"/> <property name="locations"> <list> <value>classpath:jdbc.properties</value> </list> </property> </bean> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${jdbc.driverClassName}"/> <property name="url" value="${jdbc.url}"/> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> <property name="maxActive" value="100"/> <property name="maxWait" value="1000"/> <property name="poolPreparedStatements" value="true"/> <property name="defaultAutoCommit" value="true"/> </bean>
Code:
jdbc.driverClassName=net.sourceforge.jtds.jdbc.Driver jdbc.url=jdbc:jtds:sqlserver://172.16.0.16:1433/system jdbc.username=sa jdbc.password=555 hibernate.dialect=org.hibernate.dialect.SQLServerDialect
Code:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="configLocation" value="classpath:hibernate.cfg.xml"/> <property name="hibernateProperties"> <value> hibernate.dialect=${hibernate.dialect} hibernate.jdbc.use_streams_for_binary=true hibernate.jdbc.use_streams_for_binary=0 </value> </property> </bean>
Code:
hibernate.config.lookupStyle: spring hibernate.config.bean: sessionFactory
As the result in the log file i see 2 consecutive Hibernate initializations, 1- success, 2 - failure:
Code:
INFO Dialect - Using dialect: org.hibernate.dialect.SQLServerDialect .... DEBUG SessionFactoryObjectFactory - initializing class SessionFactoryObjectFactory DEBUG SessionFactoryObjectFactory - registered: a1e116cf-7d6d-46d4-b7f9-a55508e1c7e2 (unnamed) .... ERROR DataSourceLoader - Exception while attempting to load a DataSource org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection available
Full log file is attached (RENAME TXT TO ZIP, i was not able to upload 90kb txt or .zip).
2. And small question in addtition:
Am i getting it right from some old forum posts about old versions, that it's not possible to force build-in hibernate datasource to work with sping session factory and transaction management and it only reads configuration from provided spring bean? Or things changed nowadays?
Comment