论坛首页 Java企业应用论坛

hibernate 连接接SQLSERVER解决方案

浏览 2271 次
该帖已经被评为隐藏帖
作者 正文
   发表时间:2009-03-07   最后修改:2009-03-08

今日早上发了个贴子,现在终于有了一套方案,原贴如下:

 

 

DEBUG 2009-03-07 09:49:20,757 | [com.hzjava.xiu.site.web.servlet.MatchAutoServlet]:init | ========MatchAutoServlet启动========
INFO  2009-03-07 09:49:20,835 | [com.hzjava.xiu.site.web.servlet.MatchAutoServlet]:init | ====spring上下文获得成功====
Hibernate: select this_.ID as ID13_0_, this_.NAME as NAME13_0_, this_.KEY_CODE as KEY3_13_0_, this_.price as price13_0_ from ST_SERVICE_PRICE this_
DEBUG 2009-03-07 09:49:20,882 | [com.hzjava.xiu.site.service.ServicePriceServiceImpl]:getSPriceList | 系统服务定价DB同步:3
DEBUG 2009-03-07 09:49:20,882 | [com.hzjava.xiu.site.service.ServicePriceServiceImpl]:getSPriceList | 0.0
DEBUG 2009-03-07 09:49:20,913 | [com.hzjava.xiu.site.web.servlet.MatchAutoServlet$MatchAutoThread]:run | ========系统自动匹配供求信息Start;60*5秒运行一次========
Hibernate: select top 10000 supplyinfo0_.ID as ID6_, supplyinfo0_.userId as userId6_, supplyinfo0_.productId as productId6_, supplyinfo0_.TYPE_ID as TYPE4_6_, supplyinfo0_.billDesc as billDesc6_, supplyinfo0_.kindId as kindId6_, supplyinfo0_.cityId as cityId6_, supplyinfo0_.pic as pic6_, supplyinfo0_.price as price6_, supplyinfo0_.amount as amount6_, supplyinfo0_.yue_lilv as yue11_6_, supplyinfo0_.pubTime as pubTime6_, supplyinfo0_.endTime as endTime6_, supplyinfo0_.IS_Dirty as IS14_6_, supplyinfo0_.O_CONTACT_WAY as O15_6_, supplyinfo0_.qipiaoId as qipiaoId6_, supplyinfo0_.danbiId as danbiId6_, supplyinfo0_.infostateId as infosta18_6_, supplyinfo0_.createTime as createTime6_, supplyinfo0_.releaseTime as release20_6_ from sv_SupplyInfo supplyinfo0_ where 1=1 and supplyinfo0_.infostateId=? and supplyinfo0_.TYPE_ID=? order by supplyinfo0_.ID desc
ERROR 2009-03-07 09:49:20,944 | [org.hibernate.util.JDBCExceptionReporter]:logExceptions | No data found
Exception in thread "Thread-5" org.hibernate.exception.GenericJDBCException: could not execute query
	at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
	at org.hibernate.loader.Loader.doList(Loader.java:2214)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
	at org.hibernate.loader.Loader.list(Loader.java:2090)
	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:388)
	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
	at cn.collin.commons.dao.MyDaoSupport.findByMaxResults(MyDaoSupport.java:274)
	at com.hzjava.xiu.site.dao.SupplyDAOImpl.listByMaxResults(SupplyDAOImpl.java:79)
	at com.hzjava.xiu.site.service.SupplyServiceImpl.newMatchAuto(SupplyServiceImpl.java:169)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at $Proxy5.newMatchAuto(Unknown Source)
	at com.hzjava.xiu.site.web.servlet.MatchAutoServlet$MatchAutoThread.run(MatchAutoServlet.java:57)
Caused by: java.sql.SQLException: No data found
	at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7139)
	at sun.jdbc.odbc.JdbcOdbc.SQLGetDataDouble(JdbcOdbc.java:3658)
	at sun.jdbc.odbc.JdbcOdbcResultSet.getDataDouble(JdbcOdbcResultSet.java:5576)
	at sun.jdbc.odbc.JdbcOdbcResultSet.getLong(JdbcOdbcResultSet.java:632)
	at sun.jdbc.odbc.JdbcOdbcResultSet.getLong(JdbcOdbcResultSet.java:650)
	at org.apache.commons.dbcp.DelegatingResultSet.getLong(DelegatingResultSet.java:240)
	at org.hibernate.type.LongType.get(LongType.java:28)
	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)
	at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
	at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2046)
	at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1371)
	at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1299)
	at org.hibernate.loader.Loader.getRow(Loader.java:1197)
	at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:568)
	at org.hibernate.loader.Loader.doQuery(Loader.java:689)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
	at org.hibernate.loader.Loader.doList(Loader.java:2211)
 

因为一直使用的是Mysql.现在做了个网站因为客户端软件采用C#开发的,所以为了配合软件数据库采用SQLSERVER。而昨天采用jdbc直连的方式没有成功【数据库已连接,但查询不出数据,SP4补丁已打!Jar包已有!】

 

先看看ODBC的配置文件吧

#-----------ODBC------
jdbc.driverClassName=sun.jdbc.odbc.JdbcOdbcDriver
jdbc.url=jdbc:odbc:supply
jdbc.password=123456
jdbc.username=sa

jdbc.initialSize=1
jdbc.maxActive=20
jdbc.maxIdle=10
jdbc.maxWait=120000
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.show_sql=true
hibernate.jdbc.batch_size=20
hibernate.connection.pool_size=20

 这个不用说了,ODBC数据源建了的,ODBC是连接成功了的。

在这一步可以看出:

DEBUG 2009-03-07 09:49:20,882 | [com.hzjava.xiu.site.service.ServicePriceServiceImpl]:getSPriceList | 系统服务定价DB同步:3
DEBUG 2009-03-07 09:49:20,882 | [com.hzjava.xiu.site.service.ServicePriceServiceImpl]:getSPriceList | 0.0

 做DB同步时查询出来的LIST为3!说明连接成功了并且执行错误了。

这个JDBC的错误我看懂了,就是说Hibernate在做ORM的时候,因为我查询的这张表里存在NULL的数据,而HIBERNATE在rs那里采用rs.getLong()等等的时候就报错了。

at sun.jdbc.odbc.JdbcOdbcResultSet.getDataDouble(JdbcOdbcResultSet.java:5576)
	at sun.jdbc.odbc.JdbcOdbcResultSet.getLong(JdbcOdbcResultSet.java:632)
	at sun.jdbc.odbc.JdbcOdbcResultSet.getLong(JdbcOdbcResultSet.java:650)
	at org.apache.commons.dbcp.DelegatingResultSet.getLong(DelegatingResultSet.java:240)
	at org.hibernate.type.LongType.get(LongType.java:28)
	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)

 我的查询语句没有问题,全都是HIBERNATE方言生成,我拿到数据库去执行了一次,能够得出正确的结果。问题就是,

rs.getLong("cityId"),比如cityId这一列在数据库中为NULL,这样的写法就会导致SQL异常么?如果是这样,那Hibernate怎么解决这个问题呢?因为做ORM映射肯定是要每个列都要GET的。。。

 

 

!谢谢!

 

另外JDBC直连的方式DB同步的时候结果为0,查询不出任何数据,任何表都一样。我不知道为什么。。。

SPRING配置文件没有问题的,部分代码

<!-- datasource -->
	<bean id="dataSource"
		class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName">
			<value>${jdbc.driverClassName}</value>
		</property>
		<property name="url">
			<value>${jdbc.url}</value>
		</property>
		<property name="username">
			<value>${jdbc.username}</value>
		</property>
		<property name="password">
			<value>${jdbc.password}</value>
		</property>
		<property name="initialSize">
			<value>${jdbc.initialSize}</value>
		</property>
		<property name="maxActive">
			<value>${jdbc.maxActive}</value>
		</property>
		<property name="maxIdle">
			<value>${jdbc.maxIdle}</value>
		</property>
		<property name="maxWait">
			<value>${jdbc.maxWait}</value>
		</property>
	</bean>

 CONFIG文件:

#-----------SQLSERVER------
jdbc.driverClassName=com.microsoft.jdbc.sqlserver.SQLServerDriver
jdbc.url=jdbc:sqlserver://localhost:1433;databseName=supply?useUnicode=true&characterEncoding=UTF-8&serverTimezone=+00:00&autoReconnect=true&autoReconnectForPools=true
jdbc.password=123456
jdbc.username=sa

jdbc.initialSize=1
jdbc.maxActive=20
jdbc.maxIdle=10
jdbc.maxWait=120000
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.show_sql=true
hibernate.jdbc.batch_size=20
hibernate.connection.pool_size=20

 SP4已打,三个JAR包已有。在线&等!!!感谢!!!

 

以上为上午所发的贴子。。

 

 

晚上逛论坛的收获:

http://www.iteye.com/topic/7407

bluemeteor写道
微软看到这个标题,肯定不高兴了。不过说实话,在商业应用中,很少有公司真正实用微软的那个什么com.microsoft.jdbc.sqlserver.SQLServerDriver。


??? 其实发现微软驱动的不足,也是很偶然的机会。在一次移植应用中,系统报告了[Microsoft][SQLServer JDBC Driver]ResultSet can not re-read row data for column之类的错误。为了解决这个错误,跟踪程序忙了大半天,也没有查出问题所在。只能确定在在rs.getString("XXX")的时候必然会出现错误(rs为ResultSet对象)。那么现在就模拟以下当时的环境:
??? 数据库表:TestTable
??? 表字段及类型:
???????? guid char(38)
???????? title varchar(100)
???????? content Text
???????? username varchar(20)
??? 查询sql语句:
???????? select guid,username,content,title from TestTable where····
??? java代码:
???????? rs.getString("guid");
???????? rs.getBinaryStream("content");
???????? rs.getString("username");
??? -----------------------------------------------------------


??? 上面那段代码,很不荣幸是。使用微软的驱动,必然会报错(就是上面说的那个错误)。如果你跟踪的话,必然是这一行:rs.getString("username")抛出错误。


??? 那么,如果你把rs.getString("username")和rs.getBinaryStream("content");位置互换以下,会怎么样呢。结果就是可以正常运行。


??? 为什么会出现这种情况呢,因为微软的驱动,在包含了blob或clob类型(就是Image和Text类型)的字段。那么就必须按照select顺序查询,且不支持重复查询。


?? 面对这种情况,只有更换驱动了。国外第三方的驱动很多,比如JSQLConnect,JTurbo等等。这些都是商用的,需要付费,不够有试用版本。如果希望有个免费的,可以在www.freetds.com上获取一个免费的(我没有测试过这个免费驱动,不知道是否会存在这种情况)。
?
有关最初的说明,可以参考[javasearch]
http://www.javaresearch.org/article/showarticle.jsp?column=2&thread=4278]
或[javaunion](很遗憾的是,javaunion已经不存在了)
http://www.javaunion.org/bbs/cgi-bin/topic.cgi?forum=1&topic=15516&show=0


??? 其实今天想说的这篇文档真的有些老了。早在曾经的javaunion还存在的时候就谈过这样的问题了。今天突然又贴出来,只是偶然间发现了数据库板块中的 “SQLServer2000 JDBC驱动的完整安装及测试说明”这篇文档。我以为会有些什么值得参考的东东,结果大失所望(文章很适合入门型的参考,从这一点上写的还是可以的)。不过,拿来商业性应用中,就有些幼稚了。
??? 希望大家慎用或尽量不要用微软自带的sqlserver的jdbc驱动。
??? 如果有什么疑问,或有错误地方,请斧正。可以发邮件,相互交流。



作者:银狐999(james999)
信箱:james-fly@vip.sina.com

===============================================
接受blundblade兄弟的建议,补充如下:

(1)如果采用jdbc-odbc驱动,那么就必须按照查询顺序来一次读取(不论有没有image或text类型)
(2)如果采用微软提供的ms sql server jdbc driver,如果查询语句中,不存在image或text类型字段,那么可以按照无序获取
(3)如果采用微软提供的ms sql server jdbc driver,如果查询语句中,存在image或text类型字段,那么就必须按照顺序读取,否则就会报告Driver]ResultSet can not re-read row data for column之类的错误
(4)如果想不查询语句中有没有image或text类型字段,都可以不按照顺序获取,或重复获取。那么就必须更换驱动,改用第三方的。


楼主主要是涉及到两表联立查询了 所以单个查询即可

只是把一条SQL拆成两条了 没办法 B4微软吧

 

Readonly 写道
使用M$默认的driver
需要在connection url后面加上SelectMethod=cursor
可以解决re-read的问题.

但是还是不推荐使用这个性能糟糕的driver,

使用jtds吧, pass all hibernate test case, open source:
http://sourceforge.net/projects/jtds/

 

 

感谢readonly给出的建议,我到jtds的官网浏览并下载了jtds,看了下文档,下面说下我的配置步骤【hibernate测试通过】

 

首先下载jtds,然后将jtds-1.2.2.jar复制到lib目录下,

 

接着-》config.properties:

#-----------SQLSERVER------
jdbc.driverClassName=net.sourceforge.jtds.jdbc.Driver
jdbc.url=jdbc:jtds:sqlserver://ipaddress:1433/supply
jdbc.password=password
jdbc.username=sa

jdbc.initialSize=1
jdbc.maxActive=20
jdbc.maxIdle=10
jdbc.maxWait=120000
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.show_sql=true
hibernate.jdbc.batch_size=20
hibernate.connection.pool_size=20

 密码和ip请根据自己的设置更改。

测试成功,console显示:

 

Hibernate: select banks0_.SUPPLY_ID as SUPPLY3_1_, banks0_.ID as ID1_, banks0_.ID as ID5_0_, banks0_.BANK_ID as BANK2_5_0_, banks0_.SUPPLY_ID as SUPPLY3_5_0_, banks0_.MAIDUAN as MAIDUAN5_0_, banks0_.HUIGOU as HUIGOU5_0_ from st_BANK banks0_ where banks0_.SUPPLY_ID=?
Hibernate: select top 10000 supplyinfo0_.ID as ID6_, supplyinfo0_.userId as userId6_, supplyinfo0_.productId as productId6_, supplyinfo0_.TYPE_ID as TYPE4_6_, supplyinfo0_.billDesc as billDesc6_, supplyinfo0_.kindId as kindId6_, supplyinfo0_.cityId as cityId6_, supplyinfo0_.pic as pic6_, supplyinfo0_.price as price6_, supplyinfo0_.amount as amount6_, supplyinfo0_.yue_lilv as yue11_6_, supplyinfo0_.pubTime as pubTime6_, supplyinfo0_.endTime as endTime6_, supplyinfo0_.IS_Dirty as IS14_6_, supplyinfo0_.O_CONTACT_WAY as O15_6_, supplyinfo0_.qipiaoId as qipiaoId6_, supplyinfo0_.danbiId as danbiId6_, supplyinfo0_.infostateId as infosta18_6_, supplyinfo0_.createTime as createTime6_, supplyinfo0_.releaseTime as release20_6_ from sv_SupplyInfo supplyinfo0_ where 1=1 and supplyinfo0_.TYPE_ID=? and supplyinfo0_.infostateId=? and supplyinfo0_.productId=? and supplyinfo0_.yue_lilv>=? order by supplyinfo0_.ID desc
Hibernate: select banks0_.SUPPLY_ID as SUPPLY3_1_, banks0_.ID as ID1_, banks0_.ID as ID5_0_, banks0_.BANK_ID as BANK2_5_0_, banks0_.SUPPLY_ID as SUPPLY3_5_0_, banks0_.MAIDUAN as MAIDUAN5_0_, banks0_.HUIGOU as HUIGOU5_0_ from st_BANK banks0_ where banks0_.SUPPLY_ID=?
Hibernate: select count(*) as col_0_0_ from ST_MATCH match0_ where 1=1 and match0_.SELL_ID=? and match0_.BUY_ID=?
DEBUG 2009-03-07 23:49:09,375 | [org.hibernate.cache.UpdateTimestampsCache]:preinvalidate | Pre-invalidating space [ST_MATCH]
Hibernate: insert into ST_MATCH (SELL_ID, BUY_ID, STATE_ID, CREATED_TIME) values (?, ?, ?, ?)
DEBUG 2009-03-07 23:49:09,781 | [com.hzjava.xiu.site.service.SupplyServiceImpl]:newMatchAuto | =========共匹配到1信息========
DEBUG 2009-03-07 23:49:09,875 | [org.hibernate.cache.UpdateTimestampsCache]:invalidate | Invalidating space [ST_MATCH], timestamp: 5064462130688000
DEBUG 2009-03-07 23:49:46,812 | [com.hzjava.wibo.site.service.HierInfoService]:findHierInfo | SV_ZX_BOOKING_CHARGE_DAY:id = 15000
DEBUG 2009-03-07 23:49:46,812 | [com.hzjava.wibo.site.service.HierInfoService]:findHierInfo | SV_ZX_BOOKING_CHARGE_DAY:id = 15000
DEBUG 2009-03-07 23:54:09,875 | [com.hzjava.xiu.site.web.servlet.MatchAutoServlet$MatchAutoThread]:run | ========系统自动匹配供求信息Start;60*5秒运行一次========
Hibernate: select top 10000 supplyinfo0_.ID as ID6_, supplyinfo0_.userId as userId6_, supplyinfo0_.productId as productId6_, supplyinfo0_.TYPE_ID as TYPE4_6_, supplyinfo0_.billDesc as billDesc6_, supplyinfo0_.kindId as kindId6_, supplyinfo0_.cityId as cityId6_, supplyinfo0_.pic as pic6_, supplyinfo0_.price as price6_, supplyinfo0_.amount as amount6_, supplyinfo0_.yue_lilv as yue11_6_, supplyinfo0_.pubTime as pubTime6_, supplyinfo0_.endTime as endTime6_, supplyinfo0_.IS_Dirty as IS14_6_, supplyinfo0_.O_CONTACT_WAY as O15_6_, supplyinfo0_.qipiaoId as qipiaoId6_, supplyinfo0_.danbiId as danbiId6_, supplyinfo0_.infostateId as infosta18_6_, supplyinfo0_.createTime as createTime6_, supplyinfo0_.releaseTime as release20_6_ from sv_SupplyInfo supplyinfo0_ where 1=1 and supplyinfo0_.infostateId=? and supplyinfo0_.TYPE_ID=? order by supplyinfo0_.ID desc
Hibernate: select banks0_.SUPPLY_ID as SUPPLY3_1_, banks0_.ID as ID1_, banks0_.ID as ID5_0_, banks0_.BANK_ID as BANK2_5_0_, banks0_.SUPPLY_ID as SUPPLY3_5_0_, banks0_.MAIDUAN as MAIDUAN5_0_, banks0_.HUIGOU as HUIGOU5_0_ from st_BANK banks0_ where banks0_.SUPPLY_ID=?
Hibernate: select top 10000 supplyinfo0_.ID as ID6_, supplyinfo0_.userId as userId6_, supplyinfo0_.productId as productId6_, supplyinfo0_.TYPE_ID as TYPE4_6_, supplyinfo0_.billDesc as billDesc6_, supplyinfo0_.kindId as kindId6_, supplyinfo0_.cityId as cityId6_, supplyinfo0_.pic as pic6_, supplyinfo0_.price as price6_, supplyinfo0_.amount as amount6_, supplyinfo0_.yue_lilv as yue11_6_, supplyinfo0_.pubTime as pubTime6_, supplyinfo0_.endTime as endTime6_, supplyinfo0_.IS_Dirty as IS14_6_, supplyinfo0_.O_CONTACT_WAY as O15_6_, supplyinfo0_.qipiaoId as qipiaoId6_, supplyinfo0_.danbiId as danbiId6_, supplyinfo0_.infostateId as infosta18_6_, supplyinfo0_.createTime as createTime6_, supplyinfo0_.releaseTime as release20_6_ from sv_SupplyInfo supplyinfo0_ where 1=1 and supplyinfo0_.TYPE_ID=? and supplyinfo0_.infostateId=? and supplyinfo0_.productId=? and supplyinfo0_.yue_lilv>=? order by supplyinfo0_.ID desc
Hibernate: select banks0_.SUPPLY_ID as SUPPLY3_1_, banks0_.ID as ID1_, banks0_.ID as ID5_0_, banks0_.BANK_ID as BANK2_5_0_, banks0_.SUPPLY_ID as SUPPLY3_5_0_, banks0_.MAIDUAN as MAIDUAN5_0_, banks0_.HUIGOU as HUIGOU5_0_ from st_BANK banks0_ where banks0_.SUPPLY_ID=?
Hibernate: select count(*) as col_0_0_ from ST_MATCH match0_ where 1=1 and match0_.SELL_ID=? and match0_.BUY_ID=?
DEBUG 2009-03-07 23:54:15,156 | [com.hzjava.xiu.site.service.SupplyServiceImpl]:newMatchAuto | =========匹配结果已存在========
DEBUG 2009-03-07 23:54:15,156 | [com.hzjava.xiu.site.service.SupplyServiceImpl]:newMatchAuto | =========共匹配到0信息========
DEBUG 2009-03-07 23:59:16,250 | [com.hzjava.xiu.site.web.servlet.MatchAutoServlet$MatchAutoThread]:run | ========系统自动匹配供求信息Start;60*5秒运行一次========
Hibernate: select top 10000 supplyinfo0_.ID as ID6_, supplyinfo0_.userId as userId6_, supplyinfo0_.productId as productId6_, supplyinfo0_.TYPE_ID as TYPE4_6_, supplyinfo0_.billDesc as billDesc6_, supplyinfo0_.kindId as kindId6_, supplyinfo0_.cityId as cityId6_, supplyinfo0_.pic as pic6_, supplyinfo0_.price as price6_, supplyinfo0_.amount as amount6_, supplyinfo0_.yue_lilv as yue11_6_, supplyinfo0_.pubTime as pubTime6_, supplyinfo0_.endTime as endTime6_, supplyinfo0_.IS_Dirty as IS14_6_, supplyinfo0_.O_CONTACT_WAY as O15_6_, supplyinfo0_.qipiaoId as qipiaoId6_, supplyinfo0_.danbiId as danbiId6_, supplyinfo0_.infostateId as infosta18_6_, supplyinfo0_.createTime as createTime6_, supplyinfo0_.releaseTime as release20_6_ from sv_SupplyInfo supplyinfo0_ where 1=1 and supplyinfo0_.infostateId=? and supplyinfo0_.TYPE_ID=? order by supplyinfo0_.ID desc
Hibernate: select banks0_.SUPPLY_ID as SUPPLY3_1_, banks0_.ID as ID1_, banks0_.ID as ID5_0_, banks0_.BANK_ID as BANK2_5_0_, banks0_.SUPPLY_ID as SUPPLY3_5_0_, banks0_.MAIDUAN as MAIDUAN5_0_, banks0_.HUIGOU as HUIGOU5_0_ from st_BANK banks0_ where banks0_.SUPPLY_ID=?
Hibernate: select top 10000 supplyinfo0_.ID as ID6_, supplyinfo0_.userId as userId6_, supplyinfo0_.productId as productId6_, supplyinfo0_.TYPE_ID as TYPE4_6_, supplyinfo0_.billDesc as billDesc6_, supplyinfo0_.kindId as kindId6_, supplyinfo0_.cityId as cityId6_, supplyinfo0_.pic as pic6_, supplyinfo0_.price as price6_, supplyinfo0_.amount as amount6_, supplyinfo0_.yue_lilv as yue11_6_, supplyinfo0_.pubTime as pubTime6_, supplyinfo0_.endTime as endTime6_, supplyinfo0_.IS_Dirty as IS14_6_, supplyinfo0_.O_CONTACT_WAY as O15_6_, supplyinfo0_.qipiaoId as qipiaoId6_, supplyinfo0_.danbiId as danbiId6_, supplyinfo0_.infostateId as infosta18_6_, supplyinfo0_.createTime as createTime6_, supplyinfo0_.releaseTime as release20_6_ from sv_SupplyInfo supplyinfo0_ where 1=1 and supplyinfo0_.TYPE_ID=? and supplyinfo0_.infostateId=? and supplyinfo0_.productId=? and supplyinfo0_.yue_lilv>=? order by supplyinfo0_.ID desc
Hibernate: select banks0_.SUPPLY_ID as SUPPLY3_1_, banks0_.ID as ID1_, banks0_.ID as ID5_0_, banks0_.BANK_ID as BANK2_5_0_, banks0_.SUPPLY_ID as SUPPLY3_5_0_, banks0_.MAIDUAN as MAIDUAN5_0_, banks0_.HUIGOU as HUIGOU5_0_ from st_BANK banks0_ where banks0_.SUPPLY_ID=?
Hibernate: select count(*) as col_0_0_ from ST_MATCH match0_ where 1=1 and match0_.SELL_ID=? and match0_.BUY_ID=?
DEBUG 2009-03-07 23:59:16,828 | [com.hzjava.xiu.site.service.SupplyServiceImpl]:newMatchAuto | =========匹配结果已存在========
DEBUG 2009-03-07 23:59:16,828 | [com.hzjava.xiu.site.service.SupplyServiceImpl]:newMatchAuto | =========共匹配到0信息========

 

看来jtds的确是个好东东···呵呵。如果有用的朋友希望可以一起交流。

 

 

最后,如果你觉得本文对你有帮助,请别吝啬您的文字,本人保证以上所有代码都为真实测试,如有遗漏,忘请指正!

论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics