How to abstract colums from persistable class(s)

for example, i have some common column (created, modified, etc) for all
tables and i don't want to mape the common columns in every single class.
i know kodo has the following restriction in Inheritance
"If a persistent class inherits from a non-persistent class, the fields
of the non-persistent superclass cannot be persisted"
is there any workaround for this, can any one help me
Thanks

That's no longer a restriction -- you can do what you indicated by using
Kodo's horizontal mapping support.
-Patrick
kailasam.k wrote:
for example, i have some common column (created, modified, etc) for all
tables and i don't want to mape the common columns in every single class.
i know kodo has the following restriction in Inheritance
"If a persistent class inherits from a non-persistent class, the fields
of the non-persistent superclass cannot be persisted"
is there any workaround for this, can any one help me
Thanks

Similar Messages

  • How to load function from derived class from dll

    Dear all,
    how to access extra function from derived class.
    for Example
    //==========================MyIShape.h
    class CMyIShape
    public:
    CMyIShape(){};
    virtual ~CMyIShape(){};
    virtual void Fn_DrawMe(){};
    // =========== this is ShapRectangle.dll
    //==========================ShapRectangle .h
    #include "MyIShape.h"
    class DLL_API ShapRectangle :public CMyIShape
    public:
    ShapRectangle(){};
    virtual ~ShapRectangle(){};
    virtual void Fn_DrawMe(){/*something here */};
    virtual void Fn_ChangeMe(){/*something here */};
    __declspec (dllexport) CMyIShape* CreateShape()
    // call the constructor of the actual implementation
    CMyIShape * m_Obj = new ShapRectangle();
    // return the created function
    return m_Obj;
    // =========== this is ShapCircle .dll
    //==========================ShapCircle .h
    #include "MyIShape.h"
    class DLL_API ShapCircle :public CMyIShape
    public:
    ShapCircle(){};
    virtual ~ShapCircle(){};
    virtual void Fn_DrawMe(){/*something here */};
    virtual void Fn_GetRadious(){/*something here */};
    __declspec (dllexport) CMyIShape* CreateShape()
    // call the constructor of the actual implementation
    CMyIShape * m_Obj = new ShapCircle();
    // return the created function
    return m_Obj;
    in exe there is no include header of of ShapCircle and ShapRectangle 
    and from the exe i use LoadLibrary and GetProcAddress .
    typedef CMyIShape* (*CREATE_OBJECT) ();
    CMyIShape*xCls ;
    //===================== from ShapeCircle.Dll
    pReg=  (CREATE_OBJECT)GetProcAddress (hInst ,"CreateShape");
    xCls = pReg();
    now xCls give all access of base class. but how to get pointer of funciton Fn_GetRadious() or how to get access.
    thanks in advance.

    could you please tell me in detail. why so. or any reference for it. i love to read.
    i don't know this is bad way.. but how? i would like to know.
    I indicated in the second sentence. Classes can be implemented differently by different compilers. For example, the alignment of member variables may differ. Also there is the pitfall that a class may be allocated within the DLL but deallocated in the client
    code. But the allocation/deallocation algorithms may differ across different compilers, and certainly between DEBUG and RELEASE mode. This means that you must ensure that if the DLL is compiled in Visual Studio 2010 / Debug mode, that the client code is also
    compiled in Visual Studio 2010 / Debug mode. Otherwise your program will be subject to mysterious crashes.
    is there any other way to archive same goal?
    Of course. DLL functionality should be exposed as a set of functions that accept and return POD data types. "POD" means "plain-ole-data" such as long, wchar_t*, bool, etc. Don't pass pointers to classes. 
    Obviously classes can be implemented within the DLL but they should be kept completely contained within the DLL. You might, for example, expose a function to allocate a class internally to the DLL and another function that can be called by the client code
    to free the class. And of course you can define other functions that can be used by the client code to indirectly call the class's methods.
    and why i need to give header file of ShapCircle and shapRectangle class, even i am not using in exe too. i though it is enough to give only MyIShape.h so with this any one can make new object.
    Indeed you don't have to, if you only want to call the public properties and methods that are defined within MyIShape.h.

  • How to set classpath from java class ??

    I have tried to use System.setProperty("java.class.path", "my class path string ") to set classpath dynamically. But it is not working. How to set it dynamically from java class ?? Thanks , gary

    Look into the java.net.URLClassLoader. You can't set the classpath after the fact but you can specify URL's that will checked when you try to load a class with that loader.

  • How to get info from a .class file at run time? thanks for help

    I need to get methods and properties (variables) from a .class file at run time.
    as u know, javap.exe can do that in an independent way. but i need to get info at run time once the .class or packeges have been changed, javap is not suitable in the case.
    i try to read data directly from .class file but it's hard to know the file format.
    e.g. a class looks like (java file):
    class MyClass extends Frame
    int i0;
    String s0;
    public String getName()
    if the file is compiled to .class file, how to get properties (variables: i0,s0) and methods String getName() from the .class file by an applicaton at run time?
    Doclet is not suitable for speed reason, it is too slow to get right info in right format.
    Thanks for any help, please write a little bit more in detail if you know.

    Use the Java Reflection API. Have a look at the Reflection section of the Java Tutorial located at http://java.sun.com/docs/books/tutorial/reflect/index.html

  • How to call GET_SEARCH_RESULTS from Filter Class

    Hi All,
    I want to call GET_SEARCH_RESULTS from Filter Class. How can we do? Any sample code.

    Hi Mohan,
    I am using "preComputeDocName"
    public int doFilter(Workspace ws, DataBinder binder, ExecutionContext cxt)
    throws DataException, ServiceException
      String dType=binder.getLocal(UCMConstants.dDocType);
      if(dType.equals("CIDTest"))
       if(binder.getLocal("IdcService").equals("CHECKIN_NEW"))
        String filename=binder.getLocal(UCMConstants.primaryFile);
        originalFileName=filename.substring(filename.lastIndexOf("\\")+1);
        SystemUtils.trace(trace_checkin, "org::"+originalFileName);
        DataBinder newDB = ucmUtils.getNewBinder(binder);
        newDB.putLocal("IdcService", "GET_SEARCH_RESULTS");
        newDB.putLocal("QueryText","dDocType <starts> `"+dType+"` <AND> xcidfilename <starts> `"+originalFileName+"`");
        ucmUtils.executeService(ws, newDB, true);
        DataResultSet docInfoDrs = null;
        docInfoDrs = (DataResultSet) newDB.getResultSet("SearchResults");
        if(docInfoDrs.getNumRows()!=0){
         throw new ServiceException("file is not unique");
        binder.putLocal("xcidfilename", originalFileName);
        return CONTINUE;
    return CONTINUE;

  • How to get variable from another class?

    I have 2 classes. In first I have int variable. In second class I need to get this variable value. How I can make it?
    import javax.microedition.lcdui.*;
    import java.io.*;
    import java.util.*;
    public class ChooseLessons extends Form implements CommandListener, ItemStateListener
         ChoiceGroup lessons;     // Choice Group of preferences
         Dictionary     dictionary;
         int volumeSize;
         ChooseLessons(Dictionary dictionary)
              int volumeSize = 15;
         public void commandAction(Command c, Displayable s)
              if (c == Dictionary.BEGIN_CMD) {
                   new TeachForm(dictionary, this);
    import javax.microedition.lcdui.*;
    import java.util.*;
    public class TeachForm extends Form implements CommandListener     
         Dictionary               dictionary;
         ChooseLessons          lessons;
         TeachForm(Dictionary dictionary, ChooseLessons lessons) {
              super(Locale.WORD);
              this.dictionary = dictionary;
              this.lessons = lessons;
              lessons.volumeSize(); // HERE I NEED VARIABLE VALUE FROM PREVIOUS CLASS
    }Edited by: Djanym on Mar 16, 2009 4:43 PM

    This is a classic problem that coders run into when trying to get their head around object-oriented programing. Since you have a class that should be modeled after a real world object, as far as that object is concerned, no one else needs to know the details of it - without asking nicely. This is where you should set up some getters and setters, which are methods that allow fields in a class to reveal themselves or allow their states to be changed in a orderly fashion.
    There are a number of fields that never need to be known outside of the class. Then there are some fields you would like to let people know about, but don't want them to have the ability to change them. In the example below, there are to getter methods allow return of the necessary fields. If you made these public, there is a possibility that someone utilizing this field may change it outside of its intended use, or access them without them being ready for public consumption.
    Class test {
    //These private variables are only visible from the class
    private int grade1 = 0;
    private int grade2 = 0;
    private int grade3 = 0;
    private float average = 0;
    private int gradeboost = 0;
    //This method sets the gradeboost field to one desired by the instructor
    void setboost(int boost) {
    gradeboost = boost;
    //These methods accept test scores and compute the average for three test
    //Notice that the calculated average may not be the true average of the three test scores
    //because of the possibility of gradeboost calculation being greater than 1
    void test1(int score) {
             grade1 = score;
             average = (grade1 + grade2 + grade3 + gradeboost)/3;
    void test2(int score) {
             grade2 = score;
             average = (grade1 + grade2 + grade3 + gradeboost)/3;
    void test3(int score) {
             grade3 = score;
             average = (grade1 + grade2 + grade3 + gradeboost)/3;
    //This is a getter method, which provides read access to the private variable average
    //If someone just had public access to the grades and wanted to take their own average
    //They would miss how the gradeboost field affects the final outcome.
    float getAverage() {
        return average;
    //Here is a getter method, which accepts an argument to determine which test score to return
    //Notice that this isn't the true testscore, but it has been modified by the gradeboost field.
    //If the user had public access to the true testscore, it wouldn't take into account the gradeboost calculation!!
    //This is how a getter can control exactly what a user has access to.
    float get testScore(int test) {
    float testresult = 0;
    if (test = 1) {
           testresult = (grade1+ gradeboost) / 3;
    if (test = 2) {
           testresult = (grade2+ gradeboost) / 3;
    if (test = 3) {
           testresult = (grade3+ gradeboost) / 3;
    return testresult;
    }

  • Implement abstract method from base class problem

    Here is the example:
    public abstract class AbstractClass{
    protected double aVariable;
    protected abstract double abstractMethod();
    public class RealClass extends AbstractClass{
    public double abstractMethod(){
    return aVariable;
    Error message:
    RealClass should be declared abstract; it does not define abstractMethod() in AbstractClass

    I also compiled the code with Jdk1.3 and it
    worked.. The code would not have compiled
    if the access modifier in the derived class
    was more restrictive(eg private )...

  • How can I casting from parent class to children class

    Dear,
    Could someone help me to casting from parent class to children class.
    I have class like this
    class parent{
    String name;
    String id;
    public String getId() {
    return id;
    public void setId(String id) {
    this.id = id;
    public String getName() {
    return name;
    public void setName(String name) {
    this.name = name;
    class children extends parent{
    String address;
    public String getAddress() {
    return address;
    public void setAddress(String address) {
    this.address = address;
    public children() {
    public children(parent p) {
    //Do init super class here
    In the constructor
    public children(parent p) {
    //Do init super class here
    I like to init super class by object p (this is instance of parent class). The way to do is using:
    public children(parent p) {
    super.setId(p.getId());
    super.setName(p.getName());
    But I don't like this, because, for example I have parent class with over 30 proberties, it take time to do like that.
    There are any way to use super operation to init parent class, for example super = p;
    Could you show me the way.
    Thanks alot

    If I understand your question correctly, you are in need of a copy constructor for you class Parent. A copy constructor behaves like this:
       Parent one = new Parent();
       one.setName("...");
       //... and all other properties of interest
       Parent two = new Parent(one);
       //Now two != one, but one.getName().equals(two.getName) for property name and all othersThe copy constructor is programmed in the Parent class, more later. Then for your child class you can use it as follows
       public class Children extends Parent {
           public Children(Parent p) {
              super(p);
       }There are at least 3 ways of programming a copy constructor:
    1. Just bite the bullet: type the assignment for each field this.name = p.getName()
    2. Use reflection to find all common setters/getters dynamically and assign using them
    3. Use a code generator that uses 2 to give you the code for solution 1 for you to paste in.
    If you find doing this a lot, there are frameworks that can do these mappings, like Dozer
    (PS be carefull with Date fields, don't copy the reference but create a new and equals instance, the dirty way would be this.birthdate = new Date(p.getBirthdate.getTime()); )

  • How to retrieve content from DAO Class and process in Controller Class?

    Hello
    This is for the experts.
    What is the best approach to passing a large set of data from Class A to Class B? I have a DAO Class that connects to a database to retrieve data. I tried saving the data in a collection (map) and passing the collection to Class B. The problem here is that the data is may be too large for a collection without increasing the heap size, it could cause out of memory exception. Instead I'd like to pass the data (row by row) on to the "Controller" Class where which will process each row. I am not sure how to do this without using a collection or some sort. Some tips will be much appreciated.
    Note: MVC Rules dictates that Controller cannot call the DAO Class directly, it has to go through the Model which talks directly with the DAO Class.
    Thanks
    Edited by: 875864 on 30-Oct-2011 15:05

    875864 wrote:
    Hello
    This is for the experts.
    What is the best approach to passing a large set of data from Class A to Class B? I have a DAO Class that connects to a database to retrieve data. I tried saving the data in a collection (map) and passing the collection to Class B. The problem here is that the data is may be too large for a collection without increasing the heap size, it could cause out of memory exception. Instead I'd like to pass the data (row by row) on to the "Controller" Class where which will process each row. I am not sure how to do this without using a collection or some sort. Some tips will be much appreciated.
    Note: MVC Rules dictates that Controller cannot call the DAO Class directly, it has to go through the Model which talks directly with the DAO Class.
    Thanks
    Edited by: 875864 on 30-Oct-2011 15:05if its a large set of data, and is fetched from DB and you are sure that it is too large and chances of getting out of memory exception then why you are passing it over request.
    If the data is fetched based on some filter criteria, then just pass the filter criteria from class A to class B, and fetch the data from DB based on the filter criteria in class B.

  • How to pass string from a class to another on button click

    Hai forum i'm developing an application in which i have frame1(seperate class without main) where i get a excel files and get the tablenames of it(sheets).
    There i choose a sheet from availabe sheets and i have to pass it frame2 on clicking a button on frame1.
    The sheet name is chosen from a JComboBox in frame1:(code)
    sheetcombo.addActionListener(new java.awt.event.ActionListener()     
                        public void actionPerformed(java.awt.event.ActionEvent e)
                                  JComboBox cb = (JComboBox)e.getSource();
                                  String sheetname = (String)cb.getSelectedItem();
    I dont get how to pass this String sheetname to frame2 where i call the constructor of frame1 initialize it. Help me out. Thanks in advance...

    1 write a set method in frame 2 class
    2 create a instance of frame 2 class in frame 1
    3 in actionaPerformed method write code as follows
    frame2obj.set(sheetname)
    this should work :-)

  • How call a method from another class

    i make three class.class A,class B and class C.
    class A have One button.
    Class B have a action listener of that button.
    class c have a metod like
    public void test(){     }
    how can i call a method in class b from class c;
    is it necessary to pass the class a or b through the constructor of class c or another way to call the method.

    public class Foo
        public static void main(String[] args)
            Bar.staticFn();
            Bar b = new Bar();
            b.memberFn();
    class Bar
        public void memberFn()
            System.out.println("memberFn");
        public static void staticFn()
            System.out.println("staticFn");
      }

  • How to access variables from other class

        public boolean inIn(Person p)
            if  (name == p.name && natInsceNo == p.natInsceNo && dateOfBirth == p.dateOfBirth)
                 return true;
            else
                 return false;
        }//returns true if Person with same name/natInsceNo/dateOfBirth as phello,
    here am trying to compare the existing object with another object.
    could you please tell me how to access the variables of other class because i meet this error?
    name cannot be resolved!
    thank you!

    public class Person
        protected String name; 
        protected char gender;      //protected attributes are visible in the subclass
        protected int dateOfBirth;
        protected String address;
        protected String natInsceNo;
        protected String phoneNo;
        protected static int counter;//class variable
    //Constractor Starts, (returns a new object, may set an object's initial state)
    public Person(String nme,String addr, char sex, int howOld, String ins,String phone)
        dateOfBirth = howOld;
        gender = sex;
        name = nme;
        address = addr;
        natInsceNo = ins;
        phoneNo = phone;
        counter++;
    public class Store
        //Declaration of variables
        private Person[] list;
        private int count;
        private int maxSize;
    //constructor starts
        public Store(int max)
             list = new Person[max];//size array with parameters
             maxSize = max;
             count = 0;
        }//end of store
    //constructor ends
    //accessor starts  
        public boolean inIn(Person p)
           return (name == p.name && address == p.address && natInsceNo == p.natInsceNo);
        }//returns true if Person with same name/natInsceNo/dateOfBirth as phope it helps now!

  • How get controls name from a class private data?

    How can i get the names of the controls inside a class private data?
    I am using Actor Framework and trying to create a method tha will be executed when launch the actor. This method need a list o all the control names inside the class data to search for the initial value inside a configuration file (config.ini), the key on the configuration file will be the name of the control.
    Thanks.
    Solved!
    Go to Solution.

    You are already making the overriding method just because you have to write to the Bundle By Name.  And then how are you going to handle all of the data types the keys could be.  You are making things more difficult than it should be for really very little benefit.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to display value from java class with output generated with toplink

    i hava a requirement of displaying (distance ie calculated in java class) with output generated by query.
    ie if output is like
    school name (distance)
    physical address
    here the school name and physical address are retrived from database.

    Hi,
    ValueHolders are used by the JSF internal framework. To work with an object (attributes) in a managed bean you don't need to make it returning a value holder.
    Create a POJO, provide accessor methods and register it as a managed bean. Access it from JSF with EL
    Frank

  • How to access function from Top Class to Function of class that contain the the member variable of TopClass

    Dear All,
    is there any way that i can access function or member variable of aggregate class.
    i am working in Visual Studio 2010 
    and making win32 dll with mfc Support. i am new in dll system. just learning and doing.
    previously all in exe and i am working this like
    CTestDoc*pDoc = (CTestDoc*)GetTestDocument();
    somevar = pDoc->xDoc.mVar.GetValue (); 
    now i am trying to put all in dll. so getting problem 
    will i get help on this. thanks in advance.
    below code is just an example.
    for example
    // dll 1
    class aaa : public BaseClass
    public:
    int Index;
    char *cName;
    void doSometing()
    if (GetCurBColor() == 125) // how to access GetCurBColor function of the
    color = GetCurBColor();
    long color;
    // dll 2
    class bbb :public BaseClass
    public:
    int Index;
    long lSize;
    long color;
    void doSometing();
    // dll 3
    class DDD
    public:
    vector <aaa> va;
    vector <bbb> vb;
    int cura;
    int curb;
    long GetCurBColor ()
    return vb[curb].color;
    };// MFC doc/view support
    /// in exe in document
    class inExe
    public:
    DDD d;
    void addB()
    { bbb bb;
    bb.color = 152;
    d.vb.push_back(bb);
    bb.color = 122;
    d.vb.push_back(bb);
    bb.color = 1232;
    d.vb.push_back(bb);
    d.curb = 1;
    void addA()
    { aaa aa;
    aa.color = 152;
    d.va.push_back(aa);
    aa.color = 1232;
    d.va.push_back(aa);
    aa.color = 1542;
    d.va.push_back(aa);
    aa.color = 15;
    d.va.push_back(aa);
    d.cura = 2;
    d.va [1].doSometing ();

    Dear All,
    is there any way that i can access function or member variable of aggregate class.
    i am working in Visual Studio 2010
    and making win32 dll with mfc Support. i am new in dll system. just learning and doing.
    previously all in exe and i am working this like
    CTestDoc*pDoc = (CTestDoc*)GetTestDocument();
    somevar = pDoc->xDoc.mVar.GetValue ();
    now i am trying to put all in dll. so getting problem
    What problem?
    The rules of C++ do not change because some of the code ins in a DLL. But the classes in a DLL need to be exported. See for example
    https://msdn.microsoft.com/en-us/library/81h27t8c.aspx
    You should also supply a macro so that the class header can be used in both the DLL and the client. See for example
    http://stackoverflow.com/questions/14980649/macro-for-dllexport-dllimport-switch
    If  you exchange memory between the DLL and the client (as your example will do, because of the std::vector content), you should also be sure to use the same version of the compiler for each module, and to dynamically link to the CRT.
    I would also advise you to start with a less complicated scenario, with just one DLL.
    David Wilkinson | Visual C++ MVP

Maybe you are looking for

  • My screen flickers in Safari MacBook Pro Retina 2012

    My screen flickers in a totally random fashion and only in Safari when I am on the internet. It happens more or less on certain web pages and not very often, but it is very annoying when it does happen. My machine is a Macbook Pro Retina 15" late 201

  • Windows 8 and Photoshop Elements

    I need to uninstall Photoshop Elements before I can install Windows 8. Will I be able to re-install from Adobe on the web? How do i find any serial numbers or other such security stuff so they know i already own it.?

  • Can't view photos in iPhoto, but they are in my last imported photos

    Hello, I have been able to upload photos from my camera onto my iphoto and view them as normal and create events. I've uploaded some more but now they are just coming up in my last imports and i cannot view them as there is a caution symbol with an e

  • Has anyone tried a modified PAC with Janus Procy

    Hi, i have been tryin to get some privacy and speed with my firefox for android 35.0 And modified PAC url according to this site: about:reader?url=http%3A%2F%2Fradare.org%2Fcgi-bin%2Fwk%2FTOR&tabId=7 .::. I.e the one for iphone : http://radare.org/to

  • PreparedStatement reuse

    Is it possible to use a PreparedStatement after its resultset has been processed? It seems to me like once you iterate through the ResultSet the PreparedStatement can not be executed again with a different set of parameters. Is this correct? I'm usin