刷新 table 中的数据,而无需在 adf 12c 中重建项目

Refresh data from table without rebuilding project in adf 12c

我在 adf 12c 中创建了一个融合网络应用程序并使用 12c 数据库。 构建我的应用程序后,我不小心删除了 table 中的一些行,但没有按下提交按钮。删除的行没有显示在那里但存在于数据库中(刷新后检查)。我想在 refresh/reload 页或通过某些命令按钮刷新数据库中的数据。我如何在不重建我的应用程序的情况下做到这一点。

这里是如何在 ADF 上实现回滚 table?

  • 转到您的 Datacontrols 面板
  • 打开应用程序模块,您绑定的 RichTable 的视图对象来自该模块
  • 转到操作文件夹
  • 回滚操作 作为 ADF 命令按钮 拖放到您的 JSF 页面

它看起来像这样:

 <af:commandButton actionListener="#{bindings.Rollback.execute}" text="Rollback" disabled="#{!bindings.Rollback.enabled}" immediate="true" id="cb6">

您也可以在 Java 中进行:

 appModule.getTransaction.rollback();

此回滚操作将取消对应用程序模块所做的所有修改,并再次查询数据库以获取他的所有视图对象。

在此处阅读更多内容:https://docs.oracle.com/cd/B14099_19/web.1012/b14022/oracle/jbo/ApplicationModule.html

Transaction

Associated with the root Application Module is the Transaction object, which provides this transaction context. From any (root or nested) Application Module, the user can retrieve the transaction object through a call to getTransaction(). In reality, getTransaction() first locates the root Application Module and then returns the transaction object from it.

The Transaction object manages connection to database and Entity caches. Thus, changes made through one View Object are visible to other View Objects as long as these View Objects all parented by the one root Application Module. In contrast, if two View Objects are parented by two separate root Application Modules, then changes made through the View Object will not be seen by the second View Object until the changes are committed to database through the first root Application Module and the second VO executes query (to retrieve the most up-to-date data from database).

您需要为填充 table 的视图对象选择 executeQuery 操作,并将其作为按钮放在页面上。按下按钮将重新查询您的数据库以从那里获取数据。