Re: DataObject states

From: Dhruti Ramani (dhrutiraman..ahoo.com)
Date: Wed Jul 06 2005 - 12:52:08 EDT

  • Next message: Albert Jagnow: "Query to return a single object"

    The UserRole that I was talking about had "modified" state. It seems like after fixing that, the problem is solved. But now I am facing another problem.
     
    I am attaching the code at last. My main goal in this is setting particular user as "PrimaryContact" for current Deal. To accomplish this I have method called "selectePrimaryContact" in Deal class. If I call that method by clicking some button from jsps then it will work and will set specific user as primary contact for Deal. After setting if I print primary contact then state is "committed" for that user and i can see it in the database too.
     
    But in our real application we are using JBPM(Java Business Process Management) workflow. If I call this method from workflow xml then it won't work. I am not getting any error or any message but if i print primary contact right after setting it, state is "modified", but there is no data in database.(I am using postgresql)
     
    I am also attaching that workflow xml file here(the method is "selectPrimarycontact").
     
    Here is the code,
    Deal has these two methods.
    public void selectPrimaryContact()
    {
     String aUserRole="Sales Team";
     SystemUser aUser=getNextUserFromUserRole(aUserRole);
     //System.out.println(aUser);
     setPrimaryContact(aUser);
     aUser.addToDealsForPriContact(this);
     dataContext.commitChanges();
    }
    // This will call getNextUser() on specific UserRole. In our case User Role will be "Sales Team".
    public SystemUser getNextUserFromUserRole(String aUserRole)
    {
      Expression finalExp=ExpressionFactory.likeIgnoreCaseExp("name", aUserRole);
      SelectQuery query = new SelectQuery(UserRole.class, finalExp);
      List aList= dataContext.performQuery(query);
      UserRole aRole=(UserRole)aList.get(0);
      SystemUser aUser=aRole.getNextUser();
      return aUser;
     }

     
    I really need help with this. Please let me know if you need more information.
    Thanks,
    Denna
     

    Todd O'Bryan <toddobrya..ac.com> wrote:
    Maybe you should post the code.
    On Jul 6, 2005, at 8:38 AM, Dhruti Ramani wrote:

    Yes after I add some specific user to UserRole, i say dataContext.commitChanges(). But still the state is "modifief".
     

    Todd O'Bryan <toddobrya..ac.com> wrote:
    Are you committing changes?
    On Jul 5, 2005, at 1:26 PM, Dhruti Ramani wrote:

    not getting any error. it just does not set the user to UserRole.

    Todd O'Bryan <toddobrya..ac.com> wrote: What kind of error are you getting? compile-time, run-time? What is the actual error?

    Todd

    On Jul 5, 2005, at 12:47 PM, Dhruti Ramani wrote:

    Hi,
     
    I have list of SystemUser objects called "Users" and another sublist of Users is called "teamMembers". To get this teamMemembers, i am getting some users from "Users" and sort them by email address. If I print both lists then objects in "Users" has state "committed" and in "teamMemebers" has "modified".
     
    Now if I try to add any object from "User" to some UserRole(cayenne Object) then it will work but if I try to add from "teamMemebets"(state is modified") then it wont work.
     
     Does that persistence state matters? I am not changing anything in objects of "teamMembers" then why i get modified state? I tried to change the state using "setPersistenceState(3)" but then also I could not add that user to UserRole.
     
    Please let me know if I am doing something wrong?
    Thanks,
    Denna

    ---------------------------------
    Yahoo! Sports
    Rekindle the Rivalries. Sign up for Fantasy Football

    __________________________________________________
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com

    __________________________________________________
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com

                    
    ---------------------------------
    Yahoo! Mail for Mobile
     Take Yahoo! Mail with you! Check email on your mobile phone.




    This archive was generated by hypermail 2.0.0 : Wed Jul 06 2005 - 12:52:11 EDT