How to break Circular References.

I have on GUI class containing many components like Button, Combo Box, TextArea etc. And I have an other class ActionHandler which implements ActionListener,ItemListener and keyListener. GUI class has reference of ActionHandler class for handling events corresponding to the components in it and in ActionHandler class i need reference of GUI class for any modification/changes in the different GUI Components, based on the event generated.
This results in circular referencing between the two classes. How to avoid this situation.

I don't think circular references are necessarilly a bad thing. However I generally put the GUI listners etc. inside the GUI class to which they relate, so they naturally have access to the GUI class without an explict pointer. More often than not these listener objects are tiny anonymous classes which do little more than call a private method in theGUI class.

Similar Messages

  • How to check circular reference in data of millions of rows

    Hi all,
    I am new as an oracle developer.
    I have a table(say table1) of hierarchical data with columns child_id and parent_id. The table has around 0.5 million records. There are around 0.2 million root level records are present.
    I need to update some (the number variies on different conditions, might differ from 50K to 0.4 million) of the parent_ids from other table only if that do not cause any circular reference in data of table1.
    I am using Oracle9i.
    The approach I have tried is:
    I copied all data from table1 to a work table table3. Update the parent_id on columns that matches the condition and updated a column source_table to table2.
    I copied all the child_id from table2 that are to be updated into another table table4 and built tree for each of those childs. If it builds the tree successfully updated a column is_circular in the table3 to 0 and then deleted the child_id from table4.
    This whole process needs to run recursively until no tree is built successfully in an iteration.
    But this process is running slow and at the rate it is executing it would run for days for the 0.3 million records.
    Please suggest a better way to do this.
    The code I am using is :
    INSERT /*+ append parallel (target,5) */
    INTO table3 target
    select /*+ parallel (src,5) */
    child_id, parent_id, 'table1' source_table,null
    from table1 src;
    INSERT INTO table4
    select distinct child_id, parent_id
    from table2
    where status_cd is null;
    commit;
    Update dtable3 a
    set (parent_id,source_table) = (select parent_id,'table2' source_table
    from table4 b
    where b.child_id = a.child_id);
    WHILE v_loop_limit<>v_new_count
    LOOP
    select count(1)
    into v_loop_limit
         from table4;
    -+-----------------------------------------------------------
    --| You need to actually traverse the tree in order to
    --| detect circular dependencies.
    +-----------------------------------------------------------           
    For i in 1 .. v_new_count
    BEGIN
    select child_id
    into v_child_id from(
    select child_id, row_number() over (order by child_id) pri from table4)
    where pri = i;
    SELECT COUNT (*) cnt
    INTO v_cnt
    FROM table3 dl
    START WITH dl.child_id = v_child_id
    CONNECT BY PRIOR dl.child_id = dl.parent_id ;
    UPDATE table3SET is_circular = '0'
    where child_id= v_child_id
    and source_table = 'table2';
    delete from table3
    where child_id = v_child_id;
    select count(1)
    into v_new_count
         from table4;
    COMMIT;
    EXCEPTION WHEN e_infinite_loop
    THEN dbms_output.put_line ('Loop detected!'||v_child_id);
    WHEN OTHERS THEN
         dbms_output.put_line ('Other Exceptions!');
    END;
    END LOOP;
    END LOOP;
    Thanks & Regards,
    Ruchira

    Hello,
    First off, if you're so new to a technology why do you brush off the first thing an experienced, recognized "guru" tells you? Take out that WHEN OTHERS ! It is a bug in your code, period.
    Secondly, here is some code to try. Notice that the result depends on what order you do the updates, that's why I run the same code twice but in ASCENDING or DESCENDING order. You can get a circular reference from a PAIR of updates, and whichever comes second is the "bad" one.drop table tab1;
    create table TAB1(PARENT_ID number, CHILD_ID number);
    create index I1 on TAB1(CHILD_ID);
    create index I2 on TAB1(PARENT_ID);
    drop table tab2;
    create table TAB2(PARENT_NEW number, CHILD_ID number);
    insert into TAB1 values (1,2);
    insert into TAB1 values (1,3);
    insert into tab1 values (2,4);
    insert into TAB1 values (3,5);
    commit;
    insert into TAB2 values(4,3);
    insert into TAB2 values(3,2);
    commit;
    begin
    for REC in (select * from TAB2 order by child_id ASC) LOOP
      merge into TAB1 O
      using (select rec.child_id child_id, rec.parent_new parent_new from dual) n
      on (O.CHILD_ID = N.CHILD_ID)
      when matched then update set PARENT_ID = PARENT_NEW
      where (select COUNT(*) from TAB1
        where PARENT_ID = n.CHILD_ID
        start with CHILD_ID = n.PARENT_NEW
        connect by CHILD_ID = prior PARENT_ID
        and prior PARENT_ID <> n.CHILD_ID) = 0;
    end LOOP;
    end;
    select distinct * from TAB1
    connect by PARENT_ID = prior CHILD_ID
    order by 1, 2;
    rollback;
    begin
    for REC in (select * from TAB2 order by child_id DESC) LOOP
      merge into TAB1 O
      using (select rec.child_id child_id, rec.parent_new parent_new from dual) n
      on (O.CHILD_ID = N.CHILD_ID)
      when matched then update set PARENT_ID = PARENT_NEW
      where (select COUNT(*) from TAB1
        where PARENT_ID = n.CHILD_ID
        start with CHILD_ID = n.PARENT_NEW
        connect by CHILD_ID = prior PARENT_ID
        and prior PARENT_ID <> n.CHILD_ID) = 0;
    end LOOP;
    end;
    select distinct * from TAB1
    connect by PARENT_ID = prior CHILD_ID
    order by 1, 2;One last thing, be sure and have indexes on child_id and parent_id in your main table!

  • Circular references in Hashtable

    Hi,
    I was wondering if anyone could help me in determining when circular references appear in java.util.Hashtable I have written a class that serializes any arbitrary java object into XML. The problem occurs when the object contains many references to Hashtables. The serializer does not know how to handle circular references and goes into an infinite loop causing a stack overflow. Any help would be greatly appreciated.

    Hi.
    The solution is simple: keep all the processed objects in a set or map. Before sending an object check if it was already processed. If not, process it. If yes, place a reference in the XML file that will enable you to read find it during the read.
    Java Serialization uses a "serial number" for the objects it serializes. It keeps something like an HashMap of the objects already serialized. When writing, if it finds an object already writen it only writes its serial number. When reading a serial number it uses a map of the objects already read to find the object.
    Hope this helps,
    Nuno

  • JPA: mapping circular references

    Hi all,
    I'm trying to map a simple parent-to-children-knows-parent scenario, which contains circular references, using JPA annotations. Here is the current code:
    @Entity
    public class Assortment implements Identifiable {
         @Id
         @GeneratedValue
         private long id;
         @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parent")
         private Set<Assortment> subAssortments = new HashSet<Assortment>();
         @ManyToOne(fetch = FetchType.LAZY)
         private Assortment parent = null;
    }The DDL for the table is the following:
    CREATE TABLE ASSORTMENT (ID BIGINT PRIMARY KEY, CODE VARCHAR(5) NOT NULL, NAME VARCHAR(50) NOT NULL, STATUS TINYINT NOT NULL, PARENT_ID BIGINT, CONSTRAINT FK_ASMT_PARENT FOREIGN KEY (PARENT_ID) REFERENCES ASSORTMENT(ID));When creating a basic tree (one root to which two children were added) and persisting this object using a simple entityManager.persist(root) call, I get the following (shortened) exception:
    org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.exception.ConstraintViolationException: could not insert: [core.model.goods.Assortment]; nested exception is javax.persistence.EntityExistsException: org.hibernate.exception.ConstraintViolationException: could not insert: [core.model.goods.Assortment]
    Caused by: javax.persistence.EntityExistsException: org.hibernate.exception.ConstraintViolationException: could not insert: [core.model.goods.Assortment]
         at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:555)
    Caused by: org.hibernate.exception.ConstraintViolationException: could not insert: [core.model.goods.Assortment]
         at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
    Caused by: java.sql.SQLException: Attempt to insert null into a non-nullable column: column: ID table: ASSORTMENT in statement [insert into Assortment (id, code, name, status, parent_id) values (null, ?, ?, ?, ?)]
         at org.hsqldb.jdbc.Util.throwError(Unknown Source)
         ...It looks like the Hibernate EntityManager (the JPA implementation) is trying to insert a null value in the table's primary key (id). This understandable, since saving an object requires first knowing what the parent's ID is - although here the root has no parent and hence the parent's ID must be null.
    How must I adapt my code to handle this particular scenario? Are my annotations correct? Should I change the data structure definition instead?
    Thanks a lot,
    GB

    Two things:
    First, the Assortment.parent attribute needed to be annotated with @JoinColumn(name="parent_id")Second, the SQL query sent by Hibernate used an HSQLDB specificity, the identity column, to generate the primary key. By setting hibernate.hbm2ddl.auto=true in my persistence.xml file and setting the log level to debug, I could see that the table was generated using this (approximate) statement:
    CREATE TABLE ASSORTMENT (ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, CODE VARCHAR(5), NAME VARCHAR(50), STATUS TINYINT NOT NULL, PARENT_ID BIGINT, CONSTRAINT FK_ASMT_PARENT FOREIGN KEY (PARENT_ID) REFERENCES ASSORTMENT(ID))The "GENERATED BY DEFAULT AS IDENTITY" seems to be the key here.
    Hope this helps someone out there.
    Cheers,
    GB

  • Circular reference during serialization error

    I am getting the following error when invoking an operation on my web service that returns a 'Make' object:
    ERROR OWS-04046 circular reference detected while serializing: com.edmunds.vehicle.definition.Make circular reference detected while serializing: com.edmunds.vehicle.definition.Make
    I am running oc4j-101310.
    I can successfully call a 'createMake' operation as it returns 'void' so i know the WS is deployed correctly. The only values I am using to create the make are "Make.name" & "Manufacturer.name" so there isn't much to it. I know there are object graphs with 'models' and a parent reference to 'Manufacturer so I don't know if this has anything to do with it.
    One weird thing is that this worked the first time i deployed it but then started breaking on subsequent re-deployments (maybe I'm smoking crack)...
    Any help is appreciated!!
    Make object:
    public class Make implements Serializable {
    private Long id;
    private Set models;
    private String name;
    private Manufacturer manufacturer;
    public Set getModels() {
    return models;
    public void setModels(Set models) {
    this.models = models;
    public void setName(String name) {
    this.name = name;
    public String getName() {
    return name;
    public void setManufacturer(Manufacturer manufacturer) {
    this.manufacturer = manufacturer;
    public Manufacturer getManufacturer() {
    return manufacturer;
    public void setId(Long id) {
    this.id = id;
    public Long getId() {
    return id;
    Here is the SOAP request:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.matchbox.edmunds.com/">
    <soapenv:Header/>
    <soapenv:Body>
    <ws:findMakeElement>
    <ws:Long_1>22</ws:Long_1>
    </ws:findMakeElement>
    </soapenv:Body>
    </soapenv:Envelope>
    Here is the SOAP response:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://ws.matchbox.edmunds.com/" xmlns:ns1="http://definition.vehicle.edmunds.com/" xmlns:ns2="http://www.oracle.com/webservices/internal/literal" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <env:Body>
    <env:Fault>
    <faultcode>env:Server</faultcode>
    <faultstring>Internal Server Error (circular reference detected while serializing: com.edmunds.vehicle.definition.Make)</faultstring>
    </env:Fault>
    </env:Body>
    </env:Envelope>
    Here is my WSDL:
    <?xml version="1.0" encoding="UTF-8" ?>
    <definitions
    name="VehicleService"
    targetNamespace="http://ws.matchbox.edmunds.com/"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="http://ws.matchbox.edmunds.com/"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:tns0="http://definition.vehicle.edmunds.com/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tns1="http://www.oracle.com/webservices/internal/literal"
    >
    <types>
    <schema elementFormDefault="qualified" targetNamespace="http://definition.vehicle.edmunds.com/"
    xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://www.oracle.com/webservices/internal/literal"
    xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://definition.vehicle.edmunds.com/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <import namespace="http://ws.matchbox.edmunds.com/"/>
    <import namespace="http://www.oracle.com/webservices/internal/literal"/>
    <complexType name="Make">
    <sequence>
    <element name="manufacturer" nillable="true" type="tns:Manufacturer"/>
    <element name="models" nillable="true" type="ns1:set"/>
    <element name="name" nillable="true" type="string"/>
    <element name="id" nillable="true" type="long"/>
    </sequence>
    </complexType>
    <complexType name="Manufacturer">
    <sequence>
    <element name="makes" nillable="true" type="ns1:set"/>
    <element name="name" nillable="true" type="string"/>
    <element name="id" nillable="true" type="long"/>
    </sequence>
    </complexType>
    </schema>
    <schema elementFormDefault="qualified" targetNamespace="http://www.oracle.com/webservices/internal/literal"
    xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:tns="http://www.oracle.com/webservices/internal/literal" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <import namespace="http://ws.matchbox.edmunds.com/"/>
    <import namespace="http://definition.vehicle.edmunds.com/"/>
    <complexType name="set">
    <complexContent>
    <extension base="tns:collection">
    <sequence/>
    </extension>
    </complexContent>
    </complexType>
    <complexType name="collection">
    <sequence>
    <element maxOccurs="unbounded" minOccurs="0" name="item" type="anyType"/>
    </sequence>
    </complexType>
    </schema>
    <schema elementFormDefault="qualified" targetNamespace="http://ws.matchbox.edmunds.com/"
    xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://definition.vehicle.edmunds.com/"
    xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://ws.matchbox.edmunds.com/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <import namespace="http://www.oracle.com/webservices/internal/literal"/>
    <import namespace="http://definition.vehicle.edmunds.com/"/>
    <element name="createMakeElement">
    <complexType>
    <sequence>
    <element name="String_1" nillable="true" type="string"/>
    <element name="String_2" nillable="true" type="string"/>
    </sequence>
    </complexType>
    </element>
    <element name="createMakeResponseElement">
    <complexType>
    <sequence/>
    </complexType>
    </element>
    <element name="findMakeElement">
    <complexType>
    <sequence>
    <element name="Long_1" nillable="true" type="long"/>
    </sequence>
    </complexType>
    </element>
    <element name="findMakeResponseElement">
    <complexType>
    <sequence>
    <element name="result" nillable="true" type="ns1:Make"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    </types>
    <message name="RemoteTestVehicleServiceWS_createMake">
    <part name="parameters" element="tns:createMakeElement"/>
    </message>
    <message name="RemoteTestVehicleServiceWS_createMakeResponse">
    <part name="parameters" element="tns:createMakeResponseElement"/>
    </message>
    <message name="RemoteTestVehicleServiceWS_findMake">
    <part name="parameters" element="tns:findMakeElement"/>
    </message>
    <message name="RemoteTestVehicleServiceWS_findMakeResponse">
    <part name="parameters" element="tns:findMakeResponseElement"/>
    </message>
    <portType name="RemoteTestVehicleServiceWS">
    <operation name="createMake">
    <input message="tns:RemoteTestVehicleServiceWS_createMake"/>
    <output message="tns:RemoteTestVehicleServiceWS_createMakeResponse"/>
    </operation>
    <operation name="findMake">
    <input message="tns:RemoteTestVehicleServiceWS_findMake"/>
    <output message="tns:RemoteTestVehicleServiceWS_findMakeResponse"/>
    </operation>
    </portType>
    <binding name="HttpSoap11Binding" type="tns:RemoteTestVehicleServiceWS">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="createMake">
    <soap:operation soapAction="http://ws.matchbox.edmunds.com//createMake"/>
    <input>
    <soap:body use="literal"/>
    </input>
    <output>
    <soap:body use="literal"/>
    </output>
    </operation>
    <operation name="findMake">
    <soap:operation soapAction="http://ws.matchbox.edmunds.com//findMake"/>
    <input>
    <soap:body use="literal"/>
    </input>
    <output>
    <soap:body use="literal"/>
    </output>
    </operation>
    </binding>
    <service name="VehicleService">
    <port name="HttpSoap11" binding="tns:HttpSoap11Binding">
    <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
    </port>
    </service>
    </definitions>

    Graph and Circular dependencies cannot be model with document-literal message format with POJO development style. You will need to invent your own model to break the cycle and uses a mechanism similar to href, as with RPC-encoded message format.
    All the best,
    -Eric

  • Phantom circular reference errors in spreadsheet

    I'm getting phantom circular reference errors in one of my Appleworks spreadsheets.
    I'm trying to compute the average of several sets of pairs of numbers, I have max of three pairs per line, and I'm using COUNT to determine how many pairs are present. I'm getting "can't resolve circular reference" errors occasionally when I fill down and add data for a new line, even though there aren't any circular references.
    Columns
    A= date, B=average X, C=averageY, D=number of pairs for this line
    E F = first pair, G H = second pair, I J = third pair.
    The second and third pair don't occur every day.
    These are the formulas I'm using,
    B average_X =(E_line# + G_line# + Iline#)/Dline#
    C average_Y =(F_line# + H_line# + Jline#)/Dline#
    D numPairs =COUNT(Eline#...Jline#)/2
    I add a new line each day.
    Its worked just fine until I went over 100 lines and now I occasionally get "can't resolve circular reference" erros, and the calculation cells, but there AREN'T any circular references.
    Anyone have any idea whats going on?

    I'm using AW 6.2.7 I'm on OS X 10.3.9
    I tried it with removing the AVERAGE and COUNT functions and it still happens.
    Seems like its somehow related to any references to columns J and K, even if there's no data in those cells, and no references to other cells.
    Its related to the COUNT function.
    If I drop off the last two columns it all seems to work ok.
    =(F153+H153)/(E153/2)
    where E153 is =COUNT(F153..I153)
    But if I try to use the last pair (columns J and K) it gets errors
    =(F153H153I153)/(E153/2)
    where E153 is =COUNT(F153..K153)
    DOES the COUNT function have a limitation to how many cells it can reference?
    It seems like for some reason the J column is corrupted. sometimes if there is any number in colum J it gets "circular reference error" EVEN though there is NO circulare reference only a number.
    BUT when I delete the number from Column J the error goes away.

  • Server Error (circular reference detected while serializing: )

    Hi,
    I just installed OC4J and it looks great. I have a problem however ...
    I used JBuilder to generate entity beans from database. Then I generated a session bean with facade methods, and finally I created a session bean which injects the facade and is annotated with @WebService to publish a method (so that I could test the entity).
    However, when trying to run findAllEmployees() I get this error returned:
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://logic.porter.xait.no/" xmlns:ns1="http://www.oracle.com/webservices/internal/literal"><env:Body><env:Fault><faultcode>env:Server</faultcode><faultstring>Internal Server Error (circular reference detected while serializing: no.bie.persistence.Employee)</faultstring></env:Fault></env:Body></env:Envelope>
    I suspect this has something to do with the relationships between tables (@OneToMany etc.) -- but does anyone have more information on what would cause this problem and how to fix it?
    Thanks!

    Hei Guys -
    I see that the ClassLoader exceptions are known, and are "to be ignored".
    I left a reference to them, in case they play into our problems anyway.....
    "java.lang.IllegalStateException: ClassLoader" - known harmless bug... ?
    Best Regards,
    Charles

  • "Circular reference"  dont work in Numbers????

    I am an OLD Excel-user:) My big spreadsheets worked VERY-good there; even those which are full of "circulare references" it could handle.
    And now I have changed to Numbers and have transferred my spreadsheet from Excel to Numbers.
    The simple spreadsheets works very fine in Numbers too.
    But not my big spreadsheets with those "circulare references" - I get a LOTS of error-messages there.
    - I used nearly all my holiday in trying to handle those "circulare references":::::::::: sooooo I am hoping that someone kind/CLEVER person inhere might be able to help me - to tell me how to handle it....:)
    TX a lot.....

    Hello
    It's not a bug, it's a choice.
    The engineers choose to treat a circular ref as an error.
    I know that some others made an other choice but I am unable to tell which is right.
    On the forum, we are not Apple employees but users trying to help other users. So I doubt that some one may help you here.
    Just a track, maybe you may use the ISERR() function to intercept the oddity but you will not be able to change the standard behaviour: a cell is not allowed to use it's contents in calculations.
    The best thing to do is:
    *Go to "Provide Numbers Feedback" in the "Numbers" menu*, describe what you wish.
    Then, cross your fingers, and wait for iWork'09
    Yvan KOENIG (from FRANCE mercredi 2 janvier 2008 15:52:49)

  • Why can't I clear a spreadsheet cell marked as having a circular reference?

    I have a spreadsheet cell, FH67, with the formula " =30*FG67/sum(FG38..FG670) " that is marked as a circular reference. All cells referred to are either numbers or are the formula " = FD40*FE40 ". This should not be a circular reference! This same formula occurs in about every 5th column without any circular reference being noted.
    The real problem is that I cannot alter that cell in any way without the rotating round ball appearing and then nothing can be done until I force quit AppleWorks.
    I assume that something has corrupted the cell. How can I correct the problem?
    iBook   Mac OS X (10.3.9)  
    iBook   Mac OS X (10.3.9)  

    Welcome to Apple Discussions
    It looks like a circular reference to me. The cell FG67 to be divided is also in the sum (FG38 through FG670). But I'll let you sort that out.
    I don't get the spinning beach ball/lollipop when I accidentally create a circular reference, so I doubt that's the cause. The usual cause of that is a full Recent Items folder. Of course, any time you force quit AppleWorks, some corruption of the preferences is likely. First I suggest you check the Recent Items & then delete the AppleWorks preferences before trying that spreadsheet again.
    Some user tips for more information on Recent Items & AppleWorks preferences:
    AppleWorks slow? Spinning ball appears?
    Recent items not visible/updated
    AppleWorks has stopped working correctly

  • How do I programmatically reference the current page in 902?

    Hello,
    How do I programmatically reference the current page in 902?
    The Portal Smart Text option for Current Page is not flexible enough, and I wish to create my own custom greeting using PL/SQL.
    Cheers,
    John

    hi,
    If you are developing a PLSQL Portlet, then you do have a way for getting the page URL.
    The page URL can be obtained from the record, portlet_runtime_record. There is a filed page_urlavailable with portlet_runtime_record.
    The portlet_runtime_record is passed as a argument to the show_portlet procedure.
    --Sriram                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to get the reference of the cell id in validate method in adf

    Hi All,
    I am using Jdeveloper 11.1.1.2 and i am using custom validator where i have registered the validator in facesconfig.xml.I need to know how can i get the ID of the inputtext box which is present in the hierarchy as Panel Header->Table->column->textbox :-
    Below is my custom validator class source , please tell me how to get the reference of the textbox which is present in such hierarchy.:-
    package validator;
    import java.io.Serializable;
    import java.util.Date;
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.validator.Validator;
    import javax.faces.validator.ValidatorException;
    import oracle.adf.view.rich.component.rich.input.RichInputDate;
    import oracle.adf.view.rich.component.rich.input.RichInputText;
    import oracle.adfinternal.view.faces.bi.util.JsfUtils;
    public class ValidateConversion implements Serializable, Validator {
    public ValidateConversion() {
    super();
    public void validate(FacesContext facesContext, UIComponent uIComponent,
    Object object) throws ValidatorException {
    System.out.println("*************");
    System.out.println((String)object);
    //get component id by get("AttributeName");
    String conversionComponentId = (String)uIComponent.getAttributes().get("UncommittedOrder_PH:t7:it14");
    System.out.println("conversionComponentId=" + conversionComponentId);
    RichInputText conversionComponent = (RichInputText)uIComponent.findComponent(conversionComponentId);
    Integer conversion = (Integer)conversionComponent.getValue();
    Integer quantityInBags = (Integer)object;
    //get labels from the two inputDate component.
    String conversionLabel = conversionComponent.getLabel();
    String quantityInBagsLabel = ((RichInputText)uIComponent).getLabel();
    Integer remainder = (quantityInBags % conversion);
    //throw error if valiation fails
    if (remainder > 0) {
    throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
    "The " + quantityInBagsLabel + " should be in multiples of" + conversion +".",
    null));
    Thanks,
    Plese reply!!!

    Thanks Jabr,
    This is my jsff page source and i need to find the reference of it14 which is the textbox :-
    <af:panelGroupLayout id="pgl1" styleClass="AFStretchWidth">
    <af:panelHeader text="Results" id="Results_PH" size="1">
    <af:table value="#{bindings.queryProductResponseType.collectionModel}"
    var="row"
    rows="#{bindings.queryProductResponseType.rangeSize}"
    emptyText="#{bindings.queryProductResponseType.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.queryProductResponseType.rangeSize}"
    rowBandingInterval="1"
    filterModel="#{bindings.queryProductResponseTypeQuery.queryDescriptor}"
    queryListener="#{bindings.queryProductResponseTypeQuery.processQuery}"
    filterVisible="true" varStatus="vs" id="ResultTable_t"
    width="99%" partialTriggers="::cb1 ::cb2 ::cb3 it14"
    binding="#{viewScope.GrowerOrderBean.resultTable}"
    columnStretching="last" rowSelection="multiple"
    sortListener="#{viewScope.GrowerOrderBean.sortResultTable_action}"
    autoHeightRows="8" first="0"
    inlineStyle="height:196px;margin:10px"
    selectionListener="#{viewScope.GrowerOrderBean.resultRowSelect_action}">
    <af:column filterable="false" sortable="false" headerText="Select"
    id="c9" width="55" rendered="false"
    filterFeatures="caseInsensitive">
    <div align="center">
    <af:selectBooleanCheckbox value="#{row.bindings.booleanFlag.inputValue}"
    label="#{bindings.queryProductResponseType.hints.booleanFlag.label}"
    required="#{bindings.queryProductResponseType.hints.booleanFlag.mandatory}"
    shortDesc="#{bindings.queryProductResponseType.hints.booleanFlag.tooltip}"
    id="it19" autoSubmit="true">
    <f:validator binding="#{row.bindings.booleanFlag.validator}"/>
    </af:selectBooleanCheckbox>
    </div>
    </af:column>
    <!-- START of column created by SYSTIME -->
    <af:column sortProperty="quantity" headerText="Quantity in Bags" filterFeatures="caseInsensitive"
    id="c54" rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterable="true" sortable="true">
    <af:inputText label="Quantity in Bags" id="it14"
    partialTriggers="it19" autoSubmit="true"
    readOnly="#{row.activeYN == 'N' or row.availability &lt; 0 or row.availability ==0}"
    valueChangeListener="#{viewScope.GrowerOrderBean.compare}">
    <af:validateLongRange id="RangeCheck_Val1" minimum="1"
    maximum="#{row.availability * row.conversion}"
    messageDetailNotInRange="You have entered a quantity more than is available. Quantity entered must be in the range of {2} to {3}"
    messageDetailMinimum="Minimum {0} allowed is {2}"
    messageDetailMaximum="Maximum {0} allowed is {2}"
    hintNotInRange="#{'Quantity In Bags to Order'}"/>
    <af:validateRegExp pattern="^[1-9]+[0-9]*$"
    messageDetailNoMatch="Quantity In Bags must be in whole number format."/>
    <f:validator validatorId="custom.conversionValidator"/>
    </af:inputText>
    </af:column>
    <!-- END of column created by SYSTIME -->
    <af:column sortProperty="quantity" filterable="true"
    sortable="true" headerText="Quantity" id="c3"
    width="60"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive" visible="false">
    <div align="center" >
    <af:inputText value="#{row.bindings.quantity.inputValue}"
    label="#{bindings.queryProductResponseType.hints.quantity.label}"
    required="#{bindings.queryProductResponseType.hints.quantity.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.quantity.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.quantity.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.quantity.tooltip}"
    id="it5" partialTriggers="it19"
    readOnly="#{row.activeYN == 'N' or row.availability &lt; 0 or row.availability ==0}">
    <f:validator binding="#{row.bindings.quantity.validator}"/>
    <af:validateLongRange id="RangeCheck_Val" minimum="1"
    maximum="#{row.bindings.availability.inputValue}"
    messageDetailNotInRange="You have entered a quantity more than is available. Quantity entered must be in the range of {2} to {3}"
    messageDetailMinimum="Minimum {0} allowed is {2}"
    messageDetailMaximum="Maximum {0} allowed is {2}"
    hintNotInRange="#{'Quantity to Order'}"/>
    <af:validateRegExp pattern="^[1-9]+[0-9]*$"
    messageDetailNoMatch="Quantity must be in whole number format."/>
    </af:inputText>
    </div>
    </af:column>
    <af:column sortProperty="brand" filterable="true" sortable="true"
    headerText="Brand" id="c10" width="80"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive" displayIndex="-1">
    <af:inputText value="#{row.bindings.brand.inputValue}"
    label="#{bindings.queryProductResponseType.hints.brand.label}"
    required="#{bindings.queryProductResponseType.hints.brand.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.brand.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.brand.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.brand.tooltip}"
    id="it7" readOnly="true">
    <f:validator binding="#{row.bindings.brand.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="seedsz" filterable="true" sortable="true"
    headerText="Seed Size" id="c7" width="50"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive">
    <af:inputText value="#{row.bindings.seedsz.inputValue}"
    label="#{bindings.queryProductResponseType.hints.seedsz.label}"
    required="#{bindings.queryProductResponseType.hints.seedsz.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.seedsz.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.seedsz.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.seedsz.tooltip}"
    id="it11" readOnly="true"
    contentStyle="text-transform:uppercase">
    <f:validator binding="#{row.bindings.seedsz.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="pckSize" filterable="true"
    sortable="true" headerText="Pkg Size" id="c11"
    width="50"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive"
    inlineStyle="#{row.conversion > 1 ? 'background-color:Yellow;' : 'background-color:White;'}">
    <af:inputText value="#{row.bindings.pckSize.inputValue}"
    label="#{bindings.queryProductResponseType.hints.pckSize.label}"
    required="#{bindings.queryProductResponseType.hints.pckSize.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.pckSize.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.pckSize.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.pckSize.tooltip}"
    id="it8" readOnly="true">
    <f:validator binding="#{row.bindings.pckSize.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="conversion" filterable="true"
    sortable="true" headerText="Conv" id="c4" width="50"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive" displayIndex="-1">
    <af:inputText value="#{row.bindings.conversion.inputValue}"
    label="#{bindings.queryProductResponseType.hints.conversion.label}"
    required="#{bindings.queryProductResponseType.hints.conversion.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.conversion.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.conversion.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.conversion.tooltip}"
    id="conversion_it" readOnly="true">
    <f:validator binding="#{row.bindings.conversion.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="treatment" filterable="true"
    sortable="true" headerText="Treatment" id="c13"
    width="70"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive">
    <af:inputText value="#{row.bindings.treatment.inputValue}"
    label="#{bindings.queryProductResponseType.hints.treatment.label}"
    required="#{bindings.queryProductResponseType.hints.treatment.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.treatment.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.treatment.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.treatment.tooltip}"
    id="it20" readOnly="true">
    <f:validator binding="#{row.bindings.treatment.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="availability" filterable="true"
    sortable="true" headerText="Availability" id="c15"
    width="60"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive">
    <af:inputText value="#{row.availability> 500 ? '>=500': (row.availability> 100 and row.availability&lt;500 ? '100-500' : row.availability) }"
    label="#{bindings.queryProductResponseType.hints.availability.label}"
    required="#{bindings.queryProductResponseType.hints.availability.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.availability.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.availability.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.availability.tooltip}"
    id="it9" readOnly="true">
    <f:validator binding="#{row.bindings.availability.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="desiredDeliveryDate" filterable="true"
    sortable="true" headerText="Desired Delivery Month" id="c2"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive" width="90">
    <af:selectOneChoice id="soc1" partialTriggers="it19"
    unselectedLabel="#{viewScope.GrowerOrderBean.desiredDeliveryDate}"
    value="#{row.bindings.desiredDeliveryDate.inputValue}"
    readOnly="#{row.activeYN == 'N'}">
    <af:forEach var="item"
    items="#{viewScope.GrowerOrderBean.selectItems}">
    <af:selectItem label="#{item.label}" value="#{item.value}"/>
    </af:forEach>
    </af:selectOneChoice>
    </af:column>
    <af:column sortProperty="maturity" filterable="true"
    sortable="true" headerText="Maturity" id="c5"
    width="60"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive">
    <div align="center">
    <af:inputText value="#{row.bindings.maturity.inputValue}"
    label="#{bindings.queryProductResponseType.hints.maturity.label}"
    required="#{bindings.queryProductResponseType.hints.maturity.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.maturity.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.maturity.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.maturity.tooltip}"
    id="it16" readOnly="true">
    <f:validator binding="#{row.bindings.maturity.validator}"/>
    </af:inputText>
    </div>
    </af:column>
    <af:column sortProperty="technology" filterable="true"
    sortable="true" headerText="Technology" id="c14"
    rendered="true" filterFeatures="caseInsensitive">
    <af:inputText value="#{row.bindings.technology.inputValue}"
    label="#{bindings.queryProductResponseType.hints.technology.label}"
    required="#{bindings.queryProductResponseType.hints.technology.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.technology.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.technology.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.technology.tooltip}"
    id="it15" readOnly="true">
    <f:validator binding="#{row.bindings.technology.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="prdLine" filterable="true"
    sortable="true" headerText="Product Line" id="c6"
    width="70"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive">
    <af:inputText value="#{row.bindings.prdLine.inputValue}"
    label="#{bindings.queryProductResponseType.hints.prdLine.label}"
    required="#{bindings.queryProductResponseType.hints.prdLine.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.prdLine.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.prdLine.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.prdLine.tooltip}"
    id="it12" readOnly="true">
    <f:validator binding="#{row.bindings.prdLine.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="brandMktName" filterable="true"
    sortable="true" headerText="Marketing Brand" id="c8"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive" width="80">
    <af:inputText value="#{row.bindings.brandMktName.inputValue}"
    label="#{bindings.queryProductResponseType.hints.brandMktName.label}"
    required="#{bindings.queryProductResponseType.hints.brandMktName.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.brandMktName.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.brandMktName.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.brandMktName.tooltip}"
    id="it17" readOnly="true">
    <f:validator binding="#{row.bindings.brandMktName.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="itemID" filterable="true" sortable="true"
    headerText="Item#" id="c1"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive" width="60">
    <af:inputText value="#{row.bindings.itemID.inputValue}"
    label="#{bindings.queryProductResponseType.hints.itemID.label}"
    required="#{bindings.queryProductResponseType.hints.itemID.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.itemID.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.itemID.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.itemID.tooltip}"
    id="it6" readOnly="true">
    <f:validator binding="#{row.bindings.itemID.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="descp" filterable="true" sortable="true"
    headerText="Description" id="c17" width="105"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive">
    <af:inputText value="#{row.bindings.descp.inputValue}"
    label="#{bindings.queryProductResponseType.hints.descp.label}"
    required="#{bindings.queryProductResponseType.hints.descp.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.descp.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.descp.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.descp.tooltip}"
    id="it10" readOnly="true">
    <f:validator binding="#{row.bindings.descp.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="primaryUOM" filterable="true"
    sortable="true"
    headerText="#{bindings.queryProductResponseType.hints.primaryUOM.label}"
    id="c16" rendered="false"
    filterFeatures="caseInsensitive">
    <af:inputText value="#{row.bindings.primaryUOM.inputValue}"
    label="#{bindings.queryProductResponseType.hints.primaryUOM.label}"
    required="#{bindings.queryProductResponseType.hints.primaryUOM.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.primaryUOM.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.primaryUOM.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.primaryUOM.tooltip}"
    id="it18">
    <f:validator binding="#{row.bindings.primaryUOM.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="secondaryUOM" filterable="true"
    sortable="true"
    headerText="#{bindings.queryProductResponseType.hints.secondaryUOM.label}"
    id="c12" rendered="false"
    filterFeatures="caseInsensitive">
    <af:inputText value="#{row.bindings.secondaryUOM.inputValue}"
    label="#{bindings.queryProductResponseType.hints.secondaryUOM.label}"
    required="#{bindings.queryProductResponseType.hints.secondaryUOM.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.secondaryUOM.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.secondaryUOM.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.secondaryUOM.tooltip}"
    id="it21">
    <f:validator binding="#{row.bindings.secondaryUOM.validator}"/>
    </af:inputText>
    </af:column>
    </af:table>
    <af:spacer width="10" height="5" id="s7"/>
    <af:toolbar id="t1">
    <af:commandButton id="AddToOrderButton2"
    actionListener="#{viewScope.GrowerOrderBean.addToOrder_action}"
    partialSubmit="true"
    styleClass="addToOrderButton">
    <af:clientListener method="setFocus" type="action"/>
    </af:commandButton>
    </af:toolbar>
    <f:facet name="context">
    <af:group id="g1">
    <af:spacer width="60" height="10" id="s1"/>
    <af:commandButton id="cb4"
    actionListener="#{viewScope.GrowerOrderBean.addToOrder_action}"
    partialSubmit="true"
    styleClass="addToOrderButton">
    <af:clientListener method="setFocus" type="action"/>
    </af:commandButton>
    </af:group>
    </f:facet>
    <f:facet name="info"/>
    <f:facet name="legend"/>
    <f:facet name="menuBar"/>
    <f:facet name="toolbar"/>
    </af:panelHeader>
    </jsp:root>
    Please reply !!
    Thanks.

  • HOW to include a reference currency fields in a view ?

    Hello Experts,
    <b>I am having Currency fields error in generic extraction</b>
    I have table where I am trying to extract data to BW via generic extraction. When I tried
    to extract with the TABLE its giving me an error
    <b>Invalid extract structure template RPSCO of DataSource ZBW_REP3_TEST
    You tried to generate an extract structure with the template structure RPSCO. This operation failed, because the template structure quantityfields or currency fields, for example, field WLP00 refer to a differenttable</b>.
    Now I created a view with all the fields same as my table.
    But its still giving me the same error and taking all the fields as a primary keys. I have over 12 currency fields in the table. I am confused how to fix this issue and add a currency field to my view?
    hOW to include a reference currency fields in a view ?
    All inputs are much appreciated.
    Thanks and Regards,
    Harish

    Thank you for your responce,
    Can you please check my view and let me know where I am going wrong     
    View    Table   Field  Dataele  Data
    field                    type                                            0                                                                
    WLP01     RPSCO     WLP01     BP_WPL     CURR     15     Period value in ledger currency
    WLP02     RPSCO     WLP02     BP_WPL     CURR     15     Period value in ledger currency
    WLP03     RPSCO     WLP03     BP_WPL     CURR     15     Period value in ledger currency
    WLP04     RPSCO     WLP04     BP_WPL     CURR     15     Period value in ledger currency
    WLP05     RPSCO     WLP05     BP_WPL     CURR     15     Period value in ledger currency
    WLP06     RPSCO     WLP06     BP_WPL     CURR     15     Period value in ledger currency
    WLP07     RPSCO     WLP07     BP_WPL     CURR     15     Period value in ledger currency
    WLP08     RPSCO     WLP08     BP_WPL     CURR     15     Period value in ledger currency
    WLP09     RPSCO     WLP09     BP_WPL     CURR     15     Period value in ledger currency
    If I add a
    Table TCURC against any field what would be the view field and data element
    Do I need to tick MOD?
    Please suggest.
    Kapadia,
    If I do that its still taking all the fields are a primary keys and bringing 6 lakh records to where I originally have 49 records in a table
    Thanks and Regards,
    Harish

  • How to make External Reference number and Ref Date Mandatory in Complaints

    Dear Experts,
    Greetings!!!.
    How to make External Reference number (EXT_REF_NUMBER ) and Ref Date ( EXT_REF_DATE ) Mandatory in Complaints.
    Regards,
    Sany

    HI,
    You can use Incompleteness Procedure to make those fields mandatory in complaint transaction.
    Regards,
    PP

  • How to get File Reference of a properties file from EJB

    Hi,
    I am using Sun App server 7 with Oracle 9i. I am keeping all my SQL statements in a properties file from which I am loading it while making a database operation from Stateless beans. My problem is I am not able to get the reference of the properties file. Here is the code through which I am getting the SQL statements loaded to a cache.
    String sqlFileName = "SQL.properties";
    sqlCache.load(new FileInputStream(sqlFileName));
    From the cache I am sending the SQL statement depending on the key value. But the problem is I have to keep the SQL.properties file on the App Server config directory of the instance where the server.xml file resides. Otherwise it is not able to find the properties file. But I don't want to put the properties file on the config directory of the server instance. Please help how to get the properties file from the packakge. My file is residing inside a package com.company.sql . Botht the properties file and the class accessing the file are residing in the same package. Please help how to get the reference of the file with out putting the file in the config directory.
    Thanks
    Amit Patnaik

    Just wanted to warn you of the hazards if you read a file from EJB
    So please make sure that these hazards will not affect your application. However the solution suggested to use getResourceStream() concurs with ejbSpec
    This snippet is from suns blueprint on ejb
    Why can't EJBs read and write files and directories in the filesystem? And why can't they access file descriptors?
    Enterprise beans aren't allowed to access files primarily because files are not transactional resources. Allowing EJBs to access files or directories in the filesystem, or to use file descriptors, would compromise component distributability, and would be a security hazard.
    Another reason is deployability. The EJB container can choose to place an enterprise bean in any JVM, on any machine in a cluster. Yet the contents of a filesystem are not part of a deployment, and are therefore outside of the EJB container's control. File systems, directories, files, and especially file descriptors tend to be machine-local resources. If an enterprise bean running in a JVM on a particular machine is using or holding an open file descriptor to a file in the filesystem, that enterprise bean cannot easily be moved from one JVM or machine to another, without losing its reference to the file.
    Furthermore, giving EJBs access to the filesystem is a security hazard, since the enterprise bean could potentially read and broadcast the contents of sensitive files, or even upload and overwrite the JVM runtime binary for malicious purposes.
    Files are not an appropriate mechanism for storing business data for use by components, because they tend to be unstructured, are not under the control of the server environment, and typically don't provide distributed transactional access or fine-grained locking. Business data is better managed using a persistence interface such as JDBC, whose implementations usually provide these benefits. Read-only data can, however, be stored in files in a deployment JAR, and accessed with the getResource() or getResourceAsStream() methods of java.lang.Class.
    Hope this info helps!

  • Weak/Soft/Phantom/Circular references

    Hi,
    Could you please explain the below with example?
    Weak/Soft/Phantom/Circular references in java and when It should be used in what situations? What are the pros and cons?
    Please clarify.
    Thanks.

    What part of the Javadoc didn't you understand?
    BTW circular references do not belong with the others. A doubly linked list is an example of a set of circular references: there is a chain of references that leads back to the starting point. This is also known as a cyclic graph.

Maybe you are looking for