RE: type of an attribute

Hi Pradnesh
You have set off an interesting discussion. Here is what I guess must
have happened. You have n subclasses of datavalue class that require n+1
th subclass as an attribute. So why not promote that attribute to the
super class ?
Is it semantically valid ?Yes. I think it makes sense
Is it a good design ?I ask myself the following questions
- is it easy comprehend ?i.e., does it look natural or does it look
like trickery ?
- do I know how to make it work ?
- do I gain in coding ? (based amount of coding involved in the two
cases)
- does it cause difficulty in maintenance ?
Regards
Manjunatha Kubasada
Complete Business Solutions
[email protected]
(630) 271-3346
Disclaimer : Opinions expressed are my own
From: Dange, Pradnesh
To: '[email protected]'
Subject: type of an attribute
Date: Monday, July 14, 1997 3:17PM
Hi ,
In forte framework library I found following implementation:
The DataValue class has a attribute TextValue of type TextData. While
TextData class is sub-class of DataValue. This is a recusrive defination
of class.
This raises a question, can we have an attribute of a class of type
sub-class of the same class ? Is it semantically valid ? Is it a good
design ?
Pradnesh Dange
Indus Consultancy Services
201-261-3100

"Dange, Pradnesh" <[email protected]> writes:
The DataValue class has a attribute TextValue of type TextData.
While TextData class is sub-class of DataValue. This is a
recursive definition of class.
This raises a question, can we have an attribute of a class of
type sub-class of the same class ? Is it semantically valid ? My experience (Forte 2.0.H.1/2) says "yes, but you'd better be
careful how you get that attribute initialized". In my case, I
blindly "new-ed" the attribute in question in the Init method,
and Forte vanished without a trace as soon as any member of the
hierarchy got created. The solution was to find another place to
initialize the attribute. Making it virtual is one way to go,
but it was not necessary in my case, since it was a private
attribute anyway.
Is it a good design ?I have no idea. Forte did it, but that's indicative, not
definitive.
Tom Wyant

Similar Messages

  • Type of Value Attribute

    Hi,
    The version of my NetWeaver Developer Studio is 2.0.9
    This Version does not support com.sap.ide.webdynpro.uielementdefinitions.Resource type for Context Attribute.(in which resource is missing)
    My task is to upload and parse a XML file.
    How to replace this type?
    Thanks,
    RPN

    Hi
    https://www.sdn.sap.com/irj/sdn/advancedsearch?query=typeofValueAttribute++&cat=sdn_all
    Chech this link
    Regards
    Ruturaj

  • How to change the mining type of an attribute?

    Quite often, when I build a model with Naive Bayes algorithm (using DBMS_DATA_MINING package) I get a model with some attributes
    being type of VARCHAR2 and categorical mining type although the
    data type of these attributes are NUMBER.
    My question is, on what basis does ODM assign mining type to an attribute?
    Is that the number of distinct values of an attribute?
    Can I change these mining types somehow using PL/SQL?
    I'm using ODM 10g R2
    Thank you
    Luke

    Quite often, when I build a model with Naive Bayes algorithm (using DBMS_DATA_MINING package) I get a model with some attributes
    being type of VARCHAR2 and categorical mining type although the
    data type of these attributes are NUMBER.
    My question is, on what basis does ODM assign mining type to an attribute?
    Is that the number of distinct values of an attribute?
    Can I change these mining types somehow using PL/SQL?
    I'm using ODM 10g R2
    Thank you
    Luke

  • MPP, MPS/MPP, MRP/MPP Type(In Item Attribute)

    What is the difference between we use MPP, MPS/MPP, MRP/MPP Type(In Item Attributes)?

    Lokesh,
    ASCP Release 11i10 included a significant number of enhancements related to master scheduling, two level scheduling, and hub & spoke processes. At that time, Oracle was also planning the release of a major new product offering Distribution Planning (also called Deployment planning), this was introduced in Release 12. As part of these improvements, Oracle changed the traditional name for DRP plans to MPP (Master Production Plans) to avoid any confusion with the newly created DRP product. The old functionality of having multiple plans work together (DRP,MPS,MRP) in a chained fashion still works, but the names are now (MPP,MPS,MRP)
    The item attributes were changed as shown below:
    - Not Planned
    - MRP Planning
    - MPS Planning
    - MRP/MPP Planned
    - MPS/MPP Planned <<-- formerly MPS/DRP planned
    - MPP Planned <<-- formerly DRP planned
    These attributes have the same meaning as before and a full description can be found in the Oracle MRP/Master Scheduling User Guide
    Regards,
    Kevin Creel
    www.inspirage.com

  • How to sort a Vector that stores a particular object type, by an attribute?

    Hi guys,
    i need help on this problem that i'm having. i have a vector that stores a particular object type, and i would like to sort the elements in that vector alphabetically, by comparing the attribute contained in that element. here's the code:
    Class that creates the object
    public class Patient {
    private String patientName, nameOfParent, phoneNumber;
    private GregorianCalendar dateOfBirth;
    private char sex;
    private MedicalHistory medHistory;
    public Patient (String patientName, String nameOfParent, String phoneNumber, GregorianCalendar dateOfBirth, char sex) {
    this.patientName = patientName;
    this.nameOfParent = nameOfParent;
    this.phoneNumber = phoneNumber;
    this.dateOfBirth = dateOfBirth;
    this.sex = sex;
    this.medHistory = new MedicalHistory();
    Class that creates the Vector.
    public class PatientDatabase {
    private Vector <Patient> patientDB = new Vector <Patient> ();
    private DateFunction date = new DateFunction();
    public PatientDatabase () throws IOException{
    String textLine;
    BufferedReader console = new BufferedReader(new FileReader("patient.txt"));
    while ((textLine = console.readLine()) != null) {
    StringTokenizer inReader = new StringTokenizer(textLine,"\t");
    if(inReader.countTokens() != 7)
    throw new IOException("Invalid Input Format");
    else {
    String patientName = inReader.nextToken();
    String nameOfParent = inReader.nextToken();
    String phoneNum = inReader.nextToken();
    int birthYear = Integer.parseInt(inReader.nextToken());
    int birthMonth = Integer.parseInt(inReader.nextToken());
    int birthDay = Integer.parseInt(inReader.nextToken());
    char sex = inReader.nextToken().charAt(0);
    GregorianCalendar dateOfBirth = new GregorianCalendar(birthYear, birthMonth, birthDay);
    Patient newPatient = new Patient(patientName, nameOfParent, phoneNum, dateOfBirth, sex);
    patientDB.addElement(newPatient);
    console.close();
    *note that the constructor actually reads a file and tokenizes each element to an attribute, and each attribute is passed through the constructor of the Patient class to instantiate the object.  it then stores the object into the vector as an element.
    based on this, i would like to sort the vector according to the object's patientName attribute, alphabetically. can anyone out there help me on this?
    i have read most of the threads posted on this forum regarding similar issues, but i don't really understand on how the concept works and how would the Comparable be used to compare the patientName attributes.
    Thanks for your help, guys!

    Are you sure that you will always sort for the patient's name throughout the application? If not, you should consider using Comparators rather than implement Comparable. For the latter, one usually should ensure that the compare() method is consistent with equals(). As for health applications it is likely that there are patients having the same name, reducing compare to the patient's name is hazardous.
    Both, Comparator and Comparable are explained in Sun's Tutorial.

  • Custom Tag: pass my own type in as attribute

    I thought I can pass any type as attribute into my custom tag. I tried, but failed. The exception is:
    org.apache.jasper.JasperException: Unable to convert '${myType}' to class MyTpye for attribute myAttribute: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager.
    I know I can pass the value in using PageContext attribute. However, still want to figure out how to do it through custom tag attribute.
    Here's my taglig file:
    <tag>
    <name>myTag</name>
    <tag-class>MyTagClass</tag-class>
    <body-content>empty</body-content>
    <attribute>
    <name>myAttribute</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    <type>MyType</type>
    </attribute>
    </tag>
    What am I missing here? Thanks.

    Hi
    Pls tell me how did you resolve this issue. I am also facing the same problem.
    Thanks
    Prakash

  • Oracle 11g AQ : problem enqueue user-defined type with varchar2 attribute

    Hello.
    I have a problem enqueuing a user-defined type to the queue on Oracle 10g.
    I'm using jdbc driver (ojdbc5.jar, version 11.1.0.6.0) as they provide oracle.jdbc.aq package.
    The type is following:
    CREATE OR REPLACE TYPE FIXED_T5 AS OBJECT
    (id integer,
    label varchar2(100),
    code integer,
    today date
    )I have created a java class for this type with jpub utility supplied with oracle 11g client package:
    jpub -user=scott/tger -url=jdbc:oracle:thin:@host:sid-sql=FIXED_T5:ru.invito.FixedType -compile=falseIt generated FixedType.java and FixedTypeRef.java files. Don't understand why i need the latter (FixedTypeRef).
    Then in test app:
    package ru.invito;
    import java.io.IOException;
    import java.net.InetAddress;
    import java.net.UnknownHostException;
    import java.sql.SQLException;
    import java.sql.Timestamp;
    import java.util.Date;
    import java.util.Properties;
    import java.util.UUID;
    import junit.framework.TestCase;
    import oracle.jdbc.aq.AQAgent;
    import oracle.jdbc.aq.AQEnqueueOptions;
    import oracle.jdbc.aq.AQFactory;
    import oracle.jdbc.aq.AQMessage;
    import oracle.jdbc.aq.AQMessageProperties;
    import oracle.jdbc.aq.AQEnqueueOptions.DeliveryMode;
    import oracle.jdbc.aq.AQEnqueueOptions.VisibilityOption;
    import oracle.jdbc.driver.OracleConnection;
    import oracle.jdbc.driver.OracleDriver;
    import oracle.sql.Datum;
    import oracle.sql.STRUCT;
    import oracle.sql.StructDescriptor;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    public class AqTest extends TestCase {
         protected Log logger = LogFactory.getLog(getClass());
         public void testEnqueue() throws Exception {
              OracleDriver dr = new OracleDriver();
              Properties prop = new Properties();
              prop.setProperty("user", Config.USERNAME);
              prop.setProperty("password", Config.PASSWORD);
              OracleConnection connection = (OracleConnection) dr.connect(Config.JDBC_URL, prop);
              assertNotNull(connection);
              connection.setAutoCommit(false);
              enqueueMessage(connection, "INVITO.FIXED_T5Q", null);
              connection.commit();
         private void enqueueMessage(OracleConnection conn, String queueName, AQAgent[] recipients) throws SQLException,
                   IOException {
              logger.debug("----------- Enqueue start ------------");
              AQMessageProperties props = makeProps(queueName);
              AQMessage mesg = AQFactory.createAQMessage(props);
              String msqText = String.format("Hello, %s!", queueName);
              FixedType data = createData(36, msqText);
              Datum d = data.toDatum(conn);
              STRUCT s = (STRUCT) d;
              debugStruct("s", s);
              String toIdStr = byteBufferToHexString(s.getDescriptor().getOracleTypeADT().getTOID(), 20);
              logger.debug("s.toIdStr: " + toIdStr);
              StructDescriptor sd = StructDescriptor.createDescriptor("INVITO.FIXED_T5", conn);
              logger.debug("sd.toXMLString(): " + sd.toXMLString());
              mesg.setPayload(s);
              AQEnqueueOptions opt = makeEnqueueOptions();
              logger.debug("sending............");
              // execute the actual enqueue operation:
              conn.enqueue(queueName, opt, mesg);
              debugMessageId(mesg);
              logger.debug("----------- Enqueue done ------------");
         private void debugMessageId(AQMessage mesg) throws SQLException {
              byte[] mesgId = mesg.getMessageId();
              if (mesgId == null) {
                   throw new IllegalStateException("message id is NULL");
              String mesgIdStr = byteBufferToHexString(mesgId, 20);
              logger.debug("Message ID from enqueue call: " + mesgIdStr);
          * @return
          * @throws SQLException
         private FixedType createData(int ID, String label) throws SQLException {
              FixedType data = new FixedType();
              data._struct.setNChar(1);// initializes the flag for 'label' field
              data.setId(ID);
              data.setLabel(label);
              data.setCode(1);
              Date today = new Date();
              data.setToday(new Timestamp(today.getTime()));
              return data;
          * @param string
          * @param s
          * @throws SQLException
         private void debugStruct(String string, STRUCT s) throws SQLException {
              logger.debug(s + ".debugString(): " + s.debugString());
              logger.debug(s + "s.dump(): " + s.dump());
          * @return
          * @throws SQLException
         private AQAgent makeAgent() throws SQLException {
              AQAgent ag = AQFactory.createAQAgent();
              ag.setName("AQ_TEST");
              String agentAddress = null;
              try {
                   agentAddress = InetAddress.getLocalHost().getHostAddress();
              catch (UnknownHostException e) {
                   logger.error("cannot resolve localhost ip address. will not set it as AQ Agent address");
                   agentAddress = "NA";
              ag.setAddress(agentAddress);
              return ag;
         private AQMessageProperties makeProps(String queueName) throws SQLException {
              final String EXCEPTION_Q_TEMPLATE = "AQ$_%sT_E";
              final int DEFAULT_DELAY = 0;
              final int DEFAULT_EXPIRATION = -1;
              final int DEFAULT_PRIORITY = 0;
              AQMessageProperties propeties = AQFactory.createAQMessageProperties();
              propeties.setCorrelation(UUID.randomUUID().toString());
              propeties.setDelay(DEFAULT_DELAY);
              propeties.setExceptionQueue(String.format(EXCEPTION_Q_TEMPLATE, queueName));
              propeties.setExpiration(DEFAULT_EXPIRATION);
              propeties.setPriority(DEFAULT_PRIORITY);
              // propeties.setRecipientList(null);//should not set
              propeties.setSender(makeAgent());
              return propeties;
          * @return
          * @throws SQLException
         private AQEnqueueOptions makeEnqueueOptions() throws SQLException {
              AQEnqueueOptions opt = new AQEnqueueOptions();
              opt.setRetrieveMessageId(true);
              // these are the default settings (if none specified)
              opt.setDeliveryMode(DeliveryMode.PERSISTENT);
              opt.setTransformation(null);
              opt.setVisibility(VisibilityOption.ON_COMMIT);
              return opt;
          * Form the AQ reference
          * @param buffer
          * @param maxNbOfBytes
          * @return
         private static final String byteBufferToHexString(byte[] buffer, int maxNbOfBytes) {
              if (buffer == null)
                   return null;
              int offset = 0;
              StringBuffer sb = new StringBuffer();
              while (offset < buffer.length && offset < maxNbOfBytes) {
                   String hexrep = Integer.toHexString((int) buffer[offset] & 0xFF);
                   if (hexrep.length() == 1)
                        hexrep = "0" + hexrep;
                   sb.append(hexrep);
                   offset++;
              String ret = sb.toString();
              return ret;
    }The output is following:
    [main] 2008-07-03 19:09:49,863 DEBUG [ru.invito.AqTest] - ----------- Enqueue start ------------
    [main] 2008-07-03 19:09:50,348 DEBUG [ru.invito.AqTest] - [email protected](): name = INVITO.FIXED_T5 length = 4 attribute[0] = 36 attribute[1] = Hell
    o, INVITO.FIXED_T5Q! attribute[2] = 1 attribute[3] = 2008-07-03 19:09:49.0
    [main] 2008-07-03 19:09:50,363 DEBUG [ru.invito.AqTest] - [email protected](): name = INVITO.FIXED_T5
    length = 4
    ID = 36
    LABEL = Hello, INVITO.FIXED_T5Q!
    CODE = 1
    TODAY = 2008-07-03 19:09:49.0
    [main] 2008-07-03 19:09:50,363 DEBUG [ru.invito.AqTest] - s.toIdStr: 507ccce5b6e9f572e040007f01007203
    [main] 2008-07-03 19:09:50,363 DEBUG [ru.invito.AqTest] - sd.toXMLString(): <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <StructDescriptor sqlName="INVITO.FIXED_T5" >
      <OracleTypeADT sqlName="INVITO.FIXED_T5"  typecode="0" tds_version="1"
               is_embedded="false" is_top_level="true" is_upt="false" finalType="true" subtype="false">
        <attributes>
          <attribute name="ID"  type="INTEGER" >
            <OracleType typecode="2" />
          </attribute>
          <attribute name="LABEL"  type="VARCHAR2" >
            <OracleType typecode="12" />
          </attribute>
          <attribute name="CODE"  type="INTEGER" >
            <OracleType typecode="2" />
          </attribute>
          <attribute name="TODAY"  type="DATE" >
            <OracleType typecode="0" />
          </attribute>
        </attributes>
      </OracleTypeADT>
    </StructDescriptor>
    [main] 2008-07-03 19:09:50,379 DEBUG [ru.invito.AqTest] - sending............
    [main] 2008-07-03 19:09:50,395 DEBUG [ru.invito.AqTest] - Message ID from enqueue call: 511ff143bd4fa536e040007f01003192
    [main] 2008-07-03 19:09:50,395 DEBUG [ru.invito.AqTest] - ----------- Enqueue done ------------But when dequeueing the 'label' attribute is lost:
    DECLARE
    dequeue_options     DBMS_AQ.dequeue_options_t;
    message_properties  DBMS_AQ.message_properties_t;
    message_handle      RAW(16);
    message             fixed_t5;
    BEGIN
      dequeue_options.navigation := DBMS_AQ.FIRST_MESSAGE;
      DBMS_AQ.DEQUEUE(
         queue_name          =>     'fixed_t5q',
         dequeue_options     =>     dequeue_options,
         message_properties  =>     message_properties,
         payload             =>     message,
         msgid               =>     message_handle);
      DBMS_OUTPUT.PUT_LINE('ID   : '||message.id);
      DBMS_OUTPUT.PUT_LINE('Label: '||message.label);
      DBMS_OUTPUT.PUT_LINE('Code : '||message.code);
      DBMS_OUTPUT.PUT_LINE('Today: '||message.today);
      COMMIT;
    END;
    ID   : 36
    Label:
    Code : 1
    Today: 03.07.08
    Could anyone tell me what is wrong with the setup/code?
    Why 'label' not saved in queue, though i saw it is not empty in STRUCT?

    Thank you for the reply!
    I have enqueued:
    [main] 2008-07-04 15:30:30,639 DEBUG [ru.invito.UserDefinedTypeAqTest$1] - [email protected](): name = INVITO.FIXED_T5
    length = 4
    ID = 41
    LABEL = Hello, INVITO.FIXED_T5Q!
    CODE = 1
    TODAY = 2008-07-04 15:30:30.0and in table (select * from FIXED_T5QT) the 'label' is blank:
    Q_NAME     FIXED_T5Q
    MSGID     51310809B5EA3728E040007F01000C79
    CORRID     b8f38fd3-4fa6-4e0f-85d1-2440d02d655e
    PRIORITY     0
    STATE     0
    DELAY     
    EXPIRATION     
    TIME_MANAGER_INFO     
    LOCAL_ORDER_NO     0
    CHAIN_NO     0
    CSCN     0
    DSCN     0
    ENQ_TIME     04.07.2008 15:28:44
    ENQ_UID     INVITO
    ENQ_TID                       4012
    DEQ_TIME     
    DEQ_UID     
    DEQ_TID     
    RETRY_COUNT     0
    EXCEPTION_QSCHEMA     AQ$_INVITO
    EXCEPTION_QUEUE     FIXED_T5QT_E
    STEP_NO     0
    RECIPIENT_KEY     0
    DEQUEUE_MSGID     
    SENDER_NAME     AQ_TEST
    SENDER_ADDRESS     10.1.1.137
    SENDER_PROTOCOL     
    USER_DATA.ID     41
    USER_DATA.LABEL     
    USER_DATA.CODE     1
    USER_DATA.TODAY     04.07.2008 15:30:30I must point to a strange thing: when the FixedType instance is created (via new operator) and then the setLabel("....") called as:
    FixedType data = new FixedType();
    // hack: proper initialization for 'label' field
    data._struct.setNChar(1);
    data.setId(ID);
    data.setLabel(label);
    data.setCode(1);
    Date today = new Date();
    data.setToday(new Timestamp(today.getTime()));
    Datum d = data.toDatum(connection);
    STRUCT s = (STRUCT) d;
    logger.debug(s + ".debugString(): " + s.debugString());
    logger.debug(s + ".dump(): " + s.dump());and if i comment line (data._struct.setNChar(1);) the debug messages for created STRUCT also shows empty value for label.
    But if i explicitly call data._struct.setNChar(1) then debug contains the label i defined in call to the setLabel method.

  • How to bind select options type(LEDAT) to attribute?

    Hi All,
    I am using SHP_EXTENDED_DUE_LIST FM, in this IX_SELECT_OPTIONS node contains LEDAT, but it is of type select options.
    I want to bind this to date type attribute.
    Delivery date :__ to __.
    while executing original FM we are giving low and high values it is giving output, but while binding i am getting only LEDAT but type is different. how to process this?? Please Help.
    Thanks,
    VEnky.

    Hi Sarbjeet,
    I am trying like this...
    DATA: r_date TYPE SHP_LEDAT_RANGE,
            r_plant TYPE SHP_VSTEL_RANGE,
            L_IX_SELECT_OPTIONS  TYPE SHP_VL10_SELECT_OPTIONS,
            L_EX_DELIVERY         TYPE SHP_VL10_DELIVERY,
            L_IX_PARAMETERS       TYPE SHP_VL10_PARAMETERS.
      DATA: ld_from_date TYPE d,
            ld_to_date   TYPE d.
      DATA lo_nd_input TYPE REF TO if_wd_context_node.
      DATA lo_el_input TYPE REF TO if_wd_context_element.
      DATA ls_input TYPE wd_this->Element_input.
      DATA lv_del_cdate TYPE wd_this->Element_input-del_cdate.
      DATA lv_to_date TYPE wd_this->Element_input-to_date.
      DATA lv_ship_point TYPE wd_this->Element_input-ship_point.
    navigate from <CONTEXT> to <INPUT> via lead selection
      lo_nd_input = wd_context->get_child_node( name = wd_this->wdctx_input ).
      lo_el_input = lo_nd_input->get_element( ).
    get single attribute
      lo_el_input->get_attribute(
        EXPORTING
          name =  `DEL_CDATE`
        IMPORTING
          value = lv_del_cdate ).
    get single attribute
      lo_el_input->get_attribute(
        EXPORTING
          name =  `TO_DATE`
        IMPORTING
          value = lv_to_date ).
      r_date-sign   = 'I'.
      r_date-option = 'BT'.
      r_date-low    = lv_del_cdate .
      r_date-high   = lv_to_date.
      APPEND r_date to  L_IX_SELECT_OPTIONS-ledat.
      CLEAR r_date.
    get single attribute
      lo_el_input->get_attribute(
        EXPORTING
          name =  `SHIP_POINT`
        IMPORTING
          value = lv_ship_point ).
      r_plant-sign = 'I'.
      r_plant-option = 'EQ'.
      r_plant-low = lv_ship_point.
      r_plant-high = ''.
      APPEND r_plant to L_IX_SELECT_OPTIONS-VSTEL.
      CLEAR r_plant.
      CALL FUNCTION 'SHP_EXTENDED_DUE_LIST'
        EXPORTING
          IX_PARAMETERS               = L_IX_PARAMETERS
          IX_SELECT_OPTIONS           = L_IX_SELECT_OPTIONS .
      DATA lo_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .
      lo_COMPONENTCONTROLLER =   wd_this->get_componentcontroller_ctr( ).
      lo_componentcontroller->execute_shp_extended_due_list(  ).
    But i am getting this error : Screen output without connection to user.
    CAN U TELL ME ANY THING WRONG IN THIS??
    tHANKS,
    vENKY.
    Edited by: venkys on Mar 8, 2011 9:52 AM

  • Any tricks to use PL/SQL types in object attributes?

    I guess this is a bit of a newbie-question, but I haven't been able to find any workarounds elsewhere, so please bear with me... I'm far from new to object orientation, but I'm rather new to Oracle's object features.
    I was wondering if there's some trick you can use to keep references to attributes of PL/SQL types even though they are not allowed in object types (as these are "SQL", yes I do think I understand). I was thinking there might be some way you could cast them to some data type that is supported in SQL and then get them back by the reverse process when you need them in the PL/SQL inside the methods?
    In the concrete case, I would like to keep a reference to a utl_smtp connection in my object. It doesn't matter that the reference would be meaningless in other sessions etc. (actually I may not even want to store the objects in any persistent table - it's the polymorphism I'm after):
    CREATE OR REPLACE TYPE o_test AS OBJECT (
    att1 NUMBER,
    att2 sys.utl_smtp.connection
    - which of course give me:
    LINE/COL ERROR
    0/0     PL/SQL: Compilation unit analysis terminated
    3/12     PLS-00329: schema-level type has illegal reference to
         SYS.UTL_SMTP
    The problem becomes rather dull since I can't pass the connection record as a parameter to methods either.
    The only workaround I could think of was to keep the connection as a global variable in a PL/SQL package and then get it from there inside the methods. Of course this can be refined using an index by table and some object unique id to support multiple objects with their separate connections. But it still seems rather clumbsy - especially given that what I was looking for was the elegance of polymorphism.
    Any tricks I don't know of?
    I'm working in Oracle 10gR2.
    best regards,
    Jakob
    Edited by: schmidt on Mar 21, 2011 10:52 PM

    The UTL_SMTP Connection record is not too complicated, and can be easily translated into SQL object types. Add a package to aid in conversion between SQL and PLSQL, and voila!
    create or replace type o_utl_tcp_connection is object (
         remote_host     VARCHAR2(255),
         remote_port     INTEGER,
         local_host     VARCHAR2(255),
         local_port     INTEGER,
         charset          VARCHAR2(30),
         newline          VARCHAR2(2),
         tx_timeout     INTEGER,
         private_sd     INTEGER
    define     typeOf_SQL_BOOLEAN     = 'number'
    define     SQL_BOOLEAN          = '&typeOf_SQL_BOOLEAN(1)'
    define     SQL_TRUE          = 1
    define     SQL_FALSE          = 0
    create or replace type o_utl_smtp_connection is object (
         host          VARCHAR2(255),          -- remote host name
         port          INTEGER,          -- remote port number
         tx_timeout     INTEGER,          -- Transfer time out (in seconds)
         private_tcp_con o_utl_tcp_connection,     -- private, for implementation use
         private_state     INTEGER,          -- private, for implementation use
         -- Optionally, encapsulate all UTL_SMTP package calls behind object methods
         member procedure open(
              self                    IN OUT NOCOPY     o_utl_smtp_connection,
              host                    IN          VARCHAR2,
              port                    IN          INTEGER DEFAULT 25,
              tx_timeout               IN          INTEGER DEFAULT NULL,
              wallet_path               IN          VARCHAR2 DEFAULT NULL,
              wallet_password               IN          VARCHAR2 DEFAULT NULL,
              secure_connection_before_smtp     IN          &typeOf_SQL_BOOLEAN DEFAULT &SQL_FALSE
         member procedure writeData(
              self                    IN OUT NOCOPY     o_utl_smtp_connection,
              data                    IN          VARCHAR2 CHARACTER SET ANY_CS
    create or replace type body o_utl_smtp_connection is
         member procedure open(
              self                    IN OUT NOCOPY     o_utl_smtp_connection,
              host                    IN          VARCHAR2,
              port                    IN          INTEGER DEFAULT 25,
              tx_timeout               IN          INTEGER DEFAULT NULL,
              wallet_path               IN          VARCHAR2 DEFAULT NULL,
              wallet_password               IN          VARCHAR2 DEFAULT NULL,
              secure_connection_before_smtp     IN          &typeOf_SQL_BOOLEAN DEFAULT &SQL_FALSE
         is
         begin
              self := SMTP_UTILS.toSqlConnection(SYS.UTL_SMTP.Open_Connection(
                        host
                   ,     port
                   ,     tx_timeout
                   ,     wallet_path
                   ,     wallet_password
                   ,     nvl(secure_connection_before_smtp = &SQL_TRUE, false)
         end;
         member procedure writeData(
              self                    IN OUT NOCOPY     o_utl_smtp_connection,
              data                    IN          VARCHAR2 CHARACTER SET ANY_CS
         is
              conn     SYS.UTL_SMTP.Connection          := SMTP_UTILS.toPlSqlConnection(self);
         begin
              begin
                   SYS.UTL_SMTP.Write_Data(conn, data);
                   self := SMTP_UTILS.toSqlConnection(conn);
              exception
              when others then
                   self := SMTP_UTILS.toSqlConnection(conn);
                   raise;
              end;
         end;
    end;
    create or replace type o_test is object (
         attr1          number,
         attr2          o_utl_smtp_connection,
         member procedure doSomethingWithConnection
    create or replace package SMTP_UTILS
    is
         function toPLSQLConnection(aConnection in o_utl_smtp_connection)
         return SYS.UTL_SMTP.Connection;
         function toSQLConnection(aConnection in SYS.UTL_SMTP.Connection)
         return o_utl_smtp_connection;
    end;
    create or replace package body SMTP_UTILS
    is
         function toPLSQLConnection(aConnection in o_utl_smtp_connection)
         return SYS.UTL_SMTP.Connection
         is
              result     SYS.UTL_SMTP.Connection;
         begin
              result.host                    := aConnection.host;
              result.port                    := aConnection.port;
              result.tx_timeout               := aConnection.tx_timeout;
              result.private_state               := aConnection.private_state;
              result.private_tcp_con.remote_host     := aConnection.private_tcp_con.remote_host;
              result.private_tcp_con.remote_port     := aConnection.private_tcp_con.remote_port;
              result.private_tcp_con.local_host     := aConnection.private_tcp_con.local_host;
              result.private_tcp_con.local_port     := aConnection.private_tcp_con.local_port;
              result.private_tcp_con.charset          := aConnection.private_tcp_con.charset;
              result.private_tcp_con.newline          := aConnection.private_tcp_con.newline;
              result.private_tcp_con.tx_timeout     := aConnection.private_tcp_con.tx_timeout;
              result.private_tcp_con.private_sd     := aConnection.private_tcp_con.private_sd;
              return     result;
         end;
         function toSQLConnection(aConnection in SYS.UTL_SMTP.Connection)
         return o_utl_smtp_connection
         is
              result     o_utl_smtp_connection;
         begin
              result.host                    := aConnection.host;
              result.port                    := aConnection.port;
              result.tx_timeout               := aConnection.tx_timeout;
              result.private_state               := aConnection.private_state;
              result.private_tcp_con.remote_host     := aConnection.private_tcp_con.remote_host;
              result.private_tcp_con.remote_port     := aConnection.private_tcp_con.remote_port;
              result.private_tcp_con.local_host     := aConnection.private_tcp_con.local_host;
              result.private_tcp_con.local_port     := aConnection.private_tcp_con.local_port;
              result.private_tcp_con.charset          := aConnection.private_tcp_con.charset;
              result.private_tcp_con.newline          := aConnection.private_tcp_con.newline;
              result.private_tcp_con.tx_timeout     := aConnection.private_tcp_con.tx_timeout;
              result.private_tcp_con.private_sd     := aConnection.private_tcp_con.private_sd;
              return     result;
         end;
    end;
    create or replace type body o_test is
         member procedure doSomethingWithConnection
         is
         begin
              -- Make SMTP calls thru connection object methods
              self.attr2.open();
         end;
    end;
    /Hope it helps.
    Gerard
    Edited by: gaverill on May 17, 2011 3:02 PM - formatted code

  • Issue with new 'Display Summary Type in Table' Attribute

    JHeadstart Version: 10.1.3.1.26
    JDeveloper Version: 10.1.3.1
    We have configured our top level groups in our JHS Application Definition Editor to have each table's first column (Primary Key) set to 'count' for the 'Display Summary Type In Table' field level attribute.
    Our problem is that now that we have this handy counting functionality, we found that it breaks the row focus when entering data in a table-forum. To be precise, when typing in or modifying the field that contains the defined 'count' attribute, when we 'tab off' from that field the page seems to run some JavaScript (the recounting of the rows I presume) and loses the keyboard's focus from that row. This outright prevents users from tabbing to the next field to continue entering data - which is rather important for our application.
    I am presuming that this is a bug. Any ideas on how to fix it?

    Erik, Michael,
    I checked with ADF Faces development. I have a logged a bug for this against ADF Faces. Hopefully it will be solved in release 11.
    There is nothing JHeadstart can do to fix this. Wherever we have autoSubmit=true generated on an item to get AJAX-style partial page requests (LOV item, summary item, depends on item), then tabbing out the field will loose the cursor, and pressing Save immediately after entering a value in the item will not save the data.
    Steven Davelaar,
    JHeadstart Team.

  • Taglib parsing error - cant see type parameter under attribute apparent

    Hi,
    I cannot determine why I'm getting the following error:
    "org.apache.jasper.JasperException: XML parsing error on file /report-taglib.tld: Element type "type" must be declared."
    It seems to me that I have clearly included the "<type>"
    parameter (java.util.ArrayList) for the "container" attribute (see my taglib xml, below)...
    Can you tell why the parser does not recognize it?
    Appreciate any help.
    [environment info]
    OS: WIN2000
    JAVA_HOME: C:\j2sdk1.4.0
    J2EE_HOME: C:\j2sdkee.1.3.1
    CATALINA_HOME: C:\jwsdp-1_0-ea1
    [my taglib]
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
    "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
    <!-- a tag library descriptor -->
    <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.1</jspversion>
    <shortname>report-taglib</shortname>
    <info>
              report taglib
    </info>
    <tag>
    <name>report</name>
    <tagclass>reportpackage.reporttags.ReportTagPROTO</tagclass>
    <bodycontent>JSP</bodycontent>
    <info>Includes body only if authorized by tag servlet</info>
    <attribute>
         <name> numQuery </name>
         <required> true </required>
         <rtexprvalue> true </rtexprvalue>
    </attribute>
    <attribute>
         <name> showNumber </name>
         <required> true </required>
         <rtexprvalue> true </rtexprvalue>
    </attribute>
    <attribute>
         <name> container </name>
         <required> true </required>
         <rtexprvalue> true </rtexprvalue>
         <type> java.util.ArrayList </type>
    </attribute>
    </tag>
    </taglib>

    It appears that this error is a result of using the wrong jsp version. -thanks

  • Simple Types and Context Attributes

    Hello All,
      Can someone be kind enough to explain the difference between using a context attribute and a Simple Type ? For example... what's the difference (and I am sure there is ) between a context attribute "Name" that is declared to be of String type and a simple type "Name" that is of built-in type String  ?
    from
    Kwok Wei

    Some links on SimpleTypes and its usage.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/value help in web dynpro applications.pdf
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/internationalization of web dynpro applications.pdf
    Regards, Anilkumar

  • Hot to get type from an attribute?

    I have in class some attributes like...
    private int cityCode;
    private String city;When running, I would like to know which type is some of the attributes and it works fine for city because is String and I get from getClass().
    But cityCode is native , so I can't try getClass().
    Although I know it's int, I would like some way to let me know when executing. Does anyone know how to do it?
    Thanks in advance.

    Take a look at the wrappers that go along for each primitive type, in your case Integer. But anyways, I dont see why
    1- you need to know its an int at runtime.
    2- you are posting this in the swing forum. Take a look at the java tutorials and post in the appropriate forum.

  • [CS3 INX] Values for file type in LnkI attribute?

    I've poked around in the C++ headers and all the relevant documentation I can find but can't find any definition of the possible values for the "file type" field in the Link Info array in CS3 INX files.
    Anyone know here I can find the list of possible values?
    I'm generating INX files with links and need to be able to generate the appropriate values based on the link targets.
    Thanks,
    Eliot

    Hi
    Pls tell me how did you resolve this issue. I am also facing the same problem.
    Thanks
    Prakash

  • Buildin Type "DBSequence" not available for PK Attribute in JDev 11.1.1.5

    Hi,
    I have JDev 11.1.1.5 and a (migrated) entity object.
    The PK-Atribute is filled in Database using a Trigger and a sequence.
    I set the attribute to *"Update while new"* and "*refresh after insert"*
    Now I'd like to ste the type to +"DBSequence"+ as suggested in 4.10.10 How to Get Trigger-Assigned Primary Key Values from a Database Sequence. But I dont have the Entry +"DBSequence"+ in the +"Type" combobox.+
    Even if I remove this attribute from the entity and add it again I'm not able to select the build in type +"DBSequence"+
    How do I set the Type of that attribute to "DBSequence"?
    bye
    TPD

    M.Jabr wrote:
    Did you find it?No. :o(
    If not, an alternative solution is to change the type to Number and assign that attribute a value from the sequence upon creation as explained in [url http://mjabr.wordpress.com/2011/03/11/make-sequence-number-as-default-value/]Set an attribute’s default value with a sequence number
    This is no Option since ADF is not the only component making new Entries in that table and I dont want to change the working parts (yet...).
    bye
    TPD

Maybe you are looking for

  • Appropriate size for Autoextending datafile in oracle 10g

    Hi, I am using Oracle 10g 10.2.0.3.0 on linux 64 bit with 16GB RAM, one thing i want to find out that i have my schema datafile, which set on autoextend, i have set next size to 100mb, if the file reaches to its full does it make us wait for long to

  • Errors in PHP/Oracle article

    Hi, There are a few errors in the article dealing with PHP/Oracle located at http://otn.oracle.com/oramag/webcolumns/2003/techarticles/hull_php.html In the listing for the section called "How to use a database": - $mycursor ora_open ($conn); should b

  • Long running in Move Nametabs phase while applying SAPKIBIIP2

    HI All, I am applying SAPKIBIIP2 (BI 7.03) patch, its long running in MOVE NAMETAB phase, I checked dumps in st22..there were no dumpsu2026in sm37 RDDMNTAB is also active & in sm50 I found its taking long Sequential Read for this table D010TAB. Check

  • Jewelry, how do you display diffracted light?

    What software or gadget is used to show off jewelry online, in a manner where the viewer can rotate , e.g. a diamond to not just any angle in a circle but to any angle in a sphere, so as to be able to see diffracted light? A half degree movement in A

  • Macbook Pro early 2011 often ssd corruption

    As i installed Drive Geniuou Pro 3 on my macbook early 2011 equipped with 128 GB SSD i noticed that every month i've got some check failing on the hard disk (in drive geniuos -> verification failed -> must run repair) and this reflects in a little pe