维护/自动生成 IBatis SQL 映射?

发布于 2024-08-12 10:42:11 字数 557 浏览 8 评论 0原文

我刚刚开始一份新工作并从地狱继承了这个项目。 Hell = {超出计划2年,过于复杂,同时使用oracle和sql server}

Oracle服务器中有100多个存储过程,每个存储过程都有一个IBatis SQL Map。 有些共享相同的结果图。DBA 喜欢每天更改存储过程而不告诉我。

问题: 是否有任何工具可以检查解决方案中的所有 IBatis SQL 映射。 理想情况下,它会验证:

  1. 存储过程存在
  2. 存储过程参数与参数映射中的参数匹配
  3. 存储过程结果 [列名称] 与结果映射中的匹配
  4. 存储过程结果未缺少结果映射中指定的任何内容
  5. 对象结果图中的属性标题与结果图中列出的属性标题相匹配

背景:我通常只使用 SQL Server 和 SubSonic 2.2 作为 ORM。这样,我只需执行一个命令,我的 DAL 就会神奇地自动生成,这样,如果我需要的列丢失,我会得到一个易于理解的编译时错误,而不是令人困惑的运行时错误。我可以在这里使用类似的工具吗?

感谢您的帮助!

I just started a new job and inherited the project from hell.
Hell = {2 years over schedule, overly complex, uses both oracle and sql server}

There are 100+ stored procedures in the Oracle server and each one has a IBatis SQL Map. Some share the same result map. The DBA likes to change stores procs on a daily basis and not tell me.

Question:
Are there any tools out there that can examine all the IBatis SQL Maps in the solution.
Ideally it would verify:

  1. Store Procedure exists
  2. Store Procedure parameters match the ones in the parameter map
  3. Store Procedure result [column names] match the ones in the result map
  4. Store Procedure result is not missing anything specified on the result map
  5. The object property titles in the result map match the ones listed on the result map

Background: I normally use just SQL Server and SubSonic 2.2 as an ORM. This way I just execute a command and my DAL is magically auto-generated, this way if a column that I need is missing I get a nice easy to understand compile time error and not a confusing run time error. Is there a similar tool I could use here?

thanks for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

强辩 2024-08-19 10:42:11

有一个名为 Ibator 的工具,但我不认为它是为你的目的而设计的描述。我的方法是创建测试来执行 iBatis 代码。这样,当测试失败时,您就知道出了问题。您还可以做的其他事情是使用 Oracle 中的 元数据 来测试过程是否存在等这些检查可能是额外的测试。

There is a tool called Ibator but I don't think it was intended for what you're describing. My approach would be to create tests which exercise the iBatis code. That way, when a test fails you know something is wrong. Something else you can do is use metadata from Oracle to test for the existence of the procedures, etc. These checks could be additional tests.

蒗幽 2024-08-19 10:42:11

自从我接触 Oracle 以来已经有一段时间了,但如果我没记错的话,存储过程的输出(例如,来自 select)没有在任何地方声明。因此,需要通过工具对其进行逆向工程。 LinqToSql 尝试为 SQL Server 做到这一点,并取得了部分成功,但这通常是一个困难且不可靠的过程。因此,这似乎使得列表中的第 3-5 项几乎无法通过代码生成/工具实现。我还没有深入研究 SubSonic 2.2 对存储过程的支持,但我认为它也很难处理第 3-5 项。相反,声明为存储过程一部分的单个输出字段的处理相当简单。

第 1 项和第 1 项2 更容易实现,但我不熟悉 iBatis 周围可用的工具,抱歉。不过,我认为 iBatis 或 Oracle 与您的问题没有太大关系。

最好的选择可能是说服 DBA 提供更多帮助和/或积极运行差异来检测并手动处理存储过程更改。

It's been a while since I've touched Oracle, but if I recall correctly, the output of stored procedures (from a select, for example) is not declared anywhere. Therefore, it would need to be reverse engineerable by a tool. LinqToSql tries to do this, with partial success, for SQL Server, but it's generally a difficult and unreliable process. So, that would seem to make items 3-5 on your list near unachievable with code gen/tooling. I haven't delved too deeply into SubSonic 2.2's support for stored procedures, but I assume it would struggle with items 3-5 as well. In contrast, single output fields declared as part of the stored procedure are fairly straight-forward to deal with.

Items 1 & 2 are much more achievable, but I'm not familiar with the tooling available around iBatis, sorry. I don't think iBatis or Oracle really have much to do with your problem though.

Your best bet may be convincing your DBA to be more helpful and/or aggressively running diffs to detect and manually cope with stored procedure changes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文