Problem with Maintaining State with EJB3 Stateful Bean

I'm a newbie in EJB3. I've wrote a Stateful bean together with JSF as the UI tier. Below is my Stateful bean.
package com.dhydrated.business;
import com.dhydrated.entity.User;
import java.io.Serializable;
import javax.ejb.Remove;
import javax.ejb.Stateful;
@Stateful
public class LogonBean
        implements LogonRemote, Serializable {
    private User user;
    public void setUser(User user) {
        this.user = user;
    public User getUser() {
        return user;
}In above code, I'm storing User object as the private variable. The problem is, whenever I set the User object in the 1st page, I'm unable to retrieve the same user object in the 2nd page. Seems like my Stateful bean does not saved the state or conversation of the bean.
Appreciate if someone could tell me on how to save the state of above Stateful bean. Is there some other conf. that I might missed out?

I was find good solution! =)
*** JScript ***
<script TYPE="text/javascript">
<!--
function popup(myform)
if (! window.focus) return true;
var d = new Date();
windowname = d.getTime();
window.open('', windowname, 'top=100,left=100,height=200,width=200,location=no,resizable=no,scrollbars=no,status=no');
myform.target=windowname;
return true;
-->
</script>
*** JSF ***
<h:form onsubmit="popup(this)">
<h:commandButton value="Press Me" actionListener="#{sessionBean.resetCursor}" action="selectElemList" />
</h:form>
But it work only with <h:commandButton> tag. If you try to use <h:commandLink>, then 'onsubmit' attribute by <form> tag don't work.
If you know how make necessary functional with <h:commandLink> tag, please let me know.

Similar Messages

  • Maintaining State with OAS 4.8 and PL/SQL

    Hi,
    I am working on a package that displays 5 pages with 83 application questions. To maintain state for all 83 questions, I am using a procedure that maintains the data on a string (~400 characters) and passes it to each page (We decided to avoid writing to the database before the application is completed). Since the pages were expiring randomly, I added NEXT and PREVIOUS buttons. One procedure, the one that maintains the string, has 83 parameters.
    The package contains 8-10 procedures, 180 constants and global variables (we tried without using global variables but global variables make the code easier to read and the package smaller (around 4000 lines). The complete application uses 4 packages.
    During development, the package seemed to be working well, until I added more realistic data. Right now, I get The error message: The page cannot be found. The first time, I got this message, just by pressing enter again will cause the page to display. At times it will take 3 or 4 times pressing the enter key on the URL. Slowly, it became more and more difficult to make the browser display the first page. Today, no matter how many times I press the enter key, the page does not display.
    Questions:
    1. Are there any limits on parameters, global variables and data on OAS 4.08. I tested reducing the package parameters, global variables and data to half the size, but the procedure still does not display. Compiling an older copy of the procedure does not seem to work either.
    2. Is there a better way to maintain state without writing to the database?
    I am not sure what is causing the problem. I have an open TAR.
    null

    Patricia Blais (guest) wrote:
    : I have bought the book "The complete reference SQL" which came
    : with a trial software CD of Oracle 8. I want to know if it is
    : possible to create a program in PL/SQL (create a procedure) in
    : SQLPLUS v.8 which is also included with the book. If it is
    : possible, I would like to know how, by a small example. I have
    : tried some of the exercices in the volume and they do not
    work.
    : No error messages are given and the program had to be
    : interrupted. Please answer in another way then repeating an
    : example in the book.
    : Thanks in advance.
    ok some code example:
    Let's gues you want to display 2 collums of the view all_tables
    in html format:
    First create a procedure with a editor (i use to do so).
    create or replace procedure get_html (owner_in in varchar2) as
    var1 number(12,0);
    var2 varchar2(100);
    begin
    dbms_output.putline('<table>');
    for fr_rec in (
    select table_name, owner
    from all_tables
    where owner like '%'

  • Issue with read statement with one more key missing in mapping

    Hi All ,
    I have such data in two internals table :
    IT_bdc
    vbeln            posnr
    90000593     10
    90000576     10
    90000672     10
    90000672     20
    90000672     30
    it_konv
    kbetr          vbeln
    6250          90000576
    12160000          90000593
    500000          90000672
    600000          90000672
    700000          90000672
    My current program statement is :
    LOOP AT it_bdc.
    READ TABLE it_konv WITH KEY
          vbeln = it_bdocs-vbeln.
      currency =   it_konv-waers.
    endloop.
    as you can see the posnr is missing in it_konv how can i modify this read statement so
    that vbeln posnr from it_bdc should get correct kbetr from it_konv.
    Kindly help in this mapping.

    Hi
    sort it_konv by vbeln
    then
    loop at it_bdc.
    read table it_konv with key vbeln = it_bdc-vbeln binary search.
    if sy-subrc = 0.
    perform your logic/task.
    endif.
    endloop.
    also it depends what you want to do after reading it_konv.
    in my logic if there is a vbeln in it_konv which s present in it_bdc then sy-subrc will be 0
    and you can perform your logic.
    and if there will be no matching vbeln in it_konv then sy-subrc will not be 0.
    check the values in debugging.
    Thanks
    Lalit

  • Need help with update statement with multiple joins

    I've got the following select statement that is pulling 29 records:
    SELECT
    PPA.PROJECT_ID,
    PPA.SEGMENT1,
    peia.expenditure_item_id,
    peia.expenditure_type,
    pec.expenditure_comment
    FROM PA.PA_PROJECTS_ALL PPA,
    pa.pa_expenditure_items_all peia,
    pa.pa_expenditure_comments pec
    where PPA.segment1 < '2008' and
    PPA.project_id = 52 and -- just run for project # 20077119 for testing
    peia.expenditure_type = 'PAYROLL' and
    peia.project_id = ppa.project_id and
    PEC.EXPENDITURE_ITEM_ID = PEIA.EXPENDITURE_ITEM_ID;
    I need to update the pec.expenditure_comments to a static field for those 29 records. I assume I should start with the following, but not sure how to complete the where:
    update
    pa.pa_expenditure_comments pec
    set pec.expenditure_comment = 'REFERENCE HD#728'
    where
    First time that we've ever needed to update, so any and all help appreciated.

    Try using exists:
    update pa.pa_expenditure_comments pec
    set    pec.expenditure_comment = 'REFERENCE HD#728'
    where exists ( select null
                   from   pa.pa_projects_all ppa
                   ,      pa.pa_expenditure_items_all peia
                   ,      pa.pa_expenditure_comments pec2
                   where  ppa.segment1 < ''    -- not sure what you posted here, so for next time:
                                               -- please put your examples between the code tags.
                   and    ppa.project_id = 52  -- just run for project # 20077119 for testing
                   and    peia.expenditure_type = 'PAYROLL'
                   and    peia.project_id = ppa.project_id
                   and    pec2.expenditure_item_id = peia.expenditure_item_id
                   and    pec2.expenditure_item_id = pec.expenditure_item_id
                 );

  • Problem with READ Statement in the field routine of the Transformation

    Hi,
    I have problem with read statement with binary search in the field routine of the transformation.
    read statement is working well when i was checked in the debugging mode, it's not working properly for the bulk load in the background. below are the steps i have implemented in my requirement.
    1. I selected the record from the lookuo DSO into one internal table for all entried in source_packeage.
    2.i have read same internal table in the field routine for each source_package entry and i am setting the flag for that field .
    Code in the start routine
    select source accno end_dt acctp from zcam_o11
    into table it_zcam
    for all entries in source_package
    where source = source_package-source
         and accno = source_package-accno.
    if sy-subrc = 0.
    delete it_zcam where acctp <> 3.
    delete it_zcam where end_dt initial.
    sort it_zcam by surce accno.
    endif.
    field routine code:
    read table it_zcam with key source = source_package-source
                                                 accno  = source_package-accno
                                                 binary search
                                                 transportin no fields.
    if sy-subrc = 0.
    RESULT  = 'Y'.
    else.
    RESULT = 'N'.
    endif.
    this piece of code exist in the other model there its working fine.when comes to my code it's not working properly, but when i debug the transformation it's working fine for those accno.
    the problem is when i do full load the code is not working properly and populating the wrong value in the RESULT field.
    this field i am using in the report filter.
    please let me know if anybody has the soluton or reason for this strage behaviour.
    thanks,
    Rahim.

    i suppose the below is not the actual code. active table of dso would be /bic/azcam_o1100...
    1. is the key of zcam_o11 source and accno ?
    2. you need to get the sortout of if endif (see code below)
    select source accno end_dt acctp from zcam_o11
    into table it_zcam
    for all entries in source_package
    where source = source_package-source
    and accno = source_package-accno.
    if sy-subrc = 0.
    delete it_zcam where acctp 3.
    delete it_zcam where end_dt initial.
    endif.
    sort it_zcam by surce accno.
    field routine code:
    read table it_zcam with key source = source_package-source
    accno = source_package-accno
    binary search
    transportin no fields.
    if sy-subrc = 0.
    RESULT = 'Y'.
    else.
    RESULT = 'N'.
    endif.

  • Problem with Dead States

    I am having a problem making dead states with my buttons. The
    way i have it set up I cannot just delete each button code from the
    frame where it's at. It's not working that way..Below I have
    attached pictures of the code in each frame the order the pictures
    are in are the order they are in the timeline in
    <a href="
    http://www.iankemp.com/images/indexmx3testt.swf">SWF
    File Here</a>
    http://www.iankemp.com/images/Picture1.png
    http://www.iankemp.com/images/Picture2.png
    http://www.iankemp.com/images/Picture3.png
    http://www.iankemp.com/images/Picture4.png
    http://www.iankemp.com/images/Picture5.png
    http://www.iankemp.com/images/Picture6.png
    http://www.iankemp.com/images/Picture7.png

    Please post in the DPS foum.
    http://forums.adobe.com/community/dps
    Bob

  • Maintaing state with ejb web services

    Hello,
    I understand there are no straight way to maintain state with ejb web services. Basically I have a stateful session bean and I would like to maintain state across requests. What is the best/cleanest architecture I can use in order to maintain state with web services?
    Any reply appreciated,
    Julien.

    Here's how BEA suggests you do it:
    http://e-docs.bea.com/wls/docs81/webserv/design.html#1058330

  • Maintaining state

    I have an app that starts with a login screen and once a user is logged in they proceed to a welcome screen.  My app is set up based on the Cairngorm microarchitecture.  When the app loads it dispatches an event to get the "currentUser" property from an ejb3 stateful bean and if this "currentUser" property is null (the user hasnt logged in yet), the user must login.  If it is not null (the user has previously logged in), the user is taken to the welcome screen.  Once the user logs in, the currentUser property is set on the stateful bean so they wont have to log in again until the session expires.
    That is how I want it to work, but if you refresh the browser, you are taken back to the login screen.  It seems that the Java EJB Container doest know its the same client so a new stateful bean is created everytime the browser is refreshed.  I am wondering what is the best way to go about remembering the login and what screen they were on, in case the browser is refreshed before they logout.  And I would also like to know how to use stateful beans with flex and blazeds.

    I think it is more common to use the HttpSession to track users between
    requests in a presentation tier. I've never tried to manage a user
    session with a stateful session bean, but I'm guessing that each time
    the client makes a request, you are creating a new blank stateful
    session bean. If you want to track the user between requests you will
    need to store the session bean between requests. You could do this by
    adding the session bean reference to the HttpSession.
    Alternatively you could add the 'currentUser' property to the
    HttpSession and use a stateless session bean for login.

  • Since uninstalling / reinstalling iTunes I am not able to sync iPhotos with my Apple TV with the following warning message stating that this is due to a 'problem on your computer. The disk could not be read from or written to'. Please help!

    Since uninstalling / reinstalling iTunes I am not able to sync iPhotos with my Apple TV with the following warning message stating that this is due to a 'problem on your computer. The disk could not be read from or written to'. Please help!

    Welcome to Apple Discussions!
    Is all the software on your computer up to date?
    iTunes
    iPod Updater
    Also, try The Five R's
    btabz

  • I am having difficulty including text with iPhotos I want to share through email.  I get a red exclamation mark along with a statement stating that the text doesn't fit into the designated text area.  This is so frustrating.

    I am having difficulty including text with iPhotos I want to share through email.  I get a red exclamation mark along with a statement stating that the text doesn't fit into the designated text area.  This is so frustrating. Before iLire11 I was easily able to share photos with email messages.  Arghhhh!

    In the iPhoto preferences you can set Apple Mail as your e-mail client and then it will work exactly as before
    LN

  • Problem with object state...

    Hi guys
    So I have this grid with 25 pictures.
    And I would like to use each of these pictures as a button. This button will trigger a frame with text in the center of the grid, like so :
    The X close the text frame and the user go back to the grid.
    But, I have 2 problems. I can mak a object state of the text frame and the button triggers one state (open/close for exemple) and it work. But if I click on the second square without closing the first text frame, the text frame linked to the first square is still there, underneath...
    Is there a way to 1 : a click triggers the texte square link to it AND close all the other
    Or is there an easier way to do it without object state?
    Thanks

    You have the grid of pics as your background. Then buld a state for each photo/description.
    If you have have 16 pictures  you'd build 16 different states for them. Combine them all into one MSO.
    You'll need to put the buttons into each state to make it work and you'll need one state with only the buttons with no fill or stroke over the background grid.
    You'll need to experiment to decide if you want the buttons to be live for all of the images in each state. It's lots of buttons and there's no automated way to do it, but it works well and avoids the problem that you're having now.
    Bob

  • Problem with Decode statement

    Hi
    I am trying to achieve the following in my report:
    If an employee has a surname of . (dot) or a first name of . (dot), the report should not display a dot. An employee's name is made up of surname, first name and middle name which should all be concatenated together. To try to achieve this, I have the following statement in my report:
    decode(e.Surname, '.', ( LTRIM(RTRIM((INITCAP(e.FIRST_NAME)))||' '||INITCAP(e.MIDDLE_NAME)) ) ,
    e.FIRST_NAME, '.', ( LTRIM(RTRIM((INITCAP(e.Surname)))||' '||INITCAP(e.MIDDLE_NAME)) ) ,
    ( LTRIM(RTRIM((INITCAP(e.SURNAME )))||', '||INITCAP(e.FIRST_NAME)||' '||INITCAP(e.MIDDLE_NAME)) ) ) as emp_name
    FROM Employee e
    Problem: The above statement is only working for those employees with surname of . (dot). It's not working for first names of dot. How can I use the decode statement OR is there any other way of doing it without using the CASE statement?
    It seems my decode statement doesn't work with 2 different fields (surname, firstname) being tested within one decode statement.Thanks.

    Thank you so much InoL . I have used the ltrim with Replace but now have a new problem.
    Because I am joining Surname, First name and middle name together and put a comma after the Surname, the name now appears as follows:
    , Maria Ane (if Surname is a dot)
    Boiler, (if first name is a dot)
    I would like to get rid of a comma and only have comma when surname or first name does not have a dot, i.e. for those people with full names e.g. Blake, Anna Marie.
    InoL, how can I achieve this? Thanks.

  • Performance problem with MERGE statement

    Version : 11.1.0.7.0
    I have an insert statement like following which is taking less than 2 secs to complete and inserts around 4000 rows:
    INSERT INTO sch.tab1
              (c1,c2,c3)
    SELECT c1,c2,c3
       FROM sch1.tab1@dblink
      WHERE c1 IN (SELECT c1 FROM sch1.tab2@dblink);I wanted to change it to a MERGE statement just to avoid duplicate data. I changed it to following :
    MERGE INTO sch.tab1 t1
    USING (SELECT c1,c2,c3
       FROM sch1.tab1@dblink
      WHERE c1 IN (SELECT c1 FROM sch1.tab2@dblink) t2
    ON (t1.c1 = t2.c1)
    WHEN NOT MATCHED THEN
    INSERT (t1.c1,t1.c2,t1.c3)
    VALUES (t2.c1,t2.c2,t2.c3);The MERGE statement is taking more than 2 mins (and I stopped the execution after that). I removed the WHERE clause subquery inside the subquery of the USING section and it executed in 1 sec.
    If I execute the same select statement with the WHERE clause outside the MERGE statement, it takes just 1 sec to return the data.
    Is there any known issue with MERGE statement while implementing using above scenario?

    riedelme wrote:
    Are your join columns indexed?
    Yes, the join columns are indexed.
    You are doing a remote query inside the merge; remote queries can slow things down. Do you have to select all thr rows from the remote table? What if you copied them locally using a materialized view?Yes, I agree that remote queries will slow things down. But the same is not happening while select, insert and pl/sql. It happens only when we are using MERGE. I have to test what happens if we use a subquery refering to a local table or materialized view. Even if it works, I think there is still a problem with MERGE in case of remote subqueries (atleast till I test local queries). I wish some one can test similar scenarios so that we can know whether it is a genuine problem or some specific problem from my side.
    >
    BTW, I haven't had great luck with MERGE either :(. Last time I tried to use it I found it faster to use a loop with insert/update logic.
    Edited by: riedelme on Jul 28, 2009 12:12 PM:) I used the same to overcome this situation. I think MERGE needs to be still improved functionally from Oracle side. I personally feel that it is one of the robust features to grace SQL or PL/SQL.

  • Stateful skins with custom states

    Hi, i'm desperately trying to create a stateful skins with
    custom states defined in my component.
    However, all stateful skins examples i've found so far use
    built-in flex statex, mostly from buttons, to accomplish this.
    when i define my own states, the ProgrammaticSkin class
    doesn't seem to know about my custom states.
    Has anyone a hint how to do this ?
    thanks!

    "pulse00" <[email protected]> wrote in
    message
    news:gmaoou$bta$[email protected]..
    > Hi, i'm desperately trying to create a stateful skins
    with custom states
    > defined in my component.
    >
    > However, all stateful skins examples i've found so far
    use built-in flex
    > statex, mostly from buttons, to accomplish this.
    >
    > when i define my own states, the ProgrammaticSkin class
    doesn't seem to
    > know
    > about my custom states.
    >
    > Has anyone a hint how to do this ?
    What are you wanting to apply the skins to that knows how to
    get the state
    information into your skin?

  • Im facing problem while trying to update my iphone 4 from version 4.3.1 to iOS 5. While processing the downloaded 774mb file, it comes with the statement that the network connection timed out. why???

    im facing problem while trying to update my iphone 4 from version 4.3.1 to iOS 5. While processing the downloaded 774mb file, it comes with the statement that the network connection timed out. why???

    i have been dealing with this same issue, tried to  turn off firewall and even turn of antivirud but still it gave me the same error.

Maybe you are looking for

  • Need help on downloading apps that are more than 20MB in size

    I can only download apps less than 20MB in size. If i want to download others that are larger than 20MB, i have to use wifi... But after I connected my phone to my home network and clicked on the app, I am still unable to download it... The only mess

  • PDF Document Display Issue - iPad Mini iOS 8.1

    I use my iPad heavily doing in-home sales. I rely on a combination of Box, PDF Expert, and Notability to retrieve and create information/documents. After updating my iPad Mini to iOS 8, I started having a display issue when trying to pull up my price

  • Why won't my Mac Pro go to sleep any more?

    I upgraded to yosemite I a few days later I noticed that my mac pro (3.1 early 2008 dual 2.8 xeon processors, two sad's one hdd, 14GB memory) doesn't go to sleep any more.  When I choose sleep from the Apple menu the displays go dark and it looks lik

  • ClassNotFoundException while loading a class

    Hello, I have an application that having several servlet classes. I specified servlet name and corresponding class name(full) in web.xml My problem is , I ended up with an exception when executing the following line of code for some of the files . Cl

  • Emailing form question

    I have created a form and havegot it to work when I click send it opens up outlook and sends as xml is there anyway I can get it to send as an exact copy of the PDF with the users data that has been inputted for easier viewing elsewhere?