Using base classes for common attributes

Can TopLink handle use of non-mapped abstract base classes? There are a number of fields that are common to each and every one of my domain objects which, following good OO design principals, are moved up to a common superclass. So I have:
public abstract class AbstractDomainObject
private Integer id;
private Date dateCreated;
private Integer creatorId;
private Date dateModified;
private Integer modifierId;
// ... appropriate attribute accessors
Then a concrete class which gets mappped in Workbench:
public class Address
extends AbstractDomainObject
... specific attributes
I tried mapping all the specific attributes explicitly defined in the Address class and then using "Map Inherited Fields > To SuperClass" in Workbench. However, when attempting to test my mappings in the SessionConsole, only the attributes explicitly defined on Address are present in the SELECT clause.
Can what I am trying be done? If so, how?

Steve,
What you are trying to do is very common and the process you described is exactly how map the class. I will summarize a couple of points for mapping this scenario.
1. You only need to import Address in and map it. If AbstractDomainObject is imported into the Mapping Workbench make sure that it is disabled. The abstract class is only required on the project's CLASSPATH.
2. You should not enable inheritance for the Address class. Inheritance is for situations where the abstract base class has its own independent table. I am assuming that your Address class has its own table that contains fields for all of the attributes it needs along with those of the abstract base class.
Assuming these conditions are met then TopLink will work fine with you Address class just as if it had all of the inherited attributes directly.
If you are still having trouble take a look through your generated project (XML or Java) to ensure that mappings exist in Address for All attributes. If the project looks good then I am at a loss. Customers have been using this pattern of use for over 5 years with TopLink and Java inheritance.
Cheers,
Doug

Similar Messages

  • How to specify a base class for Remote Interface in Workshop 9.2? -- URGENT

    Hi,
    I am trying to create a UUP EJB in WebLogic 9.2 workshop. I am using @FileGeneration to create my home & remote interfaces. And the generated remote interface is extending javax.ejb.EJBObject;I want my remote interface to extend com.bea.p13n.property.EntityPropertyManager which in turn implements javax.ejb.EJBObject. Can someone tell how i can do it in Workshop?.
    I came across Predefined Variable: remote.baseClass and as per docume
    ntation..."If specified, the value of this variable will be used as the base class for all generated remote classes. Where i should specify it?. @FileGeneration does nt have any option for it. Any help is grtly appreciated.
    Following are my code snippets:
    IMPL Class
    @FileGeneration(remoteClass = Constants.Bool.TRUE,remoteHome = Constants.Bool.TRUE, localClass = Constants.Bool.FALSE, localHome = Constants.Bool.FALSE,remoteClassName = "MyEntityPropertyManager",remoteHomeName = "MyEntityPropertyManagerHome")
    public class MyEntityPropertyManagerImpl extends GenericSessionBean implements
              SessionBean {
    //code
    }

    This question was posted to both the bea.workshop.developer.general and weblogic.developer.interest.workshop (I had replied to the later on 10/19); after seeing an identical question today on this list want to include a reference to that reply here:
    http://forums.bea.com/bea/message.jspa?messageID=600044925&tstart=0
    -Rob

  • How to use multiple classes for each form

    Hi,
    I have created two forms using screen painter and now i want to use different classes for these two forms .
    I have declared the Sbo Connection in main class i.e. Set Application ,Connection Context() but while connecting to other classes
    for executing the code for that form SAP is not connected to that class.How to use multiple classes functionality i don't able to
    do that.Please provide some sample codes for that as it will be more helpful for me to understand.
    Thanks & Regards,
    Amit

    Hi Amit,
    In fact, its more advisable to use separate classes for every form that you use.  Have one common class, say, for eg., clsMain.cs which has all the connection and connectivity to other classes, wherein, the menu event and item event of this main class, will just be calling the menu / item event of other classes.
    The individual functionality of the child classes will be called from the item / menu event of the respective classes.
    Item event in clsMain.cs will be as below.
    private void oApplication_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
                SAPbouiCOM.Form oForm;
                BubbleEvent = true;
                try
                    if ((pVal.FormTypeEx == "My_Form1Type") && (pVal.EventType != SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD))
                        oForm = oApplication.Forms.GetForm("My_FormType", pVal.FormTypeCount);
                        NameSpace.Repots.ClsForm1.ClsForm1_ItemEvent(oApplication, oCompany, oForm, ref pVal, ref BubbleEvent);
                    if ((pVal.FormTypeEx == "My_Form2Type") && (pVal.EventType != SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD))
                        oForm = oApplication.Forms.GetForm("My_FormType", pVal.FormTypeCount);
                        NameSpace.Repots.ClsForm1.ClsForm2_ItemEvent(oApplication, oCompany, oForm, ref pVal, ref BubbleEvent);
    Now, in the individual classes, you can have their respective item events, which will be called from the main class, and the respective functionalities will occur.
    Hope this helps.
    Regards,
    Satish.

  • Passing argument to, when using one class for multiple assets

    I had a class that I was passing a simple argument to like so:
    var quiz_1_2:CaseStudyQuiz = new CaseStudyQuiz(2);
    addChild(quiz_1_2);
    I now would like to use this class for multiple MCs in my library. I thought I could let Flash create a class for each of them and specifying the CaseStudyQuiz class as the Base class. When I do that, I get the following error:
    1136: Incorrect number of arguments.  Expected 0.
    Obviously this is because the class created by flash does not except an argument. Does that mean, I would have to create a seperate class for each of the movies that use that class? And if so, what would I have to do in that class for it to except the parameter and pass it on to my base class?
    Thank you very much for any help with this!!!

    use the super() function and pass your parameter.  but you still might get a runtime error but i don't think that will cause a problem.

  • Is anyone else having email problems such as apps exiting in the middle of an email? It may be a wireless issue. I use First Class for work and yahoo email for personal. I will be in the middle of typing a long email and the app just quits, all data lost.

    Is anyone else having email problems such as apps exiting in the middle of an email? It may be a wireless issue. I use First Class for work and yahoo email for personal. I will be in the middle of typing a long email and the app just quits, all data lost.

    Have you tried restarting or resetting your iPad?
    Restart: Press On/Off button until the Slide to Power Off slider appears, select Slide to Power Off and, after the iPad shuts down, then press the On/Off button until the Apple logo appears.
    Reset: Press the Home and On/Off buttons at the same time and hold them until the Apple logo appears (about 10 seconds). Ignore the "Slide to power off"

  • Error while extending a controller:not a valid base class for this operatn

    Hi,
    I tried to extend a controller. but the Jdev shows an error "oracle.apps.ar.Creditmgt.application.webui.OCMAddFinDataCO is not a valid base class for this operation. Can you please let me know why is Jdev not allowing me to create a new class.
    Thanks,
    Prakash

    Yes I did. the class file exists in the Myclasses of Jdev in Jdevbin.Prakash myclasses folder is in \$JDEV_USER_HOME\jdevhome\jdev\myclasses.
    Not in jdevbin.
    Check this link
    Re: Problem in creating Extended Class for Standard Controller
    Thanks
    AJ

  • AS3: How to create one base class for classes loaded in multiple swfs?

    Our application have 3 different modules and all use
    fscommand and ExternalInterface alot. Now the problem is we are
    combining all those modules, but they all will reside in different
    swfs. Is there any way that they extend to same base class and its
    static members have only one instance accessible by all
    three?

    Hi,
    You can achieve this via Workshop 9.2 by using the exported Ant script for your project as follows:
    -Ensure that all Jars needed to resolve com.bea.p13n.property.EntityPropertyManager (this particular class is found in weblogic92/common/p13n/lib/p13n_ejb.jar) and all referenced classes are added to the Java build path for your WebLogic EJB project (Properties->Java Build Path->Libraries)
    -Export the "Workshop Ant Script" for your WebLogic EJB project (File->Export->Workshop Ant Script); this will generate a "build.xml" Ant script under your project root directory.
    -Edit this default build script as follows: in the call to the "ejbgen" task within the "build" target, add the attribute: propertyFile="ejbgen.properties"
    -Create a file "ejbgen.properties" under the root of your WebLogic EJB project and add the following entry:
    YourSessionBeanClassName.remote.baseClass=com.bea.p13n.property.EntityPropertyManager
    -Add a "<path refid="java.classpath"/>" within the "<classpath>" for the "java" task element that calls "weblogic.ejbc" (this will ensure that the p13n classes are resolved by EJBC)
    Follow the instructions for executing the Ant build script found here: http://edocs.bea.com/workshop/docs92/ws_platform/ideuserguide/conUseCustomAntBuild.html
    For more information on the EJBGen property file support, see: http://e-docs.bea.com/wls/docs92/ejb/EJBGen_reference.html

  • Base classes with Collection attributes

    I have a question. Suppose I have a base class A, an abstract base class
    to be exact, and subclasses B and C. Assume A has an attribute of
    Collection type, let's call it collectionImpl. Now I would like subclasses
    B and C to be able to have elements of different types along the lines of
    what I've outlined below.
    Strictly speaking, class A wouldn't have to be PC, since I primarily care
    of B and C but I wanted to show the structure.
    <class name="A" persistence-capable-superclass="A">
    <field name="collectionImpl">
    <collection element type="someType"/>
    </field>
    </class>
    <class name="B" persistence-capable-superclass="A">
    <field name="collectionImpl">
    <collection element type="someOtherType"/>
    </field>
    </class>
    So, how would one express this?
    Scott

    Understood. Now for bit more clarification. Given my earlier example, what
    if classes A, B and C implement the java.util.Collection interface. Does
    Kodo have in issue with that? I know Kodo has this ProxyCollection stuff
    but I don't really want to do that, nor do I think I really need to given
    what I'm trying to accomplish.
    The issue I'm having now is that the Kodo Enhancer is complaining that no
    element-type is declared when I have an attribute of class type B for
    example (implementing java.util.Collection) even though an element type is
    declared for the that actual Collection object held in the base class of B
    (A).
    <class name="A" requires-extent="false">
    <field name="impl">
    <collection element-type="SomeType"/>
    <extension vendor-name="kodo" key="ordered" value="true"/>
    </field>
    </class>
    <class name="B" persistence-capable-superclass="A"
    requires-extent="false"/>
    Class "A" extends java.util.AbstractSet, impl is an instance of
    java.util.Collection.
    All this was working quite well until I made some updates recently
    although the basic implementation is the same. Logically I don't know what
    I might have done to cause the new error message.
    I'm using v2.5.2 BTW.
    Scott
    Stephen Kim wrote:
    The one thing to note is that if you do not make A persistent capable,
    you cannot persist fields -declared- in A or query starting from A.
    Scott A. Leschke wrote:
    Can I acheive the same effect by making A be non-PC and provide a abstract
    protected method that will be used by a to access the collection
    implemented in the sub-classes as you suggest (ie. Collection
    getCollectionImpl())?
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Using FileIOInteractionSpec Class For Moving File using File Adapter

    Hi All,
    I am tring to use FileIOInteractionSpec class to move a file from one location to another. The problem is that I am not able to override its properties from BPEL, here is how the FileAdapter.jca file looks like which moves the file from one location to another:
    <adapter-config name="MoveFileService" adapter="File Adapter" wsdlLocation="MoveFileService.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
    <connection-factory location="eis/FileAdapter"/>
    <endpoint-interaction portType="MoveFile_ptt" operation="MoveFile">
    <interaction-spec className="oracle.tip.adapter.file.outbound.FileReadInteractionSpec">
    <property name="DeleteFile" value="true"/>
    <property name="PhysicalDirectory" value="C:\FileRead"/>
    <property name="FileName" value="dummy.txt"/>
    </interaction-spec>
    </endpoint-interaction>
    *<endpoint-interaction portType="MoveFile_ptt" operation="Move">*
    *<interaction-spec className="oracle.tip.adapter.file.outbound.FileIoInteractionSpec">*
    *<property name="Type" value="MOVE"/>*
    *<property name="SourcePhysicalDirectory" value="C:\FileRead"/>*
    *<property name="SourceFileName" value="dummy.txt"/>*
    *<property name="TargetPhysicalDirectory" value="C:\FileRead2"/>*
    *<property name="TargetFileName" value="dummyCopy.txt"/>*
    *</interaction-spec>*
    *</endpoint-interaction>*
    </adapter-config>
    In the above code, I have hard-coded the values, and it works fine like that.
    However, when I try to override these values by defining properies in BPEL invoke's tag, the values are getting passed as null.
    Here is the invoke tag code, tried the following 2 combinations:
    <invoke name="InvokeFileMove"
    inputVariable="InvokeFileMove_MoveFile_InputVariable"
    partnerLink="MoveFileService" portType="ns1:MoveFile_ptt"
    operation="Move" bpelx:invokeAsDetail="no">
    <bpelx:inputProperty name="jca.file.SourcePhysicalDirectory" value="C:\FileRead"/>
    <bpelx:inputProperty name="jca.file.SourceFileName" value="dummy.txt"/>
    <bpelx:inputProperty name="jca.file.TargetPhysicalDirectory" value="C:\FileRead2"/>
    <bpelx:inputProperty name="jca.file.TargetFileName" value="dummyCopy.txt"/>
    </invoke>
    And
    <invoke name="InvokeFileMove"
    inputVariable="InvokeFileMove_MoveFile_InputVariable"
    partnerLink="MoveFileService" portType="ns1:MoveFile_ptt"
    operation="Move" bpelx:invokeAsDetail="no">
    <bpelx:inputProperty name="SourcePhysicalDirectory" value="C:\FileRead"/>
    <bpelx:inputProperty name="SourceFileName" value="dummy.txt"/>
    <bpelx:inputProperty name="TargetPhysicalDirectory" value="C:\FileRead2"/>
    <bpelx:inputProperty name="TargetFileName" value="dummyCopy.txt"/>
    </invoke>
    These four properties are not visible in Invoke -> Properties tab as well.
    Could you please suggest how can I override the jca's values for FileIOInteractionSpec class?

    I have successfully used this API and it works fine.
    Try to use variables which contains values like "dummyCopy.txt" etc.
    Here is what I used :
    <bpelx:inputProperty name="jca.file.SourceDirectory"
    variable="inputDirectory"/>
    <bpelx:inputProperty name="jca.file.SourceFileName"
    variable="inputFileName"/>
    <bpelx:inputProperty name="jca.file.TargetDirectory"
    variable="destinationDirectory"/>
    <bpelx:inputProperty name="jca.file.TargetFileName"
    variable="inputFileName"/>
    Pass approppriate values into the above given variables and try.
    Hopefully it should work.
    Let us know, how it goes !
    <Puneet/>

  • How to set username and password when using Proxy class for SOCKS5?

    Hi all,
    I use the proxy class for SOCKS5, so need to set username and password, I don't find where can I set the value. whether the API support it.
    Thanks in advance!

    System.getProperties().put("proxySet", "true");That does nothing. Remove.
    System.getProperties().put("proxyHost", getProxyHost());
    System.getProperties().put("proxyPort", getProxyPort());You should be setting socks.proxyHost and socks.proxyPort here.
    System.setProperty("java.net.socks.username", getSOCKSUsername());
    System.setProperty("java.net.socks.password", getSOCKSPassword());
    Authenticator.setDefault(new ProxyAuth(getSOCKSUsername(), getSOCKSPassword()));You either need the first two lines or the third, not both. See the last link posted above.
    1. After I set the value, I connect internet by proxy, how the proxy server knows the values?Because Java tells it during the SOCKS handshake.
    2. In my app, I just set the values in the system properties, then JVM does remaining work? Remaining work is not concerned?Should be OK unless you have to connect to a different SOCKS proxy from the same JVM, but that kind of thing is problematic anyway due to the curious Authenticator design which is set globally, not per connection as you might expect.

  • Using a class for validation

    I have a form that collects some info (let's say username and email address). I wrote a Java class for it that has the set and get methods. I am wondering how I can redirect to the page from the class itself in case something fails (like an '@' not in an email address etc.). Also, if that's possible, how can I tell the original page that the validation failed so I can print a nice red error message?
    Thanks!

    Just submit the form through a servlet and let it handle all the business logic. Let the validator throw an exception or so and then let the servlet or bean handle it and let the JSP display a message based on that condition.
    You may find this article useful to get some ideas of how to layer things properly and get it all to work together: [http://balusc.blogspot.com/2008/07/dao-tutorial-use-in-jspservlet.html].

  • Using Custom Legend without Using Legend Class for line Chart

    Hi ,
    I m trying to create legend with checkbox without using Legend class of flex, but problem is that how to use itemrenderer of lineseries in the legend.
    My requirement is like this:

    my problemb is how to get that shape and use in container .
    i am using hbox in that i have checkbox ,label and i tried to use Image or IFlexDisplayObject but i am unable to assign that renderer to either  image or IFlexDisplayOBject nothing isd working.
    any suggestion for what component i shall use to assign the itemrenderer of lineseries.
    Thanks for replying

  • Error when using a condition for required attribute

    Hi
    I have a requirement to validate the mandatory fields only when the submit button is pressed....if some other button is pressed or some how the form is submitted the validations should not be performed....
    I have used required="#{MyBB.somecondition}" for all the mandatory fields...the method that is being called for doing the condition check is given below:
    public boolean isSomeCondition() {
        // assumes submitButton is a component binding 
        FacesContext fc = FacesContext.getCurrentInstance();
        Map reqParams = fc.getExternalContext().getRequestParameterMap();
        return reqParams.containsKey(submitButton.getClientId());
      }It is same that is given at the following location
    http://wiki.apache.org/myfaces/How_The_Immediate_Attribute_Works ---Soln 3
    But the problem is if I am submitting the form using Javascript from another page(page is a popup that is opened inside the current window), this condition doesnt work and it gives me an error saying "Check some field for its value"
    Please help me sort out this problem
    Thanks

    I think the problem is not clear....my mistake
    I try to be more elaborate on this....
    I open up a popup page from my main window....Here I perform a search(lets say there is a requirement for finding the Country and pincode for a particular city that the user enters)
    Now when I select the particular row in the datatable and click the submit button...... I want the selected values to be filled inside the parent window.....
    I want to bring to your notice that the button that is clicked is in the popup page...not in the parent window.....
    So you see that when that button in popup is clicked i am submiting the form of the parent window and during that time I dont want the validation to occur..... To submit the form of the parent window I use the Javascript like this : window.opener.document.forms[0].submit();Also one more thing that I want to mention is that the method that is used for specifying the condition for required attribute for mandatory fields in the parent window works fine for any button that i click inside my parent window......
    What I mean by this is lets say I have a button to add a dynamic row into my parent page then also I have to submit the form but during that time validation should not occur and it works fine.
    So now I think its clear that the Javascript is being invoked from another page which is submitting the parent window.....
    Then you're doing something wrong. Invoking the wrong button maybe? So please enlighten me where i am wrong and how possibly would I know which button I am invoking??

  • Using same class for duplicate movieclips

    Hello everyone,
    I have created an external class for a particular movieclip and I would like to link a duplicated version of this movieclip to the same class file.
    Problem is I can't seem to do it. Even if I state the class as the BASE class of the new movieclip and create another random class name for it.
    Is there a way I can get around this so I can assign my duplicated clip the same class name ??
    Thanks in advance
    Martin

    well first off I get 'Neutralization of a marked function override' which is apparently caused by the 'stop();' on the first frame of the new symbol.. when I remove that I get 'Number of arguments incorrect.. 2 expected' on the super line
    I have two variables that I'm passing to Animal which are :-
    public function Animal (frameNumber:Number, level:Number)
    Do I need to reflect this in my code ?
    package  {
        import flash.display.MovieClip;
        public class Animal1 extends Animal {
            public function Animal1():void {
                super();

  • Design question about when to use inner classes for models

    This is a general design question about when to use inner classes or separate classes when dealing with table models and such. Typically I'd want to have everything related to a table within one classes, but looking at some tutorials that teach how to add a button to a table I'm finding that you have to implement quite a sophisticated tablemodel which, if nothing else, is somewhat unweildy to put as an inner class.
    The tutorial I'm following in particular is this one:
    http://www.devx.com/getHelpOn/10MinuteSolution/20425
    I was just wondering if somebody can give me their personal opinion as to when they would place that abstracttablemodel into a separate class and when they would just have it as an inner class. I guess re-usability is one consideration, but just wanted to get some good design suggestions.

    It's funny that you mention that because I was comparing how the example I linked to above creates a usable button in the table and how you implemented it in another thread where you used a ButtonColumn object. I was trying to compare both implementations, but being a newbie at this, they seemed entirely different from each other. The way I understand it with the example above is that it creates a TableRenderer which should be able to render any component object, then it sets the defaultRenderer to the default and JButton.Class' renderer to that custom renderer. I don't totally understand your design in the thread
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=680674
    quite yet, but it's implemented in quite a bit different way. Like I was saying the buttonClass that you created seem to be creating an object of which function I don't quite see. It looks more like a method, but I'm still trying to see how you did it, since it obviously worked.
    Man adding a button to a table is much more difficult than I imagined.
    Message was edited by:
    deadseasquirrels

Maybe you are looking for

  • Error when opening files

    When I open a ditamap and then open one of the files within the ditamap, the file takes several minutes to open (literally). The Frame console shows why -- it's generating dozens of error messages such as the partial list below. The files in the erro

  • How do I install Lightroom on my new MacBook?

    I have "trashed" it on my old computer, but I still can't download it from "My downloads". Tech support was NOT helpful at all.  They told me to trash the application on my old computer so now I don't have access at all! Please help!

  • FAQ:一些关于Debug的基本知识(7)

    这次我们介绍user exit的使用方法. <什么是user exit> 简单的说,就是SAP在系统中为客户加入自己的程序来影响标准程序运行而准备的接口.      A function exit provides the customer with the possibility      to add own functionality to the system without modifying the      standard program.      The developers

  • How plot Current VS Voltage (XY graph??)

    Hello, I obtain current and voltage by analog inputs of an USB 6009, and I need to plot it in the same graph (C vs V). Please help me, it is very important to finish my proyect. I attachment a sample of the graph that I want. Thanks Attachments: XY d

  • CsmReportServer.log - Cisco Security Manager

    Hey, the size of the logfile CsmReprtServer.log exceeds 12 GB. Can I manually delete this file or is this not a good idea? Thanks for your help. Sent from Cisco Technical Support iPad App