Associations and extended objects

Hi,
I'm just beginning to look at bc4j so bear with me if I ask a stupid question :-)
The thing is that I'm experimenting with simple inheritance and I cant seem to get the associations to work like I would expect. I have 3 classes (business components). Customer, Account (which in my model is an abstract superclass) and SavingsAccount. And there is an association between Account and Customer in my model implying of cause that there is an assosiation between all subclasses of Account (SavingsAccount) and Customer.
Account and SavingsAccount are in seperate tables - mabye thats where my problems lie ?
But no such associations are created automatically by the 'create database objects' command.
Is this also the experience of others here ? What it means is that my model gets 'abused' when I create the associations and I'm not too happy about that.

Well, then I'm stumped as to why that won't work for me. If I have the following code:
import java.util.*;
public class Test1
    private ArrayList<E extends Integer> aList;
    public Test1()
        aList = new ArrayList<Integer>();
    public void run()
        for (byte i = 0; i < 10; i++)
            Integer o = new Integer(i);
            aList.add(o);
    public ArrayList<E extends Integer> getResults()
        return aList;
}I get "> expected".
Your last piece of code shows what I will probably end up doing, as this just can't seem to work, i.e. getting each Object1 and casting it to an Object2.
What I need, is to initially build an ArrayList containing Object1s. Then my Object2 class is an extension of Object1, and therefore I else want to have that ArrayList returned, but the info I need now are Object2s. So basically build an ArrayList of Object1s, needed in that particular class, make a method that returns it, invoke that method in another class, but have that ArrayList contain Object2s instead.
While I could iterate through the elements, I will also need to return the ArrayList with Object2 elements in it from the other class, so I prefer being able to do it in one swoop, using generics, if at all possible. Which it seems not to be.
Edited by: ThemePark on May 21, 2008 2:14 PM

Similar Messages

  • Association and ViewLink Object naming

    Hi,
    Jdev: 11.1.1.6
    I have recently upgraded to jdev 11.1.1.6. While creating BC objects, the associations and view links are created with weird names like 'SysC0012692Assoc' -{which actually is a fk between Calendar and CalendarPeriodicities entities} and 'SysC0012692VL' -{Which is a view link over the previously created association) and this is the case with all the associations and view links created.
    I never faced this earlier on 11.1.1.5 or 11.1.1.4 versions. Is there any setting under preferences that needs to be turned off to get the regular naming with understandable names. Or am i missing something.
    Thanks,
    Srikanth.
    Edited by: 905147 on May 6, 2012 11:10 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Srikanth,
    JDeveloper derives default association names by converting the foreign key constraint names to a Java-friendly name and adding the Assoc suffix.
    so if the foreign key name in the database is SysC0012692, then the association name will be SysC0012692Assoc.
    >
    I never faced this earlier on 11.1.1.5 or 11.1.1.4 versions.
    >
    please re-check the FK name in the database?
    are you sure that you did not rename the association after Jdeveloper created it?

  • TextLayout not Serializable AND final class - can't extend and save objects

    As the title reads, I am using a TextLayout object in a class called Foo.
    I want to be able to serialize Foo and save it to the HD. This can't be done because TextLayout does not implement Serializable.
    So I tried to create a new class that extended the TextLayout class. This wasn't possible because TextLayout is defined as:
    public final class TextLayout
    extends Object
    implements Cloneable
    Basically, I have no clue how to be able to save my Foo class to the HD since I can't serialize the TextLayout object inside the Foo class. I would really appreciate help, because it is quite important that this works.
    Thanks.

    Siniz wrote:
    I have never dabbled with with transient variables, but I just read up on it and understand what you are getting at. Is this really the only way?
    The reason why I need to use TextLayout is because I need the bounding box of the text. I see no other way to get a bounding box around text than using TextLayout.That's a question for the swing/awt forums.
    I am also not entirely sure what you mean when you say I should write my own writeObject and readObject methods? You are saying I should entirely ditch the ObjectOutputStream methods?No, you implement those methods on your class in order to customize serialization. Please see the javadocs on the Serializable interface.

  • Leads and its associations with Custom Objects 4-15

    I have been trying to create a Real time report with Lead associating with Custom Objects 3 and 5. But the report does not show up any data. I know that we cannot associate Custom objects 1,2 and 3 with Lead. I wanted to know if we can associate Lead with Custom Objects 4-15 or not ?

    Yes. You have to define them in CO5 Layout.
    You should see Name, Contact and Custom Object 04 (you may have renamed it). Not the Id field.
    Then when you add THE CO5 layout to Contact Related section, you can add new association between Contact and CO4.
    Don't forgot to enable the Access Profiles in Contact, CO4 and CO5.

  • How to test the extended controller and AM Object

    I added a button in a OAF page and extended the CO and AM. When we click this button, an XML Publisher concurrent program should be called and the PO will be displayed in PDF format.
    What is the best way to test this. Should I copy all the libraries from oracle/apps/... to my pc and attach or can I test without doing this. If so, what is the best approach.
    I am new to this.
    Thanks for your Help.
    HP

    I got the code ready for with extended Co java file. How can test this. How to generate the class file. Once I gerenarate the class file, if I ftp the file to cust/oracle/apps/pos/changeorder/webui and in the personalization if I attach this CO and run the page and click the button will this call the new CO? Yes after FTP the Contorller class file to appropriate path and attach the extended controller through personalization New Controller will get called.
    But DO REMEMBER TO BOUNCE THE APPACHE SERVER then only the extended Controller file get called.
    here is the link having steps to bounce it for Apps 11i.
    http://oracleanil.blogspot.com/2009/04/ncrimmessageproc.html
    Please let me know if these steps are correct..
    1. New OAWorkSpace
    2. New Project
    3. right click on project and click New class to generate the extended CO Class.Yes, It is right..
    Thanks
    --Anil
    http://oracleanil.blogspot.com

  • Adf bc jar for base entity classes and extending them existing  project

    Hi,
    I am using jdev 11.1.1.0 and have created a base workspace/project and adf jar for my base entity classes.
    1. I can consume this base adf bc jar in a separate new consuming workspace and create VO based on base bc classes or create new EOs that extend base bc entity classes.
    2. Furthermore, for an existing consuming project that earlier included src/ of base entity (BC components), i can remove the dependency on bc source and bring in this new adf jar and everything including the view controller and the service/datacontrol works fine.
    The issue i am running into is as follows.
    - In the existing project (#2) above i try to create a couple of entities based on entities in my base jar; associations are automatically brought in. Note i am not overriding any attributes. My intent here is to generate .java and implement some code.
    - I then try to make my existing VOs based on the newly extended entity (VO overview->Entity Objects-> Shuttle NewEntity from Available to Selected)
    - I then try to remove the old EO from selected under VO overview->Entity Objects->Shuttle OldEntity from Selected back
    - I get a warning dialog box that says something to the effect that some viewlinks are dependent on these old EOs in this consuming project.
    - I tried to laboriously analyzed dependencies and it this dialog box does not make any sense as I have already extended EOs and the tooling should be able to let me use these
    My questions
    - Why I am not able to remove old entities from VO dependencies
    - Is it ok to leave the old EOs in "Selected" along with the newly extended EO ? What are the implications for this?
    - I also thought about extending base associations, but did not go anywhere.
    In general, I am ok with consuming an ADF BC jar that has entities etc. but not clear about removing dependencies of base EOs on VOs when entities are extended and consumed in a pre-existing project that used base entities.
    I can send a project if any PM is willing to take a look at it.
    Thanks,
    ps:
    I have already gone over the following info
    http://technology.amis.nl/blog/215/organization-of-bc4j-domain-eo-and-business-vo-package
    .. wants to create an enterprise data model in BC4J, reflecting the Enterprise Data Model set up in the RDBMS. All (or at least most) business rules will be implemented in the Middle Tier – to take the load of the database and also allow developers not comfortable with PL/SQL to define and maintain the business rules. It is clear that this means that all applications that need to access – and manipulate – the database, need to go through the BC4J foundation layer. Martijn wants to define the Entity Objects – and their business rules – only once and share that definition between different projects. Each projects can create its own ViewObjects on top of these shared Enterprise Entity Objects.
    http://radio-weblogs.com/0118231/2005/09/29.html
    I am currently working on a project for a partner where we will be using ADF BC as our model layer for a large application. In order to keep the footprint of each application module down to a reasonable size, we are intending to create a number of separate 'root' application modules for each functional area of the application. Within, these 'root' application modules we will then use nested application modules to further partition the application. All of the application modules will be accessing the same datasource and will need access to the same database objects.
    In order to separate our code between the development team and into function areas, our initial thoughts were that we would create an ADF BC model project containing Entity Objects for all of the database tables e.t.c. as these are common amongst all functional areas. We have configured all of the EOs for validation rules, defaulting values and extending doDML() as appropriate. Happy at this stage we then created a simple .jar file to deploy all of the definitions. Upon creating a new ADF BC project for each functional area we added the jar file as a library import into the new project. However when we the tried to create some new View Objects via the JDev Wizard we were unable to see the imported Entity Objects.
    Is the only way to share Entity Object definitions between different ADF BC projects to manually copy the source definition files into the new projects src directory? Since this would mean multiple copies of the same components, it could prove to be a maintenance nightmare.Is there a way of doing it without creating multiple copies of the same object definitions?
    The developer is spot on in their ideas of layering and reuse, and even has created a library for their reusable entities. This last step is not something everyone thinks to do. The missing step is known as "importing" components, so with that one extra bit of knowledge under his belt, he should be able to do exactly what he envisions. My little article called Difference Between Adding and Importing Business Components tries to explain the difference and gives the menu options to choose to perform the importing.
    Difference between adding and importing BC4J
    http://radio-weblogs.com/0118231/stories/2005/08/11/differenceBetweenAddingAndImportingBusinessComponents.html
    Working with Libraries of Reusable Business Components
    http://download.oracle.com/docs/cd/B32110_01/web.1013/b25947/bcadvgen.htm#CHEFECGD

    Hi,
    since you followed the OC4J developer guide I think this question might be better handled there as well
    OC4J
    So in case you don't get an answer here on the forum, try it on the OC4J forum
    Frank

  • What is the diffrence between BAPI and RFC and business object

    Hi Experts,
    Can anybody tel me what is the diffrence between RFC and BAPI , and also what is ther relation with business object?
    Thanx in advance.
    Nilesh Hiwale

    Hi,
    BAPI's are associated with Business Objects and also they are RFC enabled.
    But RFC's are the FM's which can be called from external systems, those FM's can be used in many places based on the applications..
    Check these Links
    whats the difference between BAPI and RFC??
    Diff. Between BAPI and RFC
    Regards
    Kiran

  • Issues in persisting dynamic entity and view objects using MDS

    Hi All,
    I'm trying to create dynamic entity and view objects per user session and to persist these objects throughout the session, I'm trying to use MDS configurations(either file or Database) in adf-config.xml.
    I'm facing following two errors while trying to run the app module:
    1. MDS error (MetadataNotFoundException): MDS-00013: no metadata found for metadata object "/model/DynamicEntityGenModuleOperations.xml"
    2. oracle.mds.exception.ReadOnlyStoreException: MDS-01273: The operation on the resource /sessiondef/dynamic/DynamicDeptEntityDef.xml failed because source metadata store mapped to the namespace / DEFAULT is read only.
    I've gone through the following links which talks about the cause of the issue, but still can't figure out the issue in the code or the config file. Please help if, someone has faced a similar issue.
    [http://docs.oracle.com/cd/E28271_01/doc.1111/e25450/mds_trouble.htm#BABIAGBG |http://docs.oracle.com/cd/E28271_01/doc.1111/e25450/mds_trouble.htm#BABIAGBG ]
    [http://docs.oracle.com/cd/E16162_01/core.1112/e22506/chapter_mds_messages.htm|http://docs.oracle.com/cd/E16162_01/core.1112/e22506/chapter_mds_messages.htm]
    Attached is the code for dynamic entity/view object generation and corresponding adf-config.xml used.
    ///////////App Module Implementation Class/////////////////////////
    public class DynamicEntityGenModuleImpl extends ApplicationModuleImpl implements DynamicEntityGenModule {
    private static final String DYNAMIC_DETP_VO_INSTANCE = "DynamicDeptVO";
    * This is the default constructor (do not remove).
    public DynamicEntityGenModuleImpl() {
    public ViewObjectImpl getDepartmentsView1() {
    return (ViewObjectImpl) findViewObject("DynamicDeptVO");
    public void buildDynamicDeptComp() {
    ViewObject internalDynamicVO = findViewObject(DYNAMIC_DETP_VO_INSTANCE);
    if (internalDynamicVO != null) {
    System.out.println("OK VO exists, return Defn- " + internalDynamicVO.getDefFullName());
    return;
    EntityDefImpl deptEntDef = buildDeptEntitySessionDef();
    ViewDefImpl viewDef = buildDeptViewSessionDef(deptEntDef);
    addViewToPdefApplicationModule(viewDef);
    private EntityDefImpl buildDeptEntitySessionDef() {
    try {
    EntityDefImpl entDef = new EntityDefImpl(oracle.jbo.server.EntityDefImpl.DEF_SCOPE_SESSION, "DynamicDeptEntityDef");
    entDef.setFullName(entDef.getBasePackage() + ".dynamic." + entDef.getName());
    entDef.setName(entDef.getName());
    System.out.println("Application Module Path name: " + getDefFullName());
    System.out.println("EntDef :" + entDef.getFileName() + " : " + entDef.getBasePackage() + ".dynamic." + entDef.getName());
    entDef.setAliasName(entDef.getName());
    entDef.setSource("DEPT");
    entDef.setSourceType("table");
    entDef.addAttribute("ID", "ID", Integer.class, true, false, true);
    entDef.addAttribute("Name", "NAME", String.class, false, false, true);
    entDef.addAttribute("Location", "LOCATION", Integer.class, false, false, true);
    entDef.resolveDefObject();
    entDef.registerSessionDefObject();
    entDef.writeXMLContents();
    entDef.saveXMLContents();
    return entDef;
    } catch (Exception ex) {
    System.out.println(ex.getLocalizedMessage());
    return null;
    private ViewDefImpl buildDeptViewSessionDef(EntityDefImpl entityDef) {
    try {
    ViewDefImpl viewDef = new oracle.jbo.server.ViewDefImpl(oracle.jbo.server.ViewDefImpl.DEF_SCOPE_SESSION, "DynamicDeptViewDef");
    viewDef.setFullName(viewDef.getBasePackage() + ".dynamic." + viewDef.getName());
    System.out.println("ViewDef :" + viewDef.getFileName());
    viewDef.setUseGlueCode(false);
    viewDef.setIterMode(RowIterator.ITER_MODE_LAST_PAGE_FULL);
    viewDef.setBindingStyle(SQLBuilder.BINDING_STYLE_ORACLE_NAME);
    viewDef.setSelectClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT);
    viewDef.setFromClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT);
    viewDef.addEntityUsage("DynamicDeptUsage", entityDef.getFullName(), false, false);
    viewDef.addAllEntityAttributes("DynamicDeptUsage");
    viewDef.resolveDefObject();
    viewDef.registerSessionDefObject();
    viewDef.writeXMLContents();
    viewDef.saveXMLContents();
    return viewDef;
    } catch (Exception ex) {
    System.out.println(ex.getLocalizedMessage());
    return null;
    private void addViewToPdefApplicationModule(ViewDefImpl viewDef) {
    oracle.jbo.server.PDefApplicationModule pDefAM = oracle.jbo.server.PDefApplicationModule.findDefObject(getDefFullName());
    if (pDefAM == null) {
    pDefAM = new oracle.jbo.server.PDefApplicationModule();
    pDefAM.setFullName(getDefFullName());
    pDefAM.setEditable(true);
    pDefAM.createViewObject(DYNAMIC_DETP_VO_INSTANCE, viewDef.getFullName());
    pDefAM.applyPersonalization(this);
    pDefAM.writeXMLContents();
    pDefAM.saveXMLContents();
    ////////adf-config.xml//////////////////////
    <?xml version="1.0" encoding="windows-1252" ?>
    <adf-config xmlns="http://xmlns.oracle.com/adf/config" xmlns:config="http://xmlns.oracle.com/bc4j/configuration" xmlns:adf="http://xmlns.oracle.com/adf/config/properties"
    xmlns:sec="http://xmlns.oracle.com/adf/security/config">
    <adf-adfm-config xmlns="http://xmlns.oracle.com/adfm/config">
    <defaults useBindVarsForViewCriteriaLiterals="true"/>
    <startup>
    <amconfig-overrides>
    <config:Database jbo.locking.mode="optimistic"/>
    </amconfig-overrides>
    </startup>
    </adf-adfm-config>
    <adf:adf-properties-child xmlns="http://xmlns.oracle.com/adf/config/properties">
    <adf-property name="adfAppUID" value="TestDynamicEC-8827"/>
    </adf:adf-properties-child>
    <sec:adf-security-child xmlns="http://xmlns.oracle.com/adf/security/config">
    <CredentialStoreContext credentialStoreClass="oracle.adf.share.security.providers.jps.CSFCredentialStore" credentialStoreLocation="../../src/META-INF/jps-config.xml"/>
    </sec:adf-security-child>
    <persistence-config>
    <metadata-namespaces>
    <namespace metadata-store-usage="mdsRepos" path="/sessiondef/"/>
    <namespace path="/model/" metadata-store-usage="mdsRepos"/>
    </metadata-namespaces>
    <metadata-store-usages>
    <metadata-store-usage default-cust-store="true" deploy-target="true" id="mdsRepos">
    <metadata-store class-name="oracle.mds.persistence.stores.file.FileMetadataStore">
    <property name="metadata-path" value="/tmp"/>
    <!-- <metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
    <property name="jndi-datasource" value="jdbc/TestDynamicEC"/>
    <property name="repository-name" value="TestDynamicEC"/>
    <property name="jdbc-userid" value="adfmay28"/>
    <property name="jdbc-password" value="adfmay28"/>
    <property name="jdbc-url" value="jdbc:oracle:thin:@localhost:1521:XE"/>-->
    </metadata-store>
    </metadata-store-usage>
    </metadata-store-usages>
    </persistence-config>
    </adf-config>
    //////////////////////////////////////////////////////////////////////////////////////////////////////////

    Hi Frank,
    I m trying to save entity and view object xml by calling writeXMLContents() and saveXMLContents() so that these objects can be retrieved using the xmls later on.
    These methods internally use MDS configuration in adf-config.xml, which is creating the issue.
    Please share your thoughts on resolving this or if, there is any other way of creating dynamic entity/view objects for db tables created at runtime.
    Nik

  • Newbie question about entity and view objects

    Hi everyone,
    My first ADF application in JDeveloper is off to a difficult start. Having come from a forms background, I know that it is necessary avoid using post-query type lookups in order to have full filtering using F11/Ctrl+F11. This means creating an CRUDable view and getting as much of the lookup data as possible into the view without losing the ability to modify the data. In JDeveloper, I do not know how to build my data model to support that. My thought was to start with a robust updateable view as my main CRUD EO and then create a VO on top of that with additional EOs or VOs. But, I have found that I cannot add VOs to another VO. However, if I link the VOs then I have a master-detail which will not work for me.
    For example, I have two joins to CSI_INST_EXTEND_ATTRIB_V shown in the queries below and need to have that show in the table displaying the CRUD VO’s data. It seemed that the best way to do this is to create a CSI_INST_EXTEND_ATTRIB_V entity object and view object. The view object would have two parameters, P_INSTANCE_ID and P_ATTRIBUTE name. Both the building and the unit are needed on the same record, and this is not a master-detail even though it might look that way. (A master-detail data control will not work for me because I need all this data to appear on the same line in the table.) So, I need help figuring out the best way to link these to the main (CRUD) view; I want as much of this data as possible to be filterable.
    select
    cieav.attribute_value
    from
    csi_inst_extend_attrib_v cieav
    where cieav.instance_id = p_instance_id
    and cieav.attribute_code = 'BUILDING NAME'
    select
    cieav.attribute_value
    from
    csi_inst_extend_attrib_v cieav
    where cieav.instance_id = p_instance_id
    and cieav.attribute_code = 'UNIT NAME'
    Ultimately, I need to display a ton of data in each record displayed in the UI table, so a ton of joins will be needed. And, I need to be able to add records using the UI table also.
    James

    Hi Alejandro,
    Sorry if I caused confusion with my first post. What I had in mind assumed that I could have a single CSI_INST_EXTEND_ATTRIB_V EO with a BuildingVO and UnitVO on top of it. So, I wrote the queries individually to show how I would invoke each view. When I realized that confused the issue, I rewrote the query to explain things better.
    Now having seen your 2 queries. You need to create 2 EO. One for each table. Then create an association between the 2 aeO (this will be the join you are talking about). Then, you need to create a VO based on one of the EO and after you can modify and add the second EO (in here you select the join type).
    After your done with this, youll have 1 VO that supports CRUD in both tables.
    There were three tables in the query: CIEAV_BUILDING, CIEAV_UNIT, and T -- the main CRUD table. When you say that I should create two EOs, do you mean that they are to be for CIEAV_BUILDING and CIEAV_UNIT? Or, CIEAV and T? Assuming CIEAV and T, that sounds like it would allow me to show my building or unit on the record but not both.
    By the way, everything is a reference except for the main CRUD table.
    Look forward to hearing from you. Thanks for your help (and patience).

  • Can an email address be a member of an LDAP group even if it isn't associated with an object in the Directory Server?

    Can an email address be a member of an LDAP group even if it isn't
    associated with an object in the Directory Server?
    <P>
    General members of a group are the members defined in the
    Directory Server. They are full-fledged members of the group who
    may have a set of permissions associated with their membership,
    a title, or other attributes. Mail-specific users are users who
    are not full-fledged members of the group, but who receive mail
    sent to the group. Mail-specific users need not be identified as
    a user in the Directory Server--an email address is sufficient.
    An example of this is a group of salespeople, all of whom are in
    the group "North American Sales Team." They have access to a
    sales-tracking database, on-line quota information, and
    competitive information. The mail-specific users of this group
    are the admins who support the members of the sales team, who need
    to get the mail that goes out to the group, but don't need access
    to the applications and information that the salespeople do.

    Hey EllyK,
    Welcome to the BlackBerry Support Community Forums.
    Thanks for the question.
    I would suggest performing this workaround and then try to login to BlackBerry Link:
    Open BlackBerry World on the BlackBerry smartphone and sign in using the BlackBerry ID. 
    Connect the BlackBerry 10 smartphone to the computer. 
    Open BlackBerry Link
    Sign in using the BlackBerry ID. 
    Let me know if the issue still persists.
    Cheers.
    -ViciousFerret
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Like! for those who have helped you.
    Click  Accept as Solution for posts that have solved your issue(s)!

  • Unable to update this object because the following attributes associated with this object have values that may already be associated with another object in your local directory services

    Getting this error from DirSync
    Unable to update this object because the following attributes associated with this object have values that may already be associated with another object in your local directory services: [UserPrincipalName
    [email protected];].  Correct or remove the duplicate values in your local directory.  Please refer to
    http://support.microsoft.com/kb/2647098 for more information on identifying objects with duplicate attribute values.
    Quick eyeball and couldn't see the cause in the user account so used the script here:
    http://gallery.technet.microsoft.com/office/Fix-Duplicate-User-d92215ef
    And got these outputs:
    PS C:\Windows\System32\WindowsPowerShell\v1.0> Export-OSCADUserPrincipalName -UserPrincipalName "[email protected]" -Path .\outputs.csv
    WARNING: Cannot find objects with specified duplicate user principal name
    [email protected]
    Found 0 user(s) with duplicate user principal name.
    Where to from here?
    Richard P

    Hi,
    Did you talk about the Microsoft Azure Active Directory Sync tool ?
    If yes, this issue occurs if one or more of the following conditions are true:
    An object in the on-premises Active Directory has an SMTP address that's the same as the SMTP address of the object that's reporting the problem.
    An object in the on-premises Active Directory has a mail attribute that's identical to the object that's reporting the problem.
    An object already exists in your organizational account and has the same SMTP address or mail attribute as the object in the on-premises Active Directory
    More detail information, please refer to:
    http://support.microsoft.com/kb/2520976/en-us
    [Troubleshooting] Unable to update this object because the following attributes associated with this object
    http://blogs.technet.com/b/aadsyncsupport/archive/2014/05/20/troubleshooting-unable-to-update-this-object-because-the-following-attributes-associated-with-this-object.aspx
    Regards.
    Vivian Wang

  • Immutable and mutable object

    Here I want to post some solutions to immutable and mutable objects. First I'll brifely discribe the case when only one type (immutable or mutable) is need accross the application. Then, I'll describe case when both types is using. And finally, the case when only some object can modify this object, while for others it is immutable one. That will be illusrated on the objects discribing current date as number milliseconds from Zero Epoch Era (January 1, 1970).
    Let's start from an exampe for Immutable Object.
    public final class ImmutableDate {
        private final long date;
        public ImmutableDate(long date){
             this.date= date;
        public long getDate(){
            return date;
    }The class is final, so it is imposible to extend it (if it is possible to extend it, it will be possible to add some mutable data-members to the class. Data-member is final to avoid changing (if it is Object it is just warning to programmer not to change it, compiler just can check that reference wasn't changed, but state of this data-member can be changed). There is no method that returns reference to the data-member outside the ImmutableDate. (if data-member was immutable object,it would be possible to return refference to it, if data-member was mutable object and it was possible to revieve reference to it, than it was possible to change the state of data-member through setter function).
    Now, lets consider that we need only MutableDate. The implementation is obvious:
    public  class MutableDate {
        private long date;
        public MutableDate (long date){
             this.date= date;
        public long getDate(){
            return date;
        public void setDate(long date){
          this.date=date;
    }This is regular class.
    The question is how what should I do in the case I need both[b ]Mutable and Immutable Object. It is possible to use the above way of implementation. But there are following problems wih this:
    * Code is not re-usable. For example, getDate() is implemented twice.
    * Implementation is closed to the interface.
    * There is no abstraction such a Date. Usable, when we doen't care whether object is mutable or immutable.
    It will be also nice to have a mechanism to recieve immutable copy from any object. It can be implemnted as getImmutableDate() function. This function is usable, when we have Date object (or MutableDate) at hand and want to store it in HashMap. So immutable copy is needed. It also usable as deffencive copy of MutableDate, if want one to transfer Date to simebody we don't want to change the state.
    Second and third points leads us to declare interfaces:
    public interface Date {
      public long getDate();
      public ImmutableDate getImmutableDate(); 
    public interface ImmutableDate extends Date  {
    public interface MutableDate extends Date {
      public void setDate(long date);
    public final class ImmutableDateImpl implements Date, ImmutableDate {
    public class MutableDateImpl  implements Date, MutableDate {
    }Lets talk more on the first point. In this short example it will look like it is not bug disadvantage. But think, that there are ten data members and setting other value isnot trivvial (for example, other private data members should be recalculated) and you'll realise that this is a problem. What solution OO proposed in such a cases? Right, inheritance. But there is one pitfalls here. Immutable object has to be final (see explanation above). So the only way to do this is to define some new class and inherit from him. It will be look like the following:
    abstract class AbstractDate implements Date  {
       protected long date;
       public AbstractDate(long date){
         this.date=date;
       public long getDate(){
         return date;
    public final class ImmutableDateImpl extends AbstractDate implements Date, ImmutableDate {
      public ImmutableDateImpl(long date){
        super(date);
      public final ImmutableDate getImmutableDate(){return this;}
    public class MutableDateImpl extends AbstractDate implements Date, MutableDate {
      public MutableDateImpl(long date){
        super(date);
      public void setDate(long date){
        this.date=date;
      public final ImmutableDate getImmutableDate(){
        return return new ImmutableDateImpl(date);
    }Note that AbstractDate is declare package-private. It is doing to avoid casting this type in the application. Note also that it is possible to cast immutable object to mutable (interface MutableDate doen't extends ImmutableDate, but Date). Note also that data memer is
    protected long date;That is not private, but protected and not final. It is a cost of getting re-usability. IMHO, It is not big price. Being protected is not a problem, IMHO. Final is more for programmer, rahter than to compiler (see explanation above). Only in the case of primitive data type compiler will inforce this. programmer can know, that in he shouldn't changed this value in AbstractDate, and ImmutableDate, and he can do it only in MutableDate.
    I want to write some words about getImmutableDate() function. This function is usable, when we have Date object (or MutableDate) at hand and want to store it in HashMap. So immutable copy is needed. It also usable as deffencive copy of MutableDate, if want one to transfer Date to somebody we don't want to change the state.
    Let consider the following scenarion. We are writting a game, say chess. There are two players, that plays, desk where they play, and environmemnt (arbiter) that enforces rules. One of the players is computer. From OO point of view the implementation has to the following. There is Desk that only Environment can modify it. ComputerPlayer has to be able only to view ("read") the Desk, but not to move figute ("write"). ComputerPlayer has to talk with Environment what he want to do, and Environmnet after confirmation should do it. Here desk is immutable object to everyone, but Environment.
    If we go back to our Date, the implementation of this scenario could be
    interface AlmostImmutableDate extends Date {
      public void setDate(long date);
    public class Class1 {
      public static ImmutableDate getImmutableDate(long date){return new AlmostImmutableDateImpl(date);}
      private static class AlmostImmutableDateImpl implements Date, ImmutableDate/*, AlmostImmutableDate*/ {
        private long date;
        public AlmostImmutableDate(long date){
          this.date=date;
        public long getDate(){
          return date;
        public void setDate(long date){
          this.date=date;
        public final ImmutableDate getImmutableDate(){
          return this;
    } Which such implementation only Class1 can modify AlmostImmutableDateImpl. Others even don't know about existance of this type (it is private static class).
    It is possible to extends somehow to the case, when not one object, but (a little) group of object can modify Date. See the code above with uncommented part. One way to this is to difine new interface, say AlmostImmutableDate, with package-private scope. AlmostImmutableDateImpl will implements this interface. So, all object that has the same package as AlmostImmutableDate will can to cast the object to this type and modify it.
    Note, that AlmostImmutableDate has to extend Date interface (or ImmutableDate), but not MutableDate! If it will extand MutableDate, than it wiil be possible to cast to MutableDate in any package.
    If there is no MutableDate object in the application, so AlmostImmutableDate is unique. If there is MutableDate object in the application and we want to construct such almost immutable object, so copy&paste is needed to declare AlmostImmutableDate interface.
    Summary.
    It is difficult to define really pair of immutable object and mutable object in Java. Implementation consuming time and not very clear. There are many points to remember about (for example, data-member is not final, or order of inheritance, immutable object has to be final, and so on).
    I want to ask. If these solutions are complete? That is, it is not possible to modify immutable object or almost immutable objects not in the package of AlmostImmutableInterface. Not using reflexion, of course.
    Is these solutions are not to complicated?
    What do you think about delcaration of the third class AbstractDate? Has it to implement date? Perhaps, it is possible to define Date as abstract class (as AbstractDate was)? What do you think about definning
    protected long date;in AbstractDate?
    What do you think about function getImmutableDate() defined in Date interface? Perhaps, it should be declared in other place (even other new interface) or shouldn't be delcare at all?

    It seems to me that you are over thinking the problem:
    Why not just:
    public interface Date {
        long getDate();
    public interface MutableDate extends Date {
        void setDate(long);
    public class ImmutableDate implements Date
        final long date;
        public ImmutableDate(long date){
             this.date= date;
        public ImmutableDate(Date date){
             this.date= date.getDate();
        public long getDate(){
            return date;
    public class ModifiableDate implements MutableDate
        final long date;
        public ModifiableDate(long date){
             this.date= date;
        public ModifiableDate(Date date){
             this.date = date.getDate();
        public long getDate(){
            return date;
        public void setDate(long date){
            this.date = date;
    }

  • [ADF-11.1.2] Non Sense Associations and View Links while using Mysql as DB

    Hello,
    I recently started using Oracle ADF with MySQL at design time.
    I am following instruction from http://www.oracle.com/technetwork/developer-tools/jdev/mysql-and-bc-howto-082060.html
    With Jdeveloper, I created following tables with Mysql Database connection:
    1. Company : (CompanyID, Name)
    2. People : (PeopleID, FirstName, LastName, CompanyID [referencing CompanyID from Company Table])
    Problem 1 : Everytime when I click OK button to create a "new Table" in mysql database, Jdeveloper throws error "Table Doesn't not exists". and when I refresh database connection, it shows me the new table. I don't understand why Jdeveloper is throwing error !
    Once the table and linking between them is done, I can see 1-to-many relation between COmpany and People table on Database diagram ...
    In Model Layer, I go for "Business Components from Tables" from 'New Gallery' where in I select both tables from mysql database to create EO & VOs of respective Table.
    At the end, along of EOs and VOs, it also create following two associations and VL:
    1. PeopleCompanyFkAssoc and PeopleCompanyFkLink >> 0..1 to * Cardinality Between People.PeopleID and People.CompanyID
    2. PeopleCompanyFkAssoc1 and PeopleCompanyFkAsoc1Link >> 0..1 to * Cardinality Between Company.CompanyID and People.CompanyID
    Problem 2 : 1st Association and VL doesn't make any sense at all !!! If Jdeveloper recongnize relationship correctly between tables on Database diagram and why can't it recongnize correct relationship while creating associations ? This problem is occuring for every table I create in Mysql database.
    Also, http://www.oracle.com/technetwork/developer-tools/jdev/mysql-and-bc-howto-082060.html indicates following:
    "+ADF BC does not automatically find the primary keys on your MySQL tables. That has two side effects. You'll see some errors when creating and modifying BC objects, and you'll have to define your BC primary keys manually. However, these errors should not affect your project.+"
    But when my EO was created, it was already having Primary Key selected for correct attributes.
    Anyways, please help in resolving Problem 2 ...

    Timo,
    Thanks for your reply but there is lot of headache, human errors in removing such VO and associations.
    Jobinesh,
    I am doing exactly what is described in here http://www.oracle.com/technetwork/developer-tools/jdev/mysql-and-bc-howto-082060.html
    Expected Behaviour:
    1. Create Following Association and VL, which is working fine.
    PeopleCompanyFkAssoc1 and PeopleCompanyFkAsoc1Link >> 0..1 to * Cardinality Between Company.CompanyID and People.CompanyID
    2. Do NOT Create any other non sense Association and VL, but it is creating
    PeopleCompanyFkAssoc and PeopleCompanyFkLink >> 0..1 to * Cardinality Between People.PeopleID and People.CompanyID
    What's the relationship between PeopleID and CompanyID ?
    Screenshot: http://imageshack.us/g/64/assock.jpg/
    Problem 1: I was trying to create table "Table222" I got error as shown in screen shot.
    Problem 2: Screen shot of Associations

  • Reverting to classic scenario in SRM7.1, from PPS and extended classic

    Hello  Experts,
    Recently we have moved  from SRM7 to SRM 7.01, in which we can have PPS without Extended classic scenario.
    As business wants classic scenario, How can we make the system as classic , in which PPS and extended classic is activated.
    any badi is available for this? Please help.
    Regards,
    Raju

    Raju,
    Basically you have few points to keep in mind. (yes you need to activate the SPRO config for extended classic, apart from this).
    1. switch between extended classic and classic is actually defined by the backend logical system of the document. if thats SRM itself then it follows the path of extended classic or if it is ECC then it follows classic.
    because its basically creating a follow on document and that explains the scenario.
    2. it also depends on what object are you expecting to be created. from a SC many documents can be created.
    a. PO in SRM
    b. PO in ECC
    c. PR in ECC
    d. Reservation in ECC
    - so, if you can define at any point that where is your document to be created and what is to be created you can control the flow.
    Now to do this. if you have few options.
    Option1:
    1. set the object types(2) for product categories (config, backend document type).
    2. implement BBP_EXTLOCALPO_BADI  to switch off extended classic
    Options 2:
    1. in doc change badi, change the backend destination to ECC
    2. in Badi BBP_TARGET_OBJTYPE pass the object type you want your follow on document to be.
    hope this explains

  • BADI  for  Classic  and Extended Classic Scenario

    Hi,
       Please   provide  list  of  Reports and BADI's  for 
           Classic  and Extended Classic Scenario.
    Thanks,
    Srini

    Hi,
    In SRM there will be a number of BADI's are Available, We can utilize them according to the requirements
    As per the request few important BAID are provided below..
    Workflows
    1). BBP_CHNG_AGNT_ALLOW:          Allow / Allow Change/Add Approver
    This BADI is implemented not to allow users to change the approvers in the workflow.
    2). BBP_WFL_SECUR_BADI:          Overwrites the authorization level of the approver
    This BADI controls the restart of the workflow
    Purchasing Related
    1). BBP_PGRP_FIND:               Shopping Cart: Determine Responsible Purchasing Group(s)
    This determines the responsible purchasing group for the shopping carts.
    Shopping Cart Related
    1). BBP_SC_MODIFY_UI:          BADI to Change Shopping Cart Layout
    2). BBP_GROUP_LOC_PO:          Exit Grouping of Items for Local Purchase Orders
    This splits local PO if more than one contract in a PO.
    3). BBP_TARGET_OBJECTS:          Exit while determining target objects in backend
    4). BBP_WF_LIST:               Change Worklists and Search Results Lists
    This is used to restrict the search results for the user.
    5). BBP_CTR_BE_CREATE:          Exit when Creating a Contract in the Backend System
    6). BBP_CREATE_PO_BACK:          Exit while creating a purchase order in the backend system
    This BADI is used to add the shopping carts attachments to the PO and also to make adjustments in payment terms, currency etcu2026
    7). BBP_DOC_CHECK_BADI:     General BAdI in Cross-Check for Message Returns
    8). BBP_DOC_CHANGE_BADI:     BAdI for Changing EBP Purchasing Documents
    9). BBP_ECS_PO_OUT_BADI:     ECS: PO Transfer to Logistics Backend
    Thanks
    prasad .s

Maybe you are looking for

  • HT201084 Apple ID for kids

    why must I use/create an "iCloud-email-adress" to create an Apple ID for my kid? Why can't I use the regular email-address

  • Need help scanning in Pictures:hp 4500-pics not found/trying to open scanning session

    I have successfully scanned once with my hp 4500 printer, but once images are scanned nothing happens.  They are not in iphoto even though I scanned them to pictures folder.  When I open the printer scanner icon it says "trying to open scanning sessi

  • Z10 won't restore after changing BB ID

    I had to wipe my z10 after changing mail addresses and forgetting my password. I did a full back up prior to the wipe, created a new BB ID, and tried to restore. But I just get a message saying that the BB ID for all my data is different and the rest

  • About ASM and SAN...

    Hello Guys, I have to implement 3 nodes RAC 10gR2 ob centOS4 operating system. I have study so many documents about rac instaltion and configurations. I have learn how to set the network requirements with private, public and virtual IPs and all other

  • Firefox 29 sucks! There was NO REASON to change it. Now, I have to use IE! I hate IE!

    Firefox 29 sucks! There was NO REASON to change it. Now, I have to use IE! I hate IE! It's slow , it crashes and does not work with Hotmail. This is the next worst thing to happen since Outlook took over Hotmail.