Database call fired twice when using actionListener in dataTable
Hi all,
I have a question regarding the request bean lifecylce in the current use case (using Sun JSF 1.2)
I have a managed bean in request scope that contains an ArrayList which is used as the data provider in a dataTable on a faces page.
The bean contains an init() method to populate the ArrayList using a database call.
The dataTable also contains a column with a commandLink that calls a method via actionListener inside the managed bean to delete the current row.
When I click the link the action gets called and deletes the row from the database. I also reload the data from the database and assign it to my ArrayList.
However, the init Method is also called before the action is executed. So the database call is fired twice when hitting the link:
- First time in the init() method of the bean
- Second time in the actionListener method when reloading the data
I can not remove the call from the actionListener, because the data has not deleted yet.
Question:*
How can I make sure the database call is fired once only? (and also making sure the ArrayList is populated appropriate)
Maybe I am doing something wrong here? Thanks in advance for any help.
Maik
This is the request scope bean:
public class UserBean implements Serializable {
private List all;
private Long userId = null;
@PostConstruct
public void init() {
if(all == null) {
new ArrayList();
loadUserList();
* Constructor
public UserBean() {
super();
* @return the userId
public Long getUserId() {
return userId;
* @param userId
* the userId to set
public void setUserId(Long userId) {
this.userId = userId;
* @param all
* the all to set
public void setAll(List all) {
this.all = all;
public List getAll() throws GeneralModelException {
return all;
public void loadUserList() {
EntityManager em = Contexts.getEntityManager();
Query q = em.createNamedQuery("user.findAll");
all = q.getResultList();
public void deleteAction(ActionEvent ae) {
EntityManager em = Contexts.getEntityManager();
Query q = em.createNamedQuery("user.byId");
q.setParameter("id", userId);
try {
User user = (User) q.getSingleResult();
if (user != null) {
em.remove(user);
loadUserList();
} catch (NoResultException e) {
// TODO
}
No, I do not call the init() method.
Basically the init() is called before the deleteAction() so the ArrayList still contains the old value, unless a second database call is triggered after the entity has been deleted.
Maybe I am missing something here...
See also here (JSF 1.2 RI - Bean Instantiation and Annotation)
[http://weblogs.java.net/blog/jhook/archive/2007/05/jsf_12_ri_backi.html]
Here is the init() call stack trace
Daemon Thread [http-8080-2] (Suspended (breakpoint at line 32 in UserBean))
UserBean.init() line: 32
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available
Method.invoke(Object, Object...) line: not available
DefaultAnnotationProcessor.postConstruct(Object) line: 79
Tomcat6InjectionProvider.invokePostConstruct(Object) line: 118
ManagedBeanBuilder(BeanBuilder).invokePostConstruct(Object, InjectionProvider) line: 223
ManagedBeanBuilder(BeanBuilder).build(InjectionProvider, FacesContext) line: 108
BeanManager.createAndPush(String, BeanBuilder, ELUtils$Scope, FacesContext) line: 368
BeanManager.create(String, FacesContext) line: 230
ManagedBeanELResolver.getValue(ELContext, Object, Object) line: 88
FacesCompositeELResolver(CompositeELResolver).getValue(ELContext, Object, Object) line: 53
FacesCompositeELResolver.getValue(ELContext, Object, Object) line: 72
AstIdentifier.getValue(EvaluationContext) line: 61
AstValue.getTarget(EvaluationContext) line: 59
AstValue.setValue(EvaluationContext, Object) line: 129
ValueExpressionImpl.setValue(ELContext, Object) line: 249
JspValueExpression.setValue(ELContext, Object) line: 85
RestoreViewPhase.doPerComponentActions(FacesContext, UIComponent) line: 240
RestoreViewPhase.doPerComponentActions(FacesContext, UIComponent) line: 245
RestoreViewPhase.doPerComponentActions(FacesContext, UIComponent) line: 245
RestoreViewPhase.execute(FacesContext) line: 195
RestoreViewPhase(Phase).doPhase(FacesContext, Lifecycle, ListIterator<PhaseListener>) line: 100
RestoreViewPhase.doPhase(FacesContext, Lifecycle, ListIterator<PhaseListener>) line: 104
LifecycleImpl.execute(FacesContext) line: 118
FacesServlet.service(ServletRequest, ServletResponse) line: 265
Similar Messages
-
Removing or automatic fill the database field at login when using TWO_TASK
Couple of questions when using TWO_TASK on HP-UX
1. Is it possible to alter the login window, by removing the database field, as it is not needed anymore?
2. Is it possible to automatically fill the login window with the required database connect string?Hello,
Are you sure this question is relative to the Oracle Forms product ?
Francois -
Why do I get a "call ended" alert after voice directions, when using Googles Maps App with my iPhone 5s paired to Bluetooth service in my GM auto
Hello Snosilla! I'm so sorry for all the confusion and for all the time taken to activate service with us! I do see that the iPhone 5c is $99.99 right now. The iPhone 5s is actually $199.99. There's no need to call Pam anymore, we can take over from here.
I've followed you in the forums. Please accept me, and follow me back. Then, send me a Direct Message and I can look into this for you. If you do not have an active line yet, I may need to get you through to our activations department, but I will do all I can!
Thank you!
ChristinaB_VZW
VZW Support
Follow us on Twitter @VZWSupport
VZW Support -
Network or database calls are made when joining more than one table
Hi Friends,
could anybody please let me know how may networks are called when joining more than one table.
Thanks
RinkyHi Rinky,
Normally when a JOIN between two database tables is made then following steps occur:-
1) The control goes to database. Based on the JOINING and WHERE condition, an internal table is created in the DATABASE only which is filled. So here the computation is done at DATABASE level.
2) Once the internal table is filled at database level, it is sent back to the application level.
A Join operation normally minimizes the round trips to the database as most of the computation is done at database level only and results sent back to the Application layer.
<b>Thus for a simple JOIN OPERATION makes a single DATABASE call.</b>
NOTE: If you are satisfied with the explanation, then please reward points
accordingly :).
Thanks and regards,
Ravi . -
Calendar Conference Call stripping leading # when using join now
When a meeting invitation is scheduled in Outlook and the location is setup with a conference bridge phone number and conference passcode, the leading # required by our bridge is stripped.
Example 1-888-555-5555 passcode p #123456# entered into outlook will dial as 1-888-555-5555 p123456# when using the join now option
Solved!
Go to Solution.Hello,
Can you please provide the software OS and release you are running?
I tested this by setting up a meeting with the dial in as
1-888-555-5555 p #123456#
I was able to reproduce what you are seeing.
When selecting to join now 1-888-555-5555p#123456# was dialed.
Did someone help you? Click Like! Did a post solve your issue? Click Accept as Solution! -
Initialize event happens twice when using setDynamic
Hi.
I'm using WD Java, EP 7 SP 14 and Designer 8.
I have a form with a table, and in the initialize event I add a row to the table using the addInstance() method.
I also set the document to be dynamic using the setDynamic method of the class IWDPDFDocumentInteractiveFormContext, in the method wdDoModifyView.
Then, when I run the form, there are 2 rows added to the table.
But when I don't use the setDynamic method, only one row is added (as it should be).
Is there a chance that using the setDynamic method calls the Initialize event twice?
I'll be thankful if anyone can try this, so I would know if that's a general problem, or if it happens only to me.
Best regards,
Udi.Hi Udi,
I donu2019t think the setDynamic() method would trigger the initialize event (I could be wrong though). The case could be that your Initialize code is only getting triggered when you use the setDynamic() method, and the One table row is always there by default!
Try putting some code in your initialize method for debugging:
xfa.host.messageBox("initializing form...");
See how many times this message pops up!
Just a suggestionu2026
Hope this helps,
Harman -
Open File Dialog appears TWICE when using servlet to download an attachment
Hi,
This is KILLING me!!! Please HELP.....
I am using a servlet to download an xml file, which I build on the fly based on user interaction.
The open file dialog appears nicely and I hit open. The dialog pops up again immediately and I have to click open again in order to open the file.
This works fine when file extension is txt and I DONOT have to click twice. Here is the code:
String xmlString = getXMLString(); //builds xml
String fileName = "myFile.xml";
response.setContentType("application/x-download");
response.setHeader("Content-disposition", "attachment;filename=" +fileName);
PrintWriter out = response.getWriter();
out.print(xmlString);
out.flush();
I am using IE6.0 sp2http://forums.java.sun.com/thread.jspa?threadID=596940&tstart=20
-
Call Rejected error when Using CTI Port to call out
Hello,
I am using Cisco Call Recording feature that is enabled on a phone that has a CTI Port and number assigned to invoke a call recording session to dial out a Long Distance number. I used JTAPI tool to invoke a call and then used the CTI that was invoked by the BIB to dial a long distance number. The call leaves the phone and gets to the gateway (MGCP) with 2 T1 Pri's and in the debug I see this error:
KNOW Good call:
001679: *Sep 20 14:39:53.005: ISDN Se0/0/0:23 Q931: RX <- SETUP pd = 8 callref = 0x5069
Bearer Capability i = 0x8090A2
Standard = CCITT
Transfer Capability = Speech
Transfer Mode = Circuit
Transfer Rate = 64 kbit/s
Channel ID i = 0xA18395
Preferred, Channel 21
Facility i = 0x9F8B0100A1080201010201008400
Protocol Profile = Networking Extensions
0xA1080201010201008400
Component = Invoke component
Invoke Id = 1
Operation = CallingName
Name not available
Calling Party Number i = 0x0080, 'XXXXXXXXX'
Plan:Unknown, Type:Unknown
Called Party Number i = 0x80, 'XXXXXXXXXX'
Plan:Unknown, Type:Unknown
001680: *Sep 20 14:39:53.009: ISDN Se0/0/0:23 Q931: TX -> RELEASE_COMP pd = 8 callref = 0xD069
Cause i = 0x8081 - Unallocated/unassigned number
001681: *Sep 20 14:39:53.097: ISDN Se0/0/0:23 Q931: RX <- SETUP pd = 8 callref = 0x506A
FAILED Call:
001685: *Sep 20 14:39:56.509: ISDN Se0/0/0:23 Q931: TX -> SETUP pd = 8 callref = 0x1DA8
Bearer Capability i = 0x8090A2
Standard = CCITT
Transfer Capability = Speech
Transfer Mode = Circuit
Transfer Rate = 64 kbit/s
Channel ID i = 0xA98384
Exclusive, Channel 4
Calling Party Number i = 0x0183, '2678'
Plan:ISDN, Type:Unknown
Called Party Number i = 0x80, 'XXXXXXXXXXX'
Plan:Unknown, Type:Unknown
001686: *Sep 20 14:39:56.537: ISDN Se0/0/0:23 Q931: RX <- CALL_PROC pd = 8 callref = 0x9DA8
Channel ID i = 0xA98384
Exclusive, Channel 4
001687: *Sep 20 14:39:56.557: ISDN Se0/0/0:23 Q931: RX <- DISCONNECT pd = 8 callref = 0x9DA8
Cause i = 0x8295 - Call rejected
001688: *Sep 20 14:39:56.585: ISDN Se0/0/0:23 Q931: TX -> RELEASE pd = 8 callref = 0x1DA8
001689: *Sep 20 14:39:56.593: ISDN Se0/0/0:23 Q931: RX <- RELEASE_COMP pd = 8 callref = 0x9DA8
001690: *Sep 20 14:40:07.001: ISDN Se0/0/1:23 Q931: RX <- SETUP pd = 8 callref = 0x4200
Anyhelp appreciated.Hi,
I have looked into the issue. If you are trying to create the BP with general role 000000, i think it might not be possible via LSMW.
The error message is correct, because role 000000 is indeed not relevant for update because if you can see in the customising Tx BUSD, 'FLAG - Do not update' will be active. This is the reason why you are getting the error message of 'No update is defined for the role 000000'.
When you insert a partner in role "000000 General Business Partner",the error message "BP role cannot be updated" will be returned. This error message is very specific for this issue. You can create BP in different roles apart from the general role.
Indeed if you try to change the 'Do not update' flag to inactive state and process the LSMW project you will be able to create the BP but it is strictly not recommended.
This role is a technical role which exists for the creation of BP, and immediately you will fall back to other roles available for the partner.
So i feel you need to change the role before you create BP with this role via LSMW.
I hope this helps.
Regards,
Venkat -
Need to select link twice when using Browser back button
I see that my command_link works fine in normal scenarios.
But when I come to that page using browser back button and then select the link within the page.... the first time, looks like its regenerating the page and only when I select the link second time it is calling the action listener associated with the link.
Any clue as to how to fix this problem?
Thanksuse the following lines in your web.xml to avoid this bug of the current jsf-ri version.
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>I already tried to report this bug some time ago:
http://forum.java.sun.com/thread.jsp?forum=427&thread=478928&tstart=180&trange=15 -
Dear All,
I am using Cisco Unified CM Administration 9.1.1 and MOBILITY works fine.
However when somebody calls from external phone number into internal user number and MOBILITY option is ON and obviously, forwards the call for the user's cell.....in this case user can see only main company number, but not a caller number.
So, is there any option to change it?
Thank youGo to the GW and run some debugs to find out exactly what you're sending, chances are, your telco is overwriting the original called number as it's nor part of your DID range.
HTH
java
if this helps, please rate
www.cisco.com/go/pdihelpdesk -
Word attaching document twice when using File Save & Send
When a users chooses File - Save & Send - Send As Attachment, the attachment appears twice on the email. This has happened with several users here at the firm. Has anyone experienced this? Any help would be greatly appreciated. FYI
- recreating the Outlook profile does not fix the issue.Hi,
First, please try to test this issue with an Excel worksheet (via File - Save & Send - Send As Attachment) and check if you can reproduce it.
In addition, please temporarily turn off your antivirus software and make sure it is not integrated with Outlook, then open Outlook in safe mode to check if the problem persists. To open Outlook in safe mode, press Windows key + R to open the Run command,
type outlook.exe /safe and press Enter.
Please let me know the result.
Best Regards,
Steve Fan
TechNet Community Support -
Swfobject 2.2 in FireFox displays swf twice when using alternate content
I have built a Flash site and also set it up with alternate content so it can be viewed on iPhone and iPad as well as other mobile devices. It works great everywhere but in FireFox the site's swf loads on the page twice.
Has anyone else experienced this issue and if so, what have you done to work around this FireFox bug?
You can view the url that I'm using to test at http://www.turntwomedia.com/index-altContent.htmlCheck out this post -
http://support.mozilla.com/en-US/questions/669348 -
Problem with function call from sql when using distinct
I have the following problem.
SELECT DISTINCT colA from tabA where my_function(colB) = 'TRUE'
This statement will return a handfull of results from a table with 70k + records. The function takes about 0.5 secs to execute.
How do i force the optimizer to do the select distinct first then execute the function on the results rather than execute the function for every single line first?
Thanks in advance
KeithLet's compare some of those methods:
michaels> CREATE OR REPLACE FUNCTION my_function (tr VARCHAR2)
RETURN VARCHAR2
AS
BEGIN
DBMS_APPLICATION_INFO.set_client_info (SYS_CONTEXT ('userenv','client_info') + 1);
IF LOWER (tr) LIKE '%name%'
THEN
RETURN 'TRUE';
ELSE
RETURN 'FALSE';
END IF;
END my_function;
Function created.
michaels> CREATE TABLE taba AS SELECT object_id cola ,object_name colb FROM all_arguments
Table created.
michaels> SELECT COUNT(*) FROM taba
COUNT(*)
78786
michaels> EXEC dbms_application_info.set_client_info(0)
michaels> SELECT DISTINCT colA from tabA where my_function(colB) = 'TRUE'
167 rows selected.
michaels> SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
CI
78786
michaels> EXEC dbms_application_info.set_client_info(0)
michaels> SELECT DISTINCT cola FROM (SELECT ROWNUM r, t.* FROM (SELECT DISTINCT cola, colb FROM taba) t)
WHERE my_function (colb) = 'TRUE'
167 rows selected.
michaels> SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
CI
14225
michaels> EXEC dbms_application_info.set_client_info(0)
michaels> SELECT DISTINCT cola FROM taba WHERE (SELECT my_function (colb) FROM DUAL) = 'TRUE'
167 rows selected.
michaels> SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
CI
14281
michaels> EXEC dbms_application_info.set_client_info(0)
michaels> SELECT DISTINCT cola FROM taba WHERE EXISTS (SELECT ROWNUM FROM dual WHERE my_function (colb) = 'TRUE')
167 rows selected.
michaels> SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
CI
13913
michaels> EXEC dbms_application_info.set_client_info(0)
michaels> WITH temp AS
(SELECT DISTINCT colA, colB FROM tabA)
SELECT DISTINCT colA FROM temp WHERE my_function(colB) = 'TRUE'
167 rows selected.
michaels> SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
CI
78786
michaels> EXEC dbms_application_info.set_client_info(0)
michaels> WITH temp AS
(SELECT colB, my_function(colB) func FROM (SELECT DISTINCT colB FROM tabA))
SELECT DISTINCT colA FROM tabA a, temp t WHERE a.colB = t.colB AND t.func = 'TRUE'
michaels> SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
CI
78786 The combination with exists, rownum and dual gives the least calls to the function. -
Forced to log into an App twice when using the Builder.
I have had this ongoing problem.
On my login page I have submit computations that set application level items to values. These items drive subsequent reports that appear on page 1. If I login as a normal user everything is fine. Problem...If I login via the builder as a developer, I have to login, logout, then login a second time for the values to be set. then my report is filtered. Is there a fix to this?
Help...it's so frustrating!
regards
PaulIt's hard to follow your scenario. If you recreate it on apex.oracle.com along with detailed steps (every keystroke), I'll tell you what is happening.
Scott -
Error while calling RFC when using BSP Web Interface
Hi,
we have a problem with the Authorization when we use an Web Interface for BSP. We have assigned all roles to the user which were mentioned in the SAP standard documentation:
R_AREA
R_METHOD
R_PACKAGE
R_PARAM
R_PLEVEL
R_PM_NAME
R_PROFILE
R_STS_PT
R_STS_SUP
R_WEBITF
S_RS_ADMWB
S_RS_AUTH
S_RS_COMP
S_RS_COMP1
S_RS_DAS
S_RS_ICUBE
but we still get the error message: "Error while calling RFC".
When using a user with SAP_ALL, it works.
What can we do?
Thx for your time.
JoergActually that's surprising - because BSP (Business Server Pages) and RFC (Remote Function Call) are not related; they use totally different transport protocols (http vs. RFC). Even if an BSP application is calling a function module remotely (acting as RFC client) no authorizations for S_RFC are required - in the calling system (but in the called system, i.e. the RFC server).
Since assigning SAP_ALL seems to "cure" the problem, it seems to be an authorization issue, indeed. In that case it makes sense to use the authorization trace (ST01 - notice: that's specific to one single ABAP application server; you might have to activate the trace on multiple instances) to find out which authorizations are checked / demanded.
Maybe you are looking for
-
I thought I had a problem with my Ipad in which I didnt, so I backed up my Ipad and restored it, but now Some of my apps that I have purchased are not available only the free version, not the purchased version. I would have to purchase again and it i
-
Is there a way to restrict opening a PDF to one computer (PC or Mac)?
Is there a way to restrict opening a PDF to one computer (PC or Mac)? I'm not sure how it would be done. Encoding of current IP number or logicboard serial number? Any ideas? The PDF publication is a trade-sensitive document that is expensive and the
-
Regarding % in Pivot view
Hi Experts, We have a requirement we have built the following snapshot report with a PIVOT table in OBIEE Answers We would like to show the margin % in the column The formula for this is (Margin/Sale)*100 .. But we are unable to implement it in PIVOT
-
Workflow attachment not comming
Dear Team, I developed workflow for PO release, but i am not getting the attachment with the work items. To get a attachment i did like this SWO1> selected the Methodsingle release>go to Basic data> default tab--> Method display
-
What keyboard shortcuts can I use when my 15" MacBook Pro won't reboot and i have a black screen
I have a refurbished 15" MacBook Pro. There have been several times when I turn off my system that it won't turn on. I cannot remember the fix I used to start it the other times but I think it involved a keyboard sequence. Anyone? Many Thanks bellado