1

任何人都给我任何想法如何在这里解决异常

控制台同时显示异常:- 严重:

 (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 代码中的哪几行错误,我该如何通过它建立连接?

4

1 回答 1

1

异常消息是这样的。

The multi-part identifier "dbo.ValidInfo.InfoCode" could not be bound.

谷歌搜索此消息将返回 Stack Overflow,其中一个好的答案表明:

您将隐式连接与显式连接混合在一起。这是允许的,但你需要知道如何正确地做到这一点。

您的查询也是如此。在此处查看更多详细信息:

无法绑定多部分标识符

我个人建议永远不要将隐式连接与显式连接混用。

于 2013-09-30T07:46:13.100 回答