首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

Eclipse中hibernate连接informix数据库有关问题

2011-11-29 
Eclipse中hibernate连接informix数据库问题?xmlversion 1.0 encoding GBK ?!DOCTYPEbeansPUBLIC

Eclipse中hibernate连接informix数据库问题
<?xml   version= "1.0 "   encoding= "GBK "?>
<!DOCTYPE   beans   PUBLIC   "-//SPRING//DTD   BEAN//EN "   "http://www.springframework.org/dtd/spring-beans.dtd ">

<beans>
<bean   id= "dataSource "
class= "org.apache.commons.dbcp.BasicDataSource "
destroy-method= "open ">
<property   name= "driverClassName ">
<value> com.informix.jdbc.IfxDriver </value>
</property>
<property   name= "url ">
<value>
jdbc:informix-sqli://sunny:1526/loan_hld:informixServer=ol_sunny;NEWLOACLE=en_us,zh_cn,zh_tw;NEWCODESET=GB2312-80,8859-1,819,Big5
</value>
</property>
<property   name= "username ">
<value> informix </value>
</property>
<property   name= "password ">
<value> informix </value>
</property>
</bean>

<!--   Hibernate   SessionFactory   -->
<bean   id= "sessionFactory "
class= "org.springframework.orm.hibernate3.LocalSessionFactoryBean ">
<property   name= "dataSource ">
<ref   bean= "dataSource "   />
</property>
<property   name= "hibernateProperties ">
<props>
<prop   key= "hibernate.dialect ">
org.hibernate.dialect.InformixDialect
</prop>
<prop   key= "hibernate.show_sql "> true </prop>
</props>
</property>
<!--     OR   mapping   files.   -->
<property   name= "mappingLocations ">
<list>
<value> classpath*:com/git/credit/pojohbm/*.hbm.xml </value>
</list>
</property>
</bean>

<!--通用数据库访问模板设置-->
<bean   id= "gitJdbcTemplate "
class= "com.git.credit.common.GitJdbcTemplateImpl ">
<property   name= "dataSource ">
<ref   bean= "dataSource "   />
</property>
</bean>
<!--事务管理-->
<bean   id= "transactionManager "
class= "org.springframework.orm.hibernate3.HibernateTransactionManager ">
<property   name= "sessionFactory ">
<ref   bean= "sessionFactory "   />
</property>
</bean>

<!--CollectionBorrower组件配置-->
<bean   id= "collectionBorrower "
class= "com.git.credit.collection.hldsql2000.CollectionBorrowerImpl ">
<property   name= "sessionFactory ">
<ref   local= "sessionFactory "   />
</property>
<property   name= "gitJdbcTemplate ">
<ref   local= "gitJdbcTemplate "   />
</property>
</bean>

<bean   id= "collectionBorrowerProxy "
class= "org.springframework.transaction.interceptor.TransactionProxyFactoryBean ">
<property   name= "transactionManager ">
<ref   bean= "transactionManager "   />
</property>
<property   name= "target ">


<ref   local= "collectionBorrower "   />
</property>
<property   name= "transactionAttributes ">
<props>
<prop   key= "* "> PROPAGATION_REQUIRED </prop>
</props>
</property>
</bean>

<!--CollectionCredit组件配置-->
<bean   id= "collectionCredit "
class= "com.git.credit.collection.hldsql2000.CollectionCreditImpl ">
<property   name= "sessionFactory ">
<ref   local= "sessionFactory "   />
</property>
<property   name= "gitJdbcTemplate ">
<ref   local= "gitJdbcTemplate "   />
</property>
</bean>

<bean   id= "collectionCreditProxy "
class= "org.springframework.transaction.interceptor.TransactionProxyFactoryBean ">
<property   name= "transactionManager ">
<ref   bean= "transactionManager "   />
</property>
<property   name= "target ">
<ref   local= "collectionCredit "   />
</property>
<property   name= "transactionAttributes ">
<props>
<prop   key= "* "> PROPAGATION_REQUIRED </prop>
</props>
</property>
</bean>

<!--CollectionMain组件配置-->
<bean   id= "collectionMain "
class= "com.git.credit.collection.hldsql2000.CollectionMainImpl ">
<property   name= "sessionFactory ">
<ref   local= "sessionFactory "   />
</property>
<property   name= "gitJdbcTemplate ">
<ref   local= "gitJdbcTemplate "   />
</property>

<property   name= "collectionBorrower ">
<ref   local= "collectionBorrower "   />
</property>
<property   name= "collectionCredit ">
<ref   local= "collectionCredit "   />
</property>
</bean>

<bean   id= "collectionMainProxy "
class= "org.springframework.transaction.interceptor.TransactionProxyFactoryBean ">
<property   name= "transactionManager ">
<ref   bean= "transactionManager "   />
</property>
<property   name= "target ">
<ref   local= "collectionMain "   />
</property>
<property   name= "transactionAttributes ">
<props>
<prop   key= " "> PROPAGATION_REQUIRED </prop>
</props>
</property>
</bean>

<!--文件生成组件配置-->
<bean   id= "produceMessage "
class= "com.git.credit.producefile.ProduceMessageImpl ">
<property   name= "sessionFactory ">
<ref   local= "sessionFactory "   />
</property>
</bean>
<bean   id= "produceMessageProxy "
class= "org.springframework.transaction.interceptor.TransactionProxyFactoryBean ">
<property   name= "transactionManager ">
<ref   bean= "transactionManager "   />


</property>
<property   name= "target ">
<ref   local= "produceMessage "   />
</property>
<property   name= "transactionAttributes ">
<props>
<prop   key= "* "> PROPAGATION_REQUIRED </prop>
</props>
</property>
</bean>

<bean   id= "produceFile "
class= "com.git.credit.producefile.ProduceFileImpl ">
<property   name= "produceMessage ">
<ref   local= "produceMessageProxy "   />
</property>
</bean>

<!--错误文件管理组件配置-->
<bean   id= "reReportManager "
class= "com.git.credit.rereport.ReReportManagerImpl ">
<property   name= "sessionFactory ">
<ref   local= "sessionFactory "   />
</property>
</bean>
<bean   id= "reReportManagerProxy "
class= "org.springframework.transaction.interceptor.TransactionProxyFactoryBean ">
<property   name= "transactionManager ">
<ref   bean= "transactionManager "   />
</property>
<property   name= "target ">
<ref   local= "reReportManager "   />
</property>
<property   name= "transactionAttributes ">
<props>
<prop   key= "disposeRebuild "> PROPAGATION_REQUIRED </prop>
</props>
</property>
</bean>
</beans>

[解决办法]
以上问题已经解决
[解决办法]
我使用hibernate连接informix的:
配置文件如下:
<property name= "connection.driver_class "> com.informix.jdbc.IfxDriver </property>
<property name= "connection.url "> jdbc:informix-sqli://localhost:1526/rptdb:informixserver=sunlin_informix;NEWCODESET=GBK,8859-1,819 </property>
<property name= "dialect "> com.common.InformixDialectHibernate </property>
<property name= "myeclipse.connection.profile "> yjh1104 </property>
<property name= "connection.username "> informix </property>
<property name= "connection.password "> informix </property>
<property name= "hibernate.show_sql "> true </property>
<property name= "hibernate.jdbc.fetch_size "> 50 </property>
<property name= "hibernate.jdbc.batch_size "> 25 </property>
[解决办法]
我发现hibernate不能正确生成informix的sql语法。
生成的sql中包括left outer join这在informix中是不合法的。
不知道怎么解决
[解决办法]
谢谢楼主啊 我也是eclipse中按ctrl+shift+f导致出错了
[解决办法]
<value> 
jdbc:informix-sqli://sunny:1526/loan_hld:informixServer=ol_sunny;NEWLOACLE=en_us,zh_cn,zh_tw;NEWCODESET=GB2312-80,8859-1,819,Big5 
</value> 
连接字符串要和标签写到一行

热点排行