Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

<a4j:commandButton> Back end bean method is not invoked on click event.

833902Feb 8 2011 — edited Feb 11 2011
I am using below code. It seems back end bean method is not called when I click commandbutton. I think it has some thing to with rendering.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:cdm="http://mportal.com/cdm">
<ui:composition>
<rich:panel>
<a4j:form id="RefreshPropertiesInstanceForm">
<table id="RefreshPropertiesTable" width="100%" border="0">
<tr>
<td width="35%" align="right">
<div class="fieldLabel">Property File Name :<span
class="requiredField">*</span></div>
</td>
<td style="margin-top: 15px; padding-left: 15px" nowrap="nowrap"
align="left"><rich:comboBox id="combo"
value="#{testPropertyRefreshHelper.selectedPropertyFile}"
enableManualInput="false">
<f:selectItems value="#{testPropertyRefreshDetails.propertyFileNameList}" />
<a4j:support event="onchange"
reRender="RefreshPropertiesInstanceForm" BypassUpdates="false"
ajaxSingle="true" action="#{testPropertyRefreshHelper.getPropertyFileContentFromRemoteServer}" />
</rich:comboBox></td>
</tr>
<tr>
<td style="margin-top: 10px; padding-left: 100px" align="left"
colspan="3"><h:inputTextarea id="firstTextArea" value="#{testPropertyRefreshHelper.propertyFileContent}"
rows="21" cols="150"
style="overflow-x: auto; overflow-y: scroll"
rendered="#{testPropertyRefreshHelper.selectedPropertyFile != 'Choose from below'}"
disabled="#{testPropertyRefreshHelper.selectedPropertyFile == 'Choose from below'}">
</h:inputTextarea></td>
</tr>

<tr>
<td style="margin-top: 10px; padding-left: 400px" align="left"
colspan="2">
<a4j:commandButton id='refreshPropertyButton' value="refresh"
image="#{imageManager.imageMap['REFRESH_BUTTON']}"
rendered="#{testPropertyRefreshHelper.selectedPropertyFile != 'Choose from below'}"
action="#{testPropertyRefreshHelper.updatePropertyFileContentInRemoteServer}"
reRender="RefreshPropertiesInstanceForm" >
</a4j:commandButton>
</td>
</tr>
</table>

</a4j:form>
</rich:panel>
</ui:composition>
</html>

Every thing works perfectly. But when I click command button "#{testPropertyRefreshHelper.updatePropertyFileContentInRemoteServer}" backing bean method is not invoked. Other componenets are working properly.
This post has been answered by gimbal2 on Feb 11 2011
Jump to Answer

Comments

L. Fernigrini

The way sequences work, when you use the CACHE option, the first time you use a number for the sequence, Oracle will return the first number to you, it will be incremented by 5000 (in your example) the lates used value on the sequence definition, and will store the 4999 remaining unused numbers in memory (cache).

The next time you ask for a number to the sequence, rather than searching from it on the definition adding one, and saving again the sequence definition, Oracle just return the next available value from the cache, making thing notable quicker.

The "bad" thing is, since those values are in memory, if the instance is shut down (normally or abnormally) those values are lost. That's the expected behavior.

The next time the sequence is used after an instance restart, it will get the value from the definition, add 5000 and save it, return the first one and store the other 4999 in the cache.

Instance shutdown is not something frequent and you should not worry about that, also sequence should be used (my opinion) to create PK (surrogate keys) values that are not shown to final users, so there should be no issues in having some gaps from time to time (the same would happen if you rollback a transaction, the sequence value is lost and gap is generated). Sequences are not gap-less.

jflack

You know that a shutdown and startup will lose cached sequences.  Export and Import can also reload the sequence cache. But why do you care?  Oracle makes clear that values generated by sequences can be generated out of order and can skip numbers.  The only guarantee is that you get a new unique number every time you read NEXTVAL.  Which is perfect for generating surrogate primary keys.  If you care, then DON'T use sequences, but accept the performance hit that you'll take for using any other method for generating sequential values.

Sven W.

L. Fernigrini wrote:

...

The "bad" thing is, since those values are in memory, if the instance is shut down (normally or abnormally) those values are lost. That's the expected behavior.

...

That is not correct.

A normal shutdown, a shutdown transactional and a shutdown immediate will NOT loose the cached sequence values (unless you are in a very old database version like Oracle 7).

Only a SHUTDOWN ABORT will loose the cache.

To the OP: I recently wrote about some further ideas why IDs sometimes are or seems to be lost:

https://svenweller.wordpress.com/2019/08/20/some-quick-facts-about-sequence-caches-and-gaps-in-ids/

The most common reason is when a sequence ages out of the shared pool. You can either keep the sequence pinned in the shared pool or increase your shared pool size.

L. Fernigrini

Well, i kind of remember seeing that on 9i (9.2.0.7), but I may be wrong, I never cared a lot about gaps.

If normal shutdowns save the last used value then the chances of having gaps with sequences is not very common.

I've read you post, it's really interesting, I will test the pin option ASAP

Sven W.

L. Fernigrini wrote:

Well, i kind of remember seeing that on 9i (9.2.0.7), but I may be wrong, I never cared a lot about gaps.

If normal shutdowns save the last used value then the chances of having gaps with sequences is not very common.

I've read you post, it's really interesting, I will test the pin option ASAP

I know the behaviour during shutdown is documented somewhere in detail, but I just looked for 15 min and could not find it.

My point is we should not care about small gaps, but we should care about frequent large gaps.

Those kind of gaps are an indication that something is sub-optimal with our system.

And this is excatly what OP seems to be doing.

-- Edit:

Also I feel he need to add. If you do a normal or transactional shutdown on a RAC, then cached values probably might be lost.

The reason is, that during shutdown the last value needs to be persisted. And in that case I expect that the highest used value from one node is used. Which also means the cached values from the other node will be lost.

Shamed H

Thank you for your reply ... And you are almost to the problem statemnt that I have posted !! The shared pool flush also will reset the CACHE for sequence I have one more , If we provide any GRANT on the seqience to other schema , will that also reset the CACHE ? We did a test on this and we found it is retesting the CACHE , if the first CACHED sequence is used atleast by one. I am not sure this is also a cuase for the sequence GAP

Sven W.
Answer

Shamed H wrote:

Thank you for your reply ... And you are almost to the problem statemnt that I have posted !! The shared pool flush also will reset the CACHE for sequence I have one more , If we provide any GRANT on the seqience to other schema , will that also reset the CACHE ? We did a test on this and we found it is retesting the CACHE , if the first CACHED sequence is used atleast by one. I am not sure this is also a cuase for the sequence GAP

Yes ALTER SYSTEM FLUSH SHARED POOL will also loose the cached values. Are you flushing the shared pool frequently? Why?
I would not expect a GRANT on a sequence to loose the sequence cache. I did NOT test it thou. Can you share how you tested it?

Marked as Answer by Shamed H · Sep 27 2020
Shamed H

Thanks Sven. I was using the Alter command to forward the sequence to some speficif number and then I was granting to other users. I was thinking the grant is making the CACHED lost , but I understand from testing that the ALTER comment is making the cache lose , rather then the grant

Sven W.

Depending on your exact database version here is a nice little (undocumented) trick to reset a sequence:

ALTER SEQUENCE mySeq RESTART START WITH yourNewValue;

This should work in 12.2.0.1 already.

1 - 9
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 11 2011
Added on Feb 8 2011
4 comments
1,782 views