Refresh data from table without rebuilding project in adf 12c - oracle12c

I have created a fusion web app in adf 12c and using 12c database.
After building my application, I accidentally delete some rows in table but didn't press commit button. The deleted rows are not showing there but present in database(checked after refresh). I want to refresh data from database either on page refresh/reload or through some command button. How can i do that without rebuilding my application.

Here is how to implement a rollback on an ADF table?
Go to your Datacontrols panel
Open the application module where the View Object of your binded RichTable originate
Go to the Operation folder
Drag and drop the rollback operation as an ADF command button to your JSF page
it will look like this :
<af:commandButton actionListener="#{bindings.Rollback.execute}" text="Rollback" disabled="#{!bindings.Rollback.enabled}" immediate="true" id="cb6">
You can also do it in Java :
appModule.getTransaction.rollback();
This rollback operation will cancel all the modification done to the application module and query the database again for all his View Object.
Read more here : 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).

You need to pick up the executeQuery operation for the View Object that populates your table and drop it on your page as a button. Pressing the button will re-query your DB to fetch the data from there.

Related

Swift/Firebase add only new data [duplicate]

According to Firebase docs:
ChildAdded is triggered once for each existing child and then again every time a new child is added to the specified path
So, I have an app, that has a little banner at the top that pops up every time a user gets a new message. As you could have guessed, these messages are stored in a child in the user object in Firebase. So, here's the problem, when I load the app, it pops up for EVERY message the user has. Is it possible to have this observe event ONLY be called when a new child is added? I don't want it to be triggered for every single existing child, only when a new one is added. I would hate to have to store message references in core data, and do a check for every child to see if it already exists in core data :/
A few ways to do this:
Use ref.queryLimitedToLast(1) when you start. See Firebase, only get new children.
keep track of the most recent key you've got in your local storage and then query with queryOrderByKey().queryStartingAtValue(latestKey)
Add a timestamp to the items and then queryOrderByChild("timestamp").queryStartingAt(now) for items with timestamp >= now. See how to discard initial data in a Firebase DB

Entity Framework - Update database manually

I am new to entity framework and using EF 6.1.1... using code first approach i have generated the database..
When i run my application from Visual Studio in my local machine..
and update a record from my application.. it immediately reflects in ui immediately..
but if i update the records in database manually.. then the changes are not reflected immediately in ui.. i need to rebuild the solution to and run it again to bring the updated data to ui..
Just need to know if this is how entity framework works?? if yes, is there a way to make the ui to sync with database even for manual updates without rebuilding the solution..
Please let me know if you need any other information..

Updating Database model (.edmx) Model First

I am having a few problems with updating the model in EF using Model First.
I have exhausted my efforts with the suggestions of adding migrations (which is normally done using Code First).
The Package Manager Console prints the message
Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel.
I have also tried this suggestion
Updating model in EF Database First project
However nothing happens when i click "Run Custom Tool"
Any suggestions please on how to update the model to reflect the changes that have been added to the database.
Open your model
right click and you will find an option Update Model from database
Click update model from database than a window will open like this:
So choose the modified table to update them in model.

how to change browser history without going to place/ starting activity (gwt)

in my app i have a relative complex activity/place. Resolving the state (from history token to model) on start of activity causes some server interactions.
On user interactions the activity only updates the necessary parts of the model and therefore safes some server interactions - the activity/model has an inner state.
Is there a way to reflect the state in browser history without (re)starting the activity? (History.newItem(token) also causes start of activity)
UPDATE
Chris' solution "nearly" works but another problem rose: in my ui i have a reset-button (a link to the place with empty token). If i click around the ui the token is updated fine but now the reset button doesn't work. gwt thinks it is in the same place and so it ignores the reset click.
Before this the problem was nearly the same: the token and place didn't change and so the reset button didn't work either.
GWT logs this as "Asked to return to the same place"
So is there a way to let gwt restart the activity regardless of place equivalence?
Go to a new place, but have your ActivityMapper return the same activity instance. That way, the activity is not restarted.
You have to find a mean of updating the activity when the place changes from some other mean though (e.g. browser history). See GWT MVP updating Activity state on Place change for instance.
There is a semi-solution, and although I don't want to recommend it, I'd like to add it here - just to warn against the drawbacks of this solution:
You could add tokens to the History without firing an event by calling History.newItem(token, false).
This is a semi-solution, because:
It works correctly (as long as you build your tokens correctly).
A part of the performance problem is also solved: The activity won't be re-started when adding the token to the history.
However, if the user goes back and forward through the history, the performance problem would still be there (because then, the events will be fired again).

doctrine2: explicitly fetching without cache

I use doctrine2.2.2 with Zend Framework1 and am currently working on an editing tool.
A user clicks a link to move someting "up" in the list, my action does its work, changes are made to teh database, i redirect but then the result, newly fetched from the database is still the old version.
I would figure it has to do with cache since i am not temporarily storing the object in the session or anything.
So the Question is: Is there a way to fetch something and tell Doctrine, not to use the cache for this specific request? Or is there a possibility to delete certain cache entries?
Yep, take a look at http://readthedocs.org/docs/doctrine-orm/en/latest/reference/caching.html?highlight=cache#result-cache .
There is a query api to enable, disable, ... result cache for example, individuallty on each query; or globally.