Are private variables of VO/AM/...also passivated?

Hi,
In my JClient application in order to avoid the transaction becomming "dirty" when setting transient attributes => display field, I did the following:
Transient attribute: AttrTransient
Added a private variable Number attrTransient
public Number getAttrTransient()
// return (Number)getAttributeInternal(ATTRTRANSIENT);
// here I call my calculation method
return this.attrTransient;
public void setAttrTransient(Number value)
// setAttributeInternal(ATTRTRANSIENT, value);
this.attrTransient = value;
In my JClient environment it works ok.
Question:
In a STRUTS-ADF where the connection management is different, will my variable attrTransient be part of the passivation mechanism?
In other words will the user get the value of attrTransient when using the same ViewObject instance?
If yes, is this also true for added variables to application modules or Entities?
Thanks
Fred

Hi guys,
Thanks for your help. I really was drowning in a glass of water. Although now I am looking forward to learn and understand all about passivation, the issue was not related with that.
The logic implemented checks certain characteristics for the logged in user. With this particular user the logic applied was different in term that, programatically, there was being applied a ViewCriteria. After researching and consulting I realized that when a VC is applied programatically , all the others view criteria (already applied for that VO in the AM) are lost. Hence, no matter that I was executing with all the params, at the end, the querybuilder would just bind the variables for the VC assigned to the VO. In my case, just the one I've applied programatically.
Regards

Similar Messages

  • Are private members inherit or not??

    Hi, I read the Sun Java tutorial twice times in this year about this topic.
    March 2006, it says:
    "A subclass inherits all the members variables and methods from its superclass. However the
    subclass might not have access to an inherited member variable or method. For example a
    subclass cannot access a private member inherited from its superclass. One might think ,then ,
    that the item was not inherited at all. But the item is inherited."
    September 2006, it says:
    "A subclass does not inherit the private members of its parent class. However, if the superclass
    has public or protected methods for accessing its private fields, these can also be used by the subclass.
    A nested class has access to all the private members of its enclosing class�both fields
    and methods. Therefore, a public or protected nested class inherited by a subclass has indirect access
    to all of the private members of the superclass".
    Which is wrong? Are private members inherit or not??

    I teach Java 101 now and then. When I describes classes, sub-classes and access modifyers I use this metaphor:
    Look at a class as a cardboard box. On the left outside of the box, you can write the names of the methods and attributes that you want others to see. These are the ones marked with public.
    On the bottom outside of the box, you write all the names of attributes and methods that can be seen by classes that extends your class, sub-classes. These are the ones marked with protected.
    Somehow, you are able to read the text on the outside when standing inside the box... has something to do with the pen that you use... ;-)
    On the inside of the box you can write whatever you want that you do not want anyone else to see. These are marked private.
    When creating a sub-class the sub-class-boxes are designed in such a way that it has a glass shelf halfway up on the right wall where you place your super-class-cardboard-box and a small window that allows users on the outside to look at the left side of the super-class-box. That is the only difference between a sub-class and a super-class-box.
    Standing outside of the sub-class-box, you can read the left side of the sub-box and the left side of super-box through the window.
    Standing inside the box, you can also read the bottom of the super-box through the glass-shelf.

  • Private variables make it hard to extend TLF classes

    I am making a class that extends EditManager and I wanted to access pendingInsert but it is a private var, so I can not.  Is there a way around this?  Are private vars much better for memory, why not use protected? 

    It would be useful if we could get a public getter for the private _numCharsAdded variable in the PasteOperation class.  It is difficult to derive that value by other means and it seems that a public getter there would not have any implications.
    The _tScrapUnderSelection private variable in PasteOperation would be another candidate.  When doing post-processing of the paste operation via FLOW_OPERATION_END, it would be useful to be able to determine any elements that were modified or removed as a result of the paste.  Currently we have to handle FLOW_OPERATION_BEGIN and create our own text scrap for the selection and keep that around for our post-paste processing.  Would be nice if we didn't have to create that second text scrap.
    In general, where there is information held privately inside of operations that could be useful for those of us who pre/post process operations, it would be good to expose information that we can use to understand the changes the operations are making.  Use of tlf_internal would be acceptable for us also.  A few more examples are _origID in ApplyElementIDOperation and _origStyleName in ApplyElementStyleNameOperation.
    Thanks,
    Brent

  • Is there a way to reference a private variable from one class in another?

    My first class starts off by declaring variables like so:
    class tStudent {
      // declare student name, id, grades 1 & 2, and gpa
      private String fname, lname, g1, g2;
      private int id;
      private double gpa;
      // define a constructor for a new student
      tStudent () {fname=lname=g1=g2=null; id=-1; gpa=0.0;}
      // define methods for manipulating the data members.
      // readStudent: reads information for just one student
    public void read (Scanner input) {
          fname = input.next();
          lname = input.next();
          id = input.nextInt();
          g1 = input.next();
          g2 = input.next();
    }And the second class:// tStudentList: for a list of students
    class tStudentList {
      private int nStudents;
      private tStudent[] list;
      // constructor for creating student list
      tStudentList() {
          list = new tStudent[36];
          for (int i=0; i < 36; i++) list=new tStudent();
    // read the individual students into the student list
    public void read(Scanner scan) {
    nStudents=0;
    while (scan.hasNext()) {list[nStudents++].read(scan);}
    // display the list of all students - fname, lname, id, g1, g2 and gpa
    // with an appropriate header so the output matches my sample //output
    public void print() {
    Is there a way to reference the variables in the first class to use in the second? Specifically in the last section of code where I am going to print the list.

    Not without resorting to reflection hackery. If the fields are private (and are supposed to be), then that means "don't allow access to these to outsiders of this class" by design.
    So if you really meant them to be accessible, then don't use private, or provide public accessors for them.

  • Accessing a private variable from a public method of the same class

    can anyone please tell me how to access a private variable, declared in a private method from a public method of the same class?
    here is the code, i'm trying to get the variable int[][][] grids.
    public static int[][] generateS(boolean[][] constraints)
      private static int[][][] sudokuGrids()
        int[][][] grids; // array of arrays!
        grids = new int[][][]
        {

    Are you sure that you want to have everything static here? You're possibly throwing away all the object-oriented goodness that java has to offer.
    Anyway, it seems to me that you can't get to that variable because it is buried within a method -- think scoping rules. I think that if you want to get at that variable your program design may be under the weather and may benefit from a significant refactoring in an OOP-manner.
    If you need more specific help, then ask away, but give us more information please about what you are trying to accomplish here and how you want to do this. Good luck.
    Pete
    Edited by: petes1234 on Nov 16, 2007 7:51 PM

  • Private variable issues

    Hello,
    While studying I have come up with this problem a few times and was wondering if you could help me.
    I am currently working with linked list examples and the variables used have default package access. I am however told that the variables should normally be declared private.
    So I made a kinda dummy class which shows my problem.
    public class Private
         private Private unreachable;
         private String greating="hello";
         public Private()
              unreachable = null;
              greating="";
         public String getGreating()
              return greating;
         public Private getReach()
              return unreachable;
    public class PrivateWork
         private String differentGreating;
         private Private reachMe;
         public PrivateWork()
              differentGreating="";
              reachMe=null;
         public void changeGreating(String change)
              Private p = new Private();
              p.greating = change;     //produces "greating has private access in the class Private" error
              p.getGreating() = change; //produces "unexpected type" error
              reachMe = p;
    public class TestPrivate
         public static void main(String[]args)
              PrivateWork p = new PrivateWork();
              p.changeGreating("Good Morning");
    }I know that by making the Private class an inner class of PrivateWork I can keep the variables declared private and the "p.greating = change;" will work.
    However is there another way I can access the "greating" variable from the changeGreating(String change) method in the PrivateWork class.

    I am currently working with linked list examples and the variables
    used have default package access.What variables are you referring to?
    p.greating = change;     //produces "greating has private access in the class Private" error That one should be pretty obvious because it is the definition of private: you can't use objects of the class to access private variables.
    By the way, "greating" is spelled greeting.
    p.getGreating() = change; //produces "unexpected type" errorI'm not sure about that one. But, you can split that statement up into two lines and you won't get a compile error:
    String gr = p.getGreating();
    gr = change;However, I don't think that is going to do what you expect. Try to predict the output of this example:
    class Private
         private String greeting="hello";
         public String getGreeting()
              return greeting;
    public class AATest1
         public static void main(String[]args)
              Private p = new Private();
              String gr = p.getGreeting();
              gr = "Goodbye";
              System.out.println(p.getGreeting()); //Output??
    }

  • Enforce setting private variable in subclass with abstract method

    Hi,
    Is this something that is common usage/practice?:
    public abstract class Base {
        private int importantPrivateVariable = setImportantPrivateVariable();
        protected abstract int setImportantPrivateVariable();
    }I would like to enforce the extender of the class to set a private variable, but as there is no abstract variable in java, I can only use a method for it.
    Thanks,
    lemonboston
    Edit: the variable could be protected as well, I suppose this is not important here, but correct me if I am wrong

    lemonboston wrote:
    Hi,
    Is this something that is common usage/practice?:I don't think that's so common, but that's code easily understandable. However there are several problems with this approach:
    public abstract class Base {
    private int importantPrivateVariable = setImportantPrivateVariable();
    protected abstract int setImportantPrivateVariable();
    }I would like to enforce the extender of the class to set a private variableThat's no what your code implements: your base class forces the subclasses to return an int value, and the Base class uses that value to assign it to the variable.
    Therefore the method should be called get<Something> (e.g. <TT>getInitialValueOfImportantVariable()</TT>+ to have a naming consistent with its signature (it returns a value, whereas a regular setter method should declare a void return type: <TT>protected abstract void setImportantPrivateVariable(int someValue);</TT>).
    Edit: the variable could be protected as well, I suppose this is not important here,Well, yes, this is "important" - at least, there a noticeable difference: the variable being private, the base class is free to handle it as it sees fit (e.g., assign the value at construction time and never modify it afterwards). If the variable was protected, the subclass could modify in ways and at times not known by the base class.
    but correct me if I am wrongThere's a trap in this construct: the method is called in the variable initializer, that is, behind the scenes, approximately during the execution of the Base class constructor, so before the subclass constructor. So, you are calling a method on an object that is not fully initialized (e.g. some of its attributes may still be <TT>null</TT> at this stage). There is a rule that discourages such situations, that goes something like "don't call non-private and non-final methods from a constructor".
    To avoid this trap, two options:
    - require an int argument in the Base class's constructor , as was suggested above
    - don't get and set the value of the important variable in the initializer or constructor code, but from a special method in the base class instead:
    public abstract class Base {
        private int importantPrivateVariable; // default value is zero
    // or alternatively:
    //    private int importantPrivateVariable = ...; // Some default value
        protected abstract int getImportantPrivateVariable();
        public void initializeImportantPrivateVariable() {
            importantPrivateVariable = getImportantPrivateVariable();
    }That construct is a degenerate form of a common design pattern known under the name of Template Method (where a base class method calls generally several subclass methods in a specified order and with a specified chaining, leaving it to the subclass to implement the details of the methods).
    The drawback is that the client code (the one that uses the Base instance) has to know when to call that initialization method, whereas the constructor-based initialization lets the client code free to not care at all.
    Much luck,
    J.

  • Accessing super class  private variables from derived class

    posted November 01, 2005 08:20 PM Profile for kenji mapes Email kenji mapes Send New Private Message Edit/Delete Post Reply With Quote Assume I have a default and a param constructor in both a subclass and a super class. The members are private.
    So after validation logic in the sub class param. constructor, I want to access an instance variable of the super class's default constructor to set the subclass's matching variable to the default in the super class.
    Is there anyway I can do this. Of course, I have inherited setters and getters.
    Thanks.

    posted November 01, 2005 08:20 PM Profile for
    kenji mapes Email kenji mapes Send New Private
    Message Edit/Delete Post Reply With QuoteI suppose this is the result of an attempted crossposting from another forum. :)

  • Access super class private variables

    class A
    private int i,j;
    A()
    i=j=20;
    public void show()
    System.out.println(i+" "+j);
    class B extends A
    int k;
    B()
    super();
    k=20;
    public static void main(String args[])
    B b=new B();
    b.show();
    In the above program, when a instance of class A is created, the memory is allocated for 2 private integer variables(i and j in this case) 8 byte of memory gets allocated and the referance is returned to the object.
    ex:
    A a=new A();
    a contains the address of memory allocated for 2 integer variables.
    In this code there is another class called B which contains only one variable of it's own.when a object is creted for class B only 4 byte of memory is allocated and the reference is returned.
    ex:
    B b=new B();
    b contains address of 4 byte of memory allocated.
    my doubt is when the B's constructor is called,it inturn calls super(),
    where the variables are intialized. variable (i,j) does not exist in memory and how are they getting initialized.are they created at runtime and getting initialized.Though B has no explicit control over these variables it can able to access their values.How is that possible??

    Can you please stop creating multiple threads with the same question. There is already a discussion in your other thread. Please don't waste our time.
    http://forum.java.sun.com/thread.jspa?messageID=4063146#4063146
    Kaj

  • Accessing private variables

    I'm a little confused. I know that using private instance variables is good practice, and that the appropriate way to access those variables is with accesser methods (getXXX(), etc.). Since the variables are private, you can't access them by just referring to "testClass.variable", right?
    Well, I was reading up on the Comparable interface today, and found a code example where a class implemented a compareTo() method like this:
    public int compareTo(Object o) {
       if (privateVariable < (TestClass) o.privateVariable) {
          return -1;
       } else {
          return 1;
    }But privateVariable is declared as a private variable. So why is it that you can refer to o.privateVariable in the compareTo() method? Is it just because o is cast as a TestClass object, and the compareTo() method is inside of the TestClass class? Even if that's the case, it still seems weird to me; if privateVariable is declared private, I'd think that any reference to a TestClass.privateVariable variable would throw an exception, even if the reference is within the TestClass. This just seems different to me than referring to the privateVariable variable within TestClass, because that obviously refers to the member of the current instance, not a different instance.
    Anyway, any explanation would be appreciated.
    Rich

    Yes, 'private' means 'private to this class', not 'private to this object'.
    In this way, it behaves somewhat like a 'friend' variable. The basic idea of making variables private is to hide the implementation behind a class, which still holds even with the compareTo method (you can't use it to figure out that there's a variable called 'privateVariable', when using it from outside your class.)

  • Storage of Private Variables...

    I know u all are right but the thing here is that ... when we instantiate a sub class memory for every inherited member is allocated(including private) to its object in heap.
    I just want to know that why private members are inherited if they are simply inaccessible by the sub class......are they inherited just to waste memory........

    The thing that u are saying is very much correctbut
    the point is that the private variable name used
    within the base class but why it comes to the sub
    class........and then it is invisible to it...Read this agani (posted by warneja):
    A subclass instance is still an instance of thebase class too
    (the same object, not another one).It sounds like you don't understand what he is trying
    to say. There aren't two objects in memory. I.e it's
    not one object for the base class, and another for
    the subclass. There is only one object in memory, and
    that object has all fields and methods from both
    classes.
    Kaj(All in that post was directed at the OP, even though it looks like I'm talking to warneja)

  • Encapsulation hide private variable

    As below code showing that you cannot directly access the private variable as i understood, Pls guide.
    public class EncapsulationDemo{
       private int ssn;
       private String empName;
       private int empAge;
       //Getter and Setter methods
       public int getEmpSSN(){
       return ssn;
       public String getEmpName(){
       return empName;
       public int getEmpAge(){
       return empAge;
       public void setEmpAge(int newValue){
      empAge = newValue;
       public void setEmpName(String newValue){
      empName = newValue;
       public void setEmpSSN(int newValue){
      ssn = newValue;
    public class EncapsTest{
       public static void main(String args[]){
       EncapsulationDemo obj = new EncapsulationDemo();
      obj.setEmpName("Mario");
      obj.setEmpAge(32);
      obj.setEmpSSN(112233);
       System.out.println("Employee Name: " + obj.getEmpName());
       System.out.println("Employee SSN: " + obj.getEmpSSN());
       System.out.println("Employee Age: " + obj.getEmpAge());

    As below code showing that you cannot directly access the private variable as i understood,
    That code shows NO such thing.
    Tell us what line you think you are 'directly' acessing a private variable. Looks like you are using accessors for ALL accesses to me.
    See The Java Tutorials trail 'What Is an Object'. It discusses encapsulation.
    What Is an Object? (The Java™ Tutorials > Learning the Java Language > Object-Oriented Programming Co…
    Hiding internal state and requiring all interaction to be performed through an object's methods is known as data encapsulation — a fundamental principle of object-oriented programming.

  • About private variables

    Is there any way of accessing Private variables of a class into another class?

    The whole point of "private" is to make the variables private to the class. Your only sensible option is to use the "bean" standard, with setXXX() and getXXX() or isXXX(). For example:
    public class ABC {
        private boolean myLogic = false;
        private String myString = null;
        public boolean isMyLogic() {
            return myLogic;
        public void setMyLogic(boolean newMyLogic) {
            myLogic = newMyLogic;
        public String getMyString() {
            return myString;
        public void setMyString(String newMyString) {
            myString = newMyString;
    }Or, if side-effects are not a problem, just make the variables public.
    You may find the following links useful.
    http://java.sun.com/docs/books/tutorial/javabeans/index.html
    http://java.sun.com/products/javabeans/docs/spec.html
    Good luck!

  • Why private variables, while still can be accessed by accessor methods

    Agreed it is well defined way of encapsualtion. But i wonder how it works differently. can any one explain . We declare a varibale as private which can be accessed by accessor (set/get) methods which are usually public. so why dont we say vairbkles itself as Private ??
    Pls explain

    Not only that, but imagine the case where you have an api method, getTotal(). Your first iteratation you have something like:
    double gross;
    double net;
    double commission;
    so to get the total you may want gross - commission = net. Thus your method may look like:
    public double getTotal()
    return gross - commission;
    But later on, iteration 2 or so, you find out you need to account for taxes, so now you don't want to break the code, the result should be the same, the NET total. However, you now need to account for taxes:
    public double getTotal()
    return (gross - commission) + tax;
    Without breaking any code and all while maintaining the actual API definition, you have made a public accessor method provide more functionality. All code using the getTotal() method wont break nor has to be recompiled and even better it now takes into account tax.
    Now, there is one "sticky" issue in the above. Because the getTotal() makes direct use of "private" variables, you may not get the "right" tax. In other words, what if there is state and local tax that need to be added? You may have two variables:
    double localTax,stateTax;
    The problem is, do you want your method like this:
    public double getTotal()
    return (gross - commission) + localTax + stateTax;
    Or would it look (and possibly account for future updates) better like so:
    return (gross - commission) + getTax();
    The thing is, what if later on you have additional tax to handle? Sure, you can simply add it to the end, adding it, what ever. But by making a "helper" method of getTax(), you might have on iteration 2:
    private double getTax()
    return localTax + stateTax;
    and in iteration three, you may have:
    private double getTax()
    return localTax + stateTax + salesTax;
    Now, unless you are calling code in an intensive performance needy loop, making a couple of helper method calls won't hurt performance at all, and it will greatly enhance your code quality because you can easily change the implementation of the method(s) used, without affecting the API.

  • Private Variables

    What is the use in declaring a variable as private . Because if the user has to modify the variable we have to provide the user with get and set methods .
    He will declare an Object of that class and calls set /get methods. Instead we could have declared that variable as public and allow him to change directly?Is it something to do with "DataHiding" . If so how?

    What is the use in declaring a variable as private .
    Because if the user has to modify the variable we
    have to provide the user with get and set methods .Users don't modify variables. Code does. Often times good design dictates that no code outside the declaring class should be able to directly access a variable. So we make it private. Google for encapsulation or data hiding.
    He will declare an Object of that class and calls set
    /get methods. Instead we could have declared that
    variable as public and allow him to change
    directly?Is it something to do with "DataHiding" . If
    so how?Googlel for "why get and set are evil" or something like that. The author claims that get and set methods are no better than simply making the variables public. His comments are a bit extreme, but there's some truth to what he says.
    If you just blindly add get/set for every variable, then, yes, there's no point in making them private. However, you can do things with public methods on private variables that you can't do with public variables--change the underlying implementation, do validation of set values, compute values on the fly for get values. Get/set don't always have to simply be this.x = x or return x.

Maybe you are looking for

  • Another usb printer-to-Airport Extreme problem

    This issue is similar to Tanya Howie's, but involves an HP 5440 printer instead of a Pixma. I have the G4 iBook connecting via Airport to the Airport Extreme, the iMac Snowball hardwired to the AE via Ethernet cable, with the HP plugged in via usb to

  • Authorizations for Tcode Execution

    Hi.  I understand that users assigned a particular Tcode eg. PFCG might not be able to execute this Tcode if he is not assigned the corresponding Authorization object and related activity field values for the PFCG transaction to work. One tedious met

  • Transported person info...

    Hi,   Which table contain the information about person name or userid whoever do the transport to other system. Let's say person <b>A</b> trasnported one request DR1K9090111. to QR1 ( one system ) from DR1 (another System ), So, I need person A user

  • Query on Service Order Reports

    Hi, Need to take report based on Months for the Open Service Orders Quantity Actual Cost Value of Open Service Orders (Local Currency) Actual Billable Cost Value of Open Service Orders (Local Currency) Month to Date Revenue Month to Date Margin Quant

  • Can access photos but not music/videos on AppleTV

    I've set up many for home sharing and Apple TV...but I've never run into this one before. AppleTV 3, HP PC with iTunes (no firewall on). When we turn on home sharing the AppleTV sees the photos but only sees 3 albums.  Those albums aren't in the iTun