任何人都知道如何在这里解决异常
控制台显示两个异常: - 重度:
(1) org.jooq.exception.DataAccessException: SQL [select dbo.FolderInfo.FolderRSN, dbo.FolderInfo.InfoCode, dbo.FolderInfo.InfoValue, dbo.FolderInfo.InfoValueCrypt, dbo.FolderInfo.InfoValueNumeric, dbo.FolderInfo.DisplayOrder, dbo.FolderInfo.PrintFlag, dbo.FolderInfo.StampDate, dbo.FolderInfo.StampUser, dbo.FolderInfo.InfoValueDateTime, dbo.FolderInfo.Mandatory, dbo.FolderInfo.ValueRequired, dbo.FolderInfo.InfoValueUpper, dbo.FolderInfo.SecurityCode, dbo.FolderInfo.WebDisplayFlag, dbo.ValidInfo.InfoCode, dbo.ValidInfo.InfoDesc, dbo.ValidInfo.ConversionFlag, dbo.ValidInfo.InfoType, dbo.ValidInfo.InfoGroup, dbo.ValidInfo.DisplayFormat, dbo.ValidInfo.InfoGroupDisplayOrder, dbo.ValidInfo.StatisticFolderInfo, dbo.ValidInfo.StatisticPeopleInfo, dbo.ValidInfo.WebDisplayFlag, dbo.ValidInfo.InfoDesc2, dbo.ValidInfo.StampDate, dbo.ValidInfo.StampUser, dbo.ValidInfo.AccessCode, dbo.ValidInfo.WebHelp, dbo.ValidInfo.Comments, dbo.ValidInfo.PickSelectCode, dbo.ValidInfoGroup.InfoGroup, dbo.ValidInfoGroup.AccessCode, dbo.ValidInfoGroup.StampDate, dbo.ValidInfoGroup.StampUser, dbo.ValidInfoGroup.InfoGroup2, dbo.ValidInfoGroup.Comments, dbo.FolderInfo.FolderRSN, dbo.FolderInfo.InfoCode, dbo.FolderInfo.InfoValue, dbo.FolderInfo.InfoValueCrypt, dbo.FolderInfo.InfoValueNumeric, dbo.FolderInfo.DisplayOrder, dbo.FolderInfo.PrintFlag, dbo.FolderInfo.StampDate, dbo.FolderInfo.StampUser, dbo.FolderInfo.InfoValueDateTime, dbo.FolderInfo.Mandatory, dbo.FolderInfo.ValueRequired, dbo.FolderInfo.InfoValueUpper, dbo.FolderInfo.SecurityCode, dbo.FolderInfo.WebDisplayFlag, dbo.ValidInfoGroup.InfoGroup, dbo.ValidInfoGroup.AccessCode, dbo.ValidInfoGroup.StampDate, dbo.ValidInfoGroup.StampUser, dbo.ValidInfoGroup.InfoGroup2, dbo.ValidInfoGroup.Comments from dbo.FolderInfo, dbo.ValidInfo, dbo.ValidInfoGroup join dbo.FolderInfo on dbo.ValidInfo.InfoCode = dbo.FolderInfo.InfoCode left outer join dbo.ValidInfoGroup on dbo.ValidInfoGroup.InfoGroup = dbo.ValidInfo.InfoGroup where dbo.FolderInfo.FolderRSN = ?]; The multi-part identifier "dbo.ValidInfo.InfoCode" could not be bound.
at org.jooq.impl.Utils.translate(Utils.java:1121)
at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:462)
(2)
com.microsoft.sqlserver.jdbc.SQLServerException: The multi-part identifier "dbo.ValidInfo.InfoCode" could not be bound.
>> at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
在转换jooq
之前我在这里编码
dw.setSelect_SELECT(StringUtils.join(getColumns(), ", "));
dw.setSelect_FROM("FolderInfo");
dw.setSelect_FROM("ValidInfo");
dw.setSelect_FROM("ValidInfoGroup");
String where = null;
if (isOracleConnectionCache()) {
where = "ValidInfo.InfoCode = FolderInfo.InfoCode AND ValidInfoGroup.InfoGroup =+ ValidInfo.InfoGroup AND FolderInfo.FolderRSN = ?";
} else {
where = "ValidInfo.InfoCode = FolderInfo.InfoCode AND ValidInfoGroup.InfoGroup =* ValidInfo.InfoGroup AND FolderInfo.FolderRSN = ?";
}
dw.setSelect_WHERE(where);
dw.setSelect_ARG(folderRSN);
但是将代码转换为jooq后
selectQuery.addFrom(FolderInfo.FOLDER_INFO);
selectQuery.addFrom(ValidInfo.VALID_INFO);
selectQuery.addFrom(ValidInfoGroup.VALID_INFO_GROUP);
selectQuery. addJoin(FolderInfo.FOLDER_INFO, ValidInfo.VALID_INFO.INFO_CODE.eq(FolderInfo.FOLDER_INFO.INFO_CODE));
selectQuery.addJoin(ValidInfoGroup.VALID_INFO_GROUP,JoinType.LEFT_OUTER_JOIN,
ValidInfoGroup.VALID_INFO_GROUP.INFO_GROUP.eq(ValidInfo.VALID_INFO.INFO_GROUP));
selectQuery.addConditions(FolderInfo.FOLDER_INFO.FOLDER_RSN.eq(folderRSN));
我的jooq代码在哪行中出错了,我该怎样才能通过 它?
答案 0 :(得分:1)
异常消息就是这个。
The multi-part identifier "dbo.ValidInfo.InfoCode" could not be bound.
通过Google搜索此消息将返回Stack Overflow,其中good answer表示:
您正在将隐式联接与显式联接混合使用。这是允许的,但你需要知道如何正确地做到这一点。
您的查询也是如此。在这里查看更多详细信息:
The multi-part identifier could not be bound
我个人建议永远不要将隐式连接与显式连接混合使用。