2 lansedeshuyue lansedeshuyue 于 2013.07.30 16:58 提问

Hibernate3中,有两个表,从表主键名叫“zhujian” 有一个属性叫“id”

Hibernate3中,有两个表,从表主键名叫“zhujian” 有一个属性叫“id”
报错如下
七月 30 16:02:56 , 602 DEBUG ErrorCounter:68 - throwQueryException() : no errors
七月 30 16:02:56 , 602 DEBUG QueryTranslatorImpl:216 - HQL: select u from com.lucky.bizmodule.lottracking.productsample.bizlogic.model.CSamplecardoutd u ** where u.id ='R13071900046' **

七月 30 16:02:56 , 602 DEBUG QueryTranslatorImpl:217 - SQL: select csamplecar0_.zhujian as zhujian1644_, csamplecar0_.OUTID as OUTID1644_, csamplecar0_.id as id1644_, csamplecar0_.PRODUCTCODE as PRODUCTC4_1644_, csamplecar0_.OLDCODE as OLDCODE1644_, csamplecar0_.DESCRIPTION as DESCRIPT6_1644_, csamplecar0_.CARDTYPE as CARDTYPE1644_, csamplecar0_.COLOR as COLOR1644_, csamplecar0_.COMPOSITION as COMPOSIT9_1644_, csamplecar0_.WIDTH as WIDTH1644_, csamplecar0_.WEIGHT as WEIGHT1644_, csamplecar0_.FABRIC as FABRIC1644_, csamplecar0_.SPECIFICATION as SPECIFI13_1644_, csamplecar0_.DENSITY as DENSITY1644_, csamplecar0_.PRICE as PRICE1644_, csamplecar0_.MONEY as MONEY1644_, csamplecar0_.CURRENCY as CURRENCY1644_, csamplecar0_.LENGTH as LENGTH1644_, csamplecar0_.LASTWEIGHT as LASTWEIGHT1644_, csamplecar0_.WARPSHRINKAGE as WARPSHR20_1644_, csamplecar0_.WEFTSHRINKAGE as WEFTSHR21_1644_, csamplecar0_.WARPSLIP as WARPSLIP1644_, csamplecar0_.WEFTSLIP as WEFTSLIP1644_, csamplecar0_.WARPTEAR as WARPTEAR1644_, csamplecar0_.WEFTTEAR as WEFTTEAR1644_, csamplecar0_.MEMO as MEMO1644_, csamplecar0_.QUANTITY as QUANTITY1644_, csamplecar0_.SPARE1 as SPARE28_1644_, csamplecar0_.SPARE2 as SPARE29_1644_, csamplecar0_.CYLINDERNUM as CYLINDE30_1644_, csamplecar0_.STATUS as STATUS1644_, csamplecar0_.OLDID as OLDID1644_ from LEWEI.C_SAMPLECARDOUTD csamplecar0_ where ** csamplecar0_.zhujian='R13071900046' **

七月 30 16:02:56 , 602 DEBUG ErrorCounter:68 - throwQueryException() : no errors
Hibernate: select csamplecar0_.zhujian as zhujian1644_, csamplecar0_.OUTID as OUTID1644_, csamplecar0_.id as id1644_, csamplecar0_.PRODUCTCODE as PRODUCTC4_1644_, csamplecar0_.OLDCODE as OLDCODE1644_, csamplecar0_.DESCRIPTION as DESCRIPT6_1644_, csamplecar0_.CARDTYPE as CARDTYPE1644_, csamplecar0_.COLOR as COLOR1644_, csamplecar0_.COMPOSITION as COMPOSIT9_1644_, csamplecar0_.WIDTH as WIDTH1644_, csamplecar0_.WEIGHT as WEIGHT1644_, csamplecar0_.FABRIC as FABRIC1644_, csamplecar0_.SPECIFICATION as SPECIFI13_1644_, csamplecar0_.DENSITY as DENSITY1644_, csamplecar0_.PRICE as PRICE1644_, csamplecar0_.MONEY as MONEY1644_, csamplecar0_.CURRENCY as CURRENCY1644_, csamplecar0_.LENGTH as LENGTH1644_, csamplecar0_.LASTWEIGHT as LASTWEIGHT1644_, csamplecar0_.WARPSHRINKAGE as WARPSHR20_1644_, csamplecar0_.WEFTSHRINKAGE as WEFTSHR21_1644_, csamplecar0_.WARPSLIP as WARPSLIP1644_, csamplecar0_.WEFTSLIP as WEFTSLIP1644_, csamplecar0_.WARPTEAR as WARPTEAR1644_, csamplecar0_.WEFTTEAR as WEFTTEAR1644_, csamplecar0_.MEMO as MEMO1644_, csamplecar0_.QUANTITY as QUANTITY1644_, csamplecar0_.SPARE1 as SPARE28_1644_, csamplecar0_.SPARE2 as SPARE29_1644_, csamplecar0_.CYLINDERNUM as CYLINDE30_1644_, csamplecar0_.STATUS as STATUS1644_, csamplecar0_.OLDID as OLDID1644_ from LEWEI.C_SAMPLECARDOUTD csamplecar0_ where csamplecar0_.zhujian='R13071900046'
七月 30 16:02:56 , 602 WARN JDBCExceptionReporter:77 - SQL Error: 1722, SQLState: 42000
七月 30 16:02:56 , 602 ERROR JDBCExceptionReporter:78 - ORA-01722: 无效数字
问题是Hibernate3 自动地把从表中的属性名"id",映射为了从表的主键“zhujian”,从而导致报错
有什么办法解决吗,搞了两天了,还没处理

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!