Need help on object type

Hi,
I have created one object type in oracle 10g database like this
CREATE OR REPLACE
TYPE ORA_criteria_DATA AS OBJECT
( criteria_id NUMBER(5),
criteria_name VARCHAR(100),
map MEMBER FUNCTION mem RETURN NUMBER
Then create a type for the same like this.
CREATE OR REPLACE
TYPE TYPE_ORA_CRITERIA_TAB IS TABLE OF ORA_criteria_DATA
Now I am using this type as IN OUT parameter in one of my pacakge procedure and storing some values in the collection and return into a collection in procedure like this
Package PKG_MIS_REPORT BODY
v_data_tab2 type_ora_criteria_tab :=type_ora_criteria_tab();
PROCEDURE PROC_ORA_DATA_IDS(V_DATA_TAB2 IN OUT TYPE_ORA_CRITERIA_TAB)
AS
v_cri_data TYPE_ORA_CRITERIA_TAB :=TYPE_ORA_CRITERIA_TAB();
BEGIN
SELECT ora_criteria_data(criteria_id,criteria_name)
BULK COLLECT INTO v_cri_data
FROM (
SELECT DISTINCT op.criteria_id,op.criteria_name
FROM ora_notch_mis_data op,ora_criteria_ma oc
WHERE op.criteria_id=oc.criteria_id
AND oc.section_id=1);
V_DATA_TAB2.DELETE;
V_DATA_TAB2:=v_cri_data ;
END PROC_ORA_DATA_IDS;
Now I want to call this procedure in JAVA where I will get the values of the collection and use it.
Please let me confirm the way I am doing I will able to get the values of collection in JAVA.
Thanks a lot..
Regards
Anant

Your code is syntactically correct. You may verify it by:
SQL> CREATE OR REPLACE
  2  TYPE ORA_criteria_DATA AS OBJECT
  3  ( criteria_id NUMBER(5),
  4  criteria_name VARCHAR(100),
  5  map MEMBER FUNCTION mem RETURN NUMBER
  6  );
  7  /
Type created.
SQL> CREATE OR REPLACE
  2  TYPE TYPE_ORA_CRITERIA_TAB IS TABLE OF ORA_criteria_DATA;
  3  /
Type created.
SQL> set serverout on
SQL> DECLARE
  2    v_cri_data  TYPE_ORA_CRITERIA_TAB := TYPE_ORA_CRITERIA_TAB();
  3    V_DATA_TAB2 TYPE_ORA_CRITERIA_TAB := TYPE_ORA_CRITERIA_TAB();
  4  BEGIN
  5    SELECT ora_criteria_data(empno, ename) BULK COLLECT
  6      INTO v_cri_data
  7      FROM (SELECT DISTINCT empno, op.ename FROM emp op);
  8    V_DATA_TAB2.DELETE;
  9    V_DATA_TAB2 := v_cri_data;
10    FOR i IN 1 .. V_DATA_TAB2.COUNT LOOP
11      dbms_output.put_line(V_DATA_TAB2(i)
12                           .criteria_id || '--' || V_DATA_TAB2(i)
13                           .criteria_name);
14    END LOOP;
15  END;
16  /
7839--KING
7698--BLAKE
7782--CLARK
7566--JONES
7788--SCOTT
7902--FORD
7369--SMITH
7499--ALLEN
7521--WARD
7654--MARTIN
7844--TURNER
7876--ADAMS
7900--JAMES
7934--MILLER
PL/SQL procedure successfully completed.
SQL> But, Why I have used syntactically correct ? Because, Your objects seems to have some unused(not required) member function without body, you may think about some other alternatives like REF cursor etc.
Consult PL/SQL manual for alternative and correct approach.

Similar Messages

  • Need help on object type(complex)

    Hi All,
    i have an object type account_t as
    create type account_t as object (accountnumber number(30),
    holdername varchar2(20),
    currentamount number(20),
    minimalamount number(20),
    status varchar2(10),
    member procedure setcurrentamount(v_amount number),
    member function getcurrentamount return number,
    member procedure setstatus(v_status boolean),
    member function getstatus return varchar2,
    member procedure setholdername(v_holdername varchar2),
    member function getholdername return varchar2);
    i create another type accountmanager_t as
    create type accountmanager_t as object (
    depositamount number(30),
    withdrawalamount number(30),
    v_accountt account_t,
    member function deposit(d_accountt account_t,d_transno number default 1) return account_t,
    member function withdraw(w_accountt account_t,w_transno number default 2) return account_t);
    Accountmanager_t body as :
    create or replace type body accountmanager_t as
    member function deposit(d_accountt account_t,d_transno number default 1) return account_t as
    begin
    return self.amount+self.depositamount;
    end deposit;
    member function withdraw(w_accountt account_t,w_transno number default 2) return account_t as
    begin
    if self.status='OPEN' then
    if (currentamount-self.withdrawalamount) < minimalamount then
    if (currentamount-self.withdrawalamount) <> 0 then
    status:='CLOSED';
    return self.currentamount-self.withdrawalamount;
    end if;
    end if;
    myprint('No Sufficient funds for Withdrawal');
    return self.currentamount;
    end if;
    myprint('No withdrawal for closed account');
    return self.currentamount;
    end withdraw;
    end;
    i get the errors as :
    4/3 PL/SQL: Statement ignored
    4/15 PLS-00302: component 'AMOUNT' must be declared
    8/3 PL/SQL: Statement ignored
    8/11 PLS-00302: component 'STATUS' must be declared
    19/3 PL/SQL: Statement ignored
    19/15 PLS-00302: component 'CURRENTAMOUNT' must be declared
    SQL>
    How to pass the values of these variables from account_t type to accountmanager_t type?
    Any help??
    Regards,
    s.

    return self.amount+self.depositamount;I counld not find any amount field in your type definitions
    if self.status='OPEN' thenIs it w_accountt.status ?? since there is no status field in accountmanager_t type
    return self.currentamount-self.withdrawalamount;same comments for currentamount
    member function deposit(d_accountt account_t,d_transno number default 1) return account_t asWhere as your return expression is a number??

  • Need Help with data type conversion

    Hello People,
    I am new to java, i need some help with data type conversion:
    I have variable(string) storing IP Address
    IPAddr="10.10.103.10"
    I have to call a library function which passes IP Address and does something and returns me a value.
    The problem I have is that external function call in this library excepts IP Address in form of a byte array.
    Here is the syntax for the function I am calling through my program
    int createDevice (byte[] ipAddress).
    now my problem is I don't know how to convert the string  IPAddr variable into a byte[] ipAddress to pass it through method.

    Class InetAddress has a method
    byte[]      getAddress() You can create an instance using the static method getByName() providing the IP address string as argument.

  • Need help finding Driver type in the registry

    Hi,
    given a DSN(Data Source Name), I need to find the type of Driver it was assigned to in the Registry. pls help me to do this in java.
    Thanks in advance,
    Rao

    Hi jschell,
    Thanks for your response.
    I would like to explain my actual problem clearly now.
    I am working on an enterprise product where it has a setup screen in which it has a form with DSN and Database Type as the input fields. The database type could be either Oracle or MS SQLServer or MS Access.
    so, instead of entering both (DSN and Database Type) into the form, I would like to enter only DSN in the form, and based on this DSN, I should know what is the corresponding Database Type.
    Pls let me know how to do this without manually referring in the system.
    thanks for ur help and time.
    Rao

  • Need help regarding currency types

    Hi All,
      I need help in understanding the currency types.
    Presently in my system previous guys have designed the currency type = 10, so all the present data is in currency type=10 only,
    Now I need the data for currency type = 30, how can i make this.
    Please give me what are the different ways of achieving this.
    Thanks,
    vinay.

    Hi,
    If you are loading data for currency types then you can use it in Reorts for restrictions, if you are giving any selection in InfPackage then you need to change it for your requirement, else you need to reload the compeletly load the data from ECC.
    Thanks
    Reddy

  • Need help opening NAT type to OPEN on a model WRT54GS router for xbox 360

    I have tried from other people's advice and when i test Xbox Live i always get a Moderate NAT type. I am becoming frustrated with how it is not working and I am hoping someone can help me. Please leave advice/suggestions and thank you for your time.

    Open the setup page of the router using 192.168.1.1 by putting the password as admin with username as blank & click the Administration tab & on the same page you will see UPNP.You need to select it as disable in order to help opening NAT type to OPEN.

  • Need help with DOC type web service

    hi,
    I am trying to write a simple message style ( doc type ) web service but no success so far. I have tried to search for examples but no use. I already implemented some simple RPC style web services like calculator etc and able to use them. I am more interested in the DOC type ( which sends SOAP message and receives SOAP message back). Can Anybody give me an example for implementing this type of service ( very-simple say HellowWorld ) or point me to some website . I am not able to generate the response envelope. I can write the client program which will send a SOAP Envelope to this services with one parameter NAME and the services should return Hello Name but in a SOAP envelope form. I can create a SOAP message in this Client using SOAPConnection and MessageFactory etc. Your help will be really appreciated. There is very little stuff about webservices on the internet as well on this forum.
    Thanks
    Vinod

    Hello kwilding2,
    Thanks for the quick response and pointing to some useful websites. I downloaded the code from web service essentials BUT all the examples are using SOAP RPC calls. They create a call object and call one of the service methods and a response is returned. I am little confused about this stuff. I am looking for something which returns the response in a SOAP envelope for which i think i need to use JAXM API which I already have downloaded. I have created a client which composes a SOAP envelope using SOAPConnection and other MessageFactory classes etc and can send this SOAP envelope to a web service. In return I want the web service to give the SOAP envelope.
    I have gone thru xmethods.net and picked the following stock quote request and response:
    Sample Request envelope:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body>
    <ns1:getQuote xmlns:ns1="urn:xmethods-delayed-quotes" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <symbol xsi:type="xsd:string">IBM</symbol>
    </ns1:getQuote>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Sample Response Envelope:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body>
    <ns1:getQuoteResponse xmlns:ns1="urn:xmethods-delayed-quotes" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <return xsi:type="xsd:float">133.625</return>
    </ns1:getQuoteResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    I also want the things in this order. This webservice at xmethods just returns the price for a stock, so how they say it returns this Response Envelope. Is this Envelope something implied. I am getting more confused.
    any help will be appreciated.
    Thanks
    Vinod

  • Need Help converting objects in a TreeMap to String

    This app counts the number of times a word occurs in a document. I used a HashMap to store the key and value. The I sorted them using TreeMap. Now I need to return the key (String) and value (Integer Object) so they may be print like this -- 'key: value'.
    Example:
    that: 3
    This mean the word 'that' appeared 3 times in the document. Below is my toString() method. TreeMap sorts everything for me but I cant return 'map' because it is not a String. So I iterated through each key and value in the map. But now I dont know how to put all the iterations into 1 String value. I would greatly appreciate any help. Code below.
    Thanks in advance.
    public String toString() {
    Object key = null;
    Object value = null;
    map = new TreeMap(map);
    Set getKeys = map.keySet();
    Iterator iterKeys = getKeys.iterator();
    while (iterKeys.hasNext()) {
    key = (String)iterKeys.next();
    value = map.get(key))
    return; // i need to return a String here
    } // end toString()
    } // end class

    I dont remember posting to the "new Java forum", but I might have. My browser locked up on me so I am not sure what happened. If I did please excuse my double post.
    Are you familar with a way to solve my problem?

  • Need help with output type EDI for ERS

    All,
    I want to be able to run and ERS settlement and have the invoices created sent via EDI/XML to the supplier.   I have several questions on the set up.
    1)  I have output type ERS6 which is defined as ERS EDI.  I assume because it does not start with Z* this is SAP standard, so I shouldn't have to modify any of this.
    2)  I've added my supplier to this output type. 
    3)  I assume I need to create a partner profile for this supplier?  If so can someone tell me the message type to use?
    Is there any set up I'm missing in this process?   I've executed ERS but do not get an idoc and I'm fairly certain it's because I haven't done the partner profile set-up.
    Thanks for your help.
    Sandra

    Hi,
    You don't have to modify thise setup unless you have any customized requirement.
    You are missing partner profile setup.Carry out the setup and run MRRL tcode to create the idocs
    Enter the following values using tcode WE20.
    Field                                       Value
    Message type                         GSVERF
    Partner type                             LI (vendor)
    Partner function                        LF (vendor)
    Port                                         SUBSYSTEM ( Port to your middleware)
    Output mode                            such as Collect IDocs
    Basic type                                GSVERF01
    Application                                 MR
    Output type                                ERS6 or the type you have defined
    Regards,
    Karuna

  • Need help on object array, please.

    Hello. I'm trying to write a program that stores student id numbers and their names into an array, and then prints them in numerical order. What I did was create an object called DSCC and put it in an array, but I'm having problems. Everytime I run this I get a null pointer exception, here is my code.
    public class Main {
      public Main() {
      public void getStudenInfo(String Number1, String Name, int Number){
        Number1 = JOptionPane.showInputDialog("Enter student number, 999 to quit");
        Number = Integer.parseInt(Number1);
        if(Number != 999){
          Name = JOptionPane.showInputDialog("Enter student name");
      public void putInArray(DSCC ded[], String na, int nu){
          ded[0].studentname = na;
          ded[0].studentnumber = nu;
           System.out.println(ded[0]);
      public void printList(){
      public static void main(String[] args) {
        String name = "";
        String number1 = "";
        int number = 0;
        DSCC[] array = new DSCC[10];
        Main main1 = new Main();
        DSCC d = new DSCC();
         main1.getStudenInfo(number1, name, number);
         while(number != 999){
            main1.putInArray(array, name, number);
            main1.printList();
            main1.getStudenInfo(number1, name, number);
    public class DSCC {
        String studentname;
        String number1;
        int studentnumber;
        public DSCC() {
    }

    There are a couple things i don't get about the code here but let me point out some thing that definately don't work.
    The function getStudentInfo(...) does not change the value of its parameters Number1, Name and Number. You will need to redesign this method to get the entered values. I suggest breaking it up into three functions that return the value that the JOptionPane, like :
    public String getStudentName(){
         return JOptionPane.showInputDialog("Enter Student Name :");
    }And then replace the calls to getStudenInfo() with the three calls.
    Also the array you make is not populated, which is probably the reason for the for the NPE. For example,
    DSCC[] array = new DSCC[10];
    //here come an NullPointerException
    array[0].studentName = "Joe";
    //can't do this... array[0] == null,  studentName does not exist!This happens in your code, though it is split up into different methods. If you trace through you will see that when you call the method putInArray(...) , the array's values are still null. For a fully intialized array, it should be:
    DSCC[] array = new DSCC[10];
    for(int i = 0; i < 10; i++) {
         array[0] = new DSCC();
    array[0].studentName = "Joe";So at some point you need to initialize the values of the array.
    Hope that helps....

  • Need HELP with objects and classes problem (program compiles)

    Alright guys, it is a homework problem but I have definitely put in the work. I believe I have everything right except for the toString method in my Line class. The program compiles and runs but I am not getting the right outcome and I am missing parts. I will post my problems after the code. I will post the assignment (sorry, its long) also. If anyone could help I would appreciate it. It is due on Monday so I am strapped for time.
    Assignment:
    -There are two ways to uniquely determine a line represented by the equation y=ax+b, where a is the slope and b is the yIntercept.
    a)two diffrent points
    b)a point and a slope
    !!!write a program that consists of three classes:
    1)Point class: all data MUST be private
    a)MUST contain the following methods:
    a1)public Point(double x, double y)
    a2)public double x ()
    a3public double y ()
    a4)public String toString () : that returns the point in the format "(x,y)"
    2)Line class: all data MUST be private
    b)MUST contain the following methods:
    b1)public Line (Point point1, Point point2)
    b2)public Line (Point point1, double slope)
    b3)public String toString() : that returns the a text description for the line is y=ax+b format
    3)Point2Line class
    c1)reads the coordinates of a point and a slope and displays the line equation
    c2)reads the coordinates of another point (if the same points, prompt the user to change points) and displays the line equation
    ***I will worry about the user input later, right now I am using set coordinates
    What is expected when the program is ran: example
    please input x coordinate of the 1st point: 5
    please input y coordinate of the 1st point: -4
    please input slope: -2
    the equation of the 1st line is: y = -2.0x+6.0
    please input x coordinate of the 2nd point: 5
    please input y coordinate of the 2nd point: -4
    it needs to be a diffrent point from (5.0,-4.0)
    please input x coordinate of the 2nd point: -1
    please input y coordinate of the 2nd point: 2
    the equation of the 2nd line is: y = -1.0x +1.0
    CODE::
    public class Point{
         private double x = 0;
         private double y = 0;
         public Point(){
         public Point(double x, double y){
              this.x = x;
              this.y = y;
         public double getX(){
              return x;
         public double setX(){
              return this.x;
         public double getY(){
              return y;
         public double setY(){
              return this.y;
         public String toString(){
              return "The point is " + this.x + ", " + this.y;
    public class Line
         private double x = 0;
         private double y = 0;
         private double m = 0;
         private double x2 = 0;
         private double y2 = 0;
         public Line()
         public Line (Point point1, Point point2)
              this.x = point1.getX();
              this.y = point1.getY();
              this.x2 = point2.getX();
              this.y2 = point2.getY();
              this.m = slope(point1, point2);
         public Line (Point point1, double slope)
              this.x = point1.getX();
              this.y = point1.getY();
         public double slope(Point point1, Point point2)//finds slope
              double m1 = (point1.getY() - point2.getY())/(point1.getX() - point2.getX());
              return m1;
         public String toString()
              double temp = this.x- this.x2;
              return this.y + " = " +temp + "" + "(" + this.m + ")" + " " + "+ " + this.y2;
              //y-y1=m(x-x1)
    public class Point2Line
         public static void main(String[]args)
              Point p = new Point(3, -3);
              Point x = new Point(10, 7);
              Line l = new Line(p, x);
              System.out.println(l.toString());
    }My problems:
    I dont have the right outcome due to I don't know how to set up the toString in the Line class.
    I don't know where to put if statements for if the points are the same and you need to prompt the user to put in a different 2nd point
    I don't know where to put in if statements for the special cases such as if the line the user puts in is a horizontal or vertical line (such as x=4.7 or y=3.4)
    Edited by: ta.barber on Apr 20, 2008 9:44 AM
    Edited by: ta.barber on Apr 20, 2008 9:46 AM
    Edited by: ta.barber on Apr 20, 2008 10:04 AM

    Sorry guys, I was just trying to be thorough with the assignment. Its not that if the number is valid, its that you cannot put in the same coordinated twice.
    public class Line
         private double x = 0;
         private double y = 0;
         private double m = 0;
         private double x2 = 0;
         private double y2 = 0;
         public Line()
         public Line (Point point1, Point point2)
              this.x = point1.getX();
              this.y = point1.getY();
              this.x2 = point2.getX();
              this.y2 = point2.getY();
              this.m = slope(point1, point2);
         public Line (Point point1, double slope)
              this.x = point1.getX();
              this.y = point1.getY();
         public double slope(Point point1, Point point2)//finds slope
              double m1 = (point1.getY() - point2.getY())/(point1.getX() - point2.getX());
              return m1;
         public String toString()
              double temp = this.x- this.x2;
              return this.y + " = " +temp + "" + "(" + this.m + ")" + " " + "+ " + this.y2;
              //y-y1=m(x-x1)
    public class Point2Line
         public static void main(String[]args)
              Point p = new Point(3, -3);
              Point x = new Point(10, 7);
              Line l = new Line(p, x);
              System.out.println(l.toString());
    }The problem is in these lines of code.
    public double slope(Point point1, Point point2) //if this method finds the slope than how would i use the the two coordinates plus "m1" to
              double m1 = (point1.getY() - point2.getY())/(point1.getX() - point2.getX());
              return m1;
         public String toString()
              double temp = this.x- this.x2;
              return this.y + " = " +temp + "" + "(" + this.m + ")" + " " + "+ " + this.y2;
              //y-y1=m(x-x1)
         }if slope method finds the slope than how would i use the the two coordinates + "m1" to create a the line in toString?

  • Need help placing objects in JPanel

          public SimpleTab()
                ButtonGroup group = new ButtonGroup();
                group.add(videoandaudio);
                group.add(audioonly);
                group.add(videoonly);
                videoandaudio.setSelected(true);    
                JFrame frame1 = new JFrame("project");
                frame1.setSize(1000, 700);
                JLabel urllabel = new JLabel("URL");
                JLabel songlabel = new JLabel ("Enter Song");
                JLabel artistlabel = new JLabel ("Enter Artist");
                JLabel crop1label = new JLabel ("Start Time");
                JLabel crop2label = new JLabel ("Stop Time");
                url.setColumns(25);
                GridBagLayout gbl;
                GridBagConstraints gbc;
                JEditorPane jep;
                gbl=new GridBagLayout();
                gbc=new GridBagConstraints();
                p.setBounds(0,0,30,600);
                p.setLayout(gbl);
                gbc.gridx=0;
                gbc.gridy=-20;
                gbl.setConstraints(urllabel,gbc);
                gbc.gridx=0;       
                gbc.gridy=0;
                gbc.weightx=0.0;
                gbl.setConstraints(urllabel,gbc);
                p.add(urllabel);
                gbc.gridx=10;
                gbc.gridy=0;
                gbc.weightx=1.0;
                gbl.setConstraints(url,gbc);
                p.add(url);
                gbc.gridx=0;
                gbc.gridy=20;
                gbc.weightx=0.0;
                gbl.setConstraints(artistlabel,gbc);
                p.add(artistlabel);
                gbc.gridx=10;
                gbc.gridy=20;
                gbc.weightx=1.0;
                gbl.setConstraints(artist,gbc);
                p.add(artist,gbc);
                gbc.gridx=0;
                gbc.gridy=40;
                gbc.weightx=0.0;
                gbl.setConstraints(songlabel,gbc);
                p.add(songlabel);
                gbc.gridx=10;
                gbc.gridy=40;
                gbc.weightx=0;
                gbl.setConstraints(song,gbc);
                p.add(song,gbc);
                gbc.gridx=0;
                gbc.gridy=60;
                gbc.weightx=0.0;       
                gbl.setConstraints(crop1label,gbc);
                p.add(crop1label,gbc);
                gbc.gridx=10;
                gbc.gridy=60;
                gbc.weightx=1.0; 
                gbl.setConstraints(crop1,gbc);
                p.add(crop1,gbc);
                gbc.gridx=0;
                gbc.gridy=80;
                gbc.weightx=0.0;
                gbl.setConstraints(crop2label,gbc);
                p.add(crop2label);
                gbc.gridx=10;
                gbc.gridy=80;
                gbc.weightx=1.0;
                gbl.setConstraints(crop2,gbc);
                p.add(crop2,gbc);
                gbc.gridx=0;
                gbc.gridy=110;
                gbc.weightx=0.0;
                jPanel1.setBorder(BorderFactory.createEtchedBorder());
                jPanel1.setBounds(new Rectangle(70, 40, 10, 200));
                gbc.gridy = 0;
                gbl.setConstraints(videoandaudio, gbc);
                jPanel1.add(videoandaudio);
                gbc.gridy = 20;
                gbl.setConstraints(audioonly, gbc);
                jPanel1.add(audioonly);
                gbc.gridy = 40;
                gbl.setConstraints(videoonly, gbc);
                jPanel1.add(videoonly);
                gbc.gridx = 0;
                gbc.gridy = 190;
                gbl.setConstraints(jPanel1, gbc);
                p.add(jPanel1);
                DownloadsTableModel1.addColumn("Video File");
                DownloadsTableModel1.addColumn("Status");
                DownloadsTable.getColumnModel().getColumn(0).setPreferredWidth(200);
                DownloadsTable.getColumnModel().getColumn(1).setPreferredWidth(200);
                DownloadsTable.setColumnSelectionAllowed(false);
                DownloadsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                DownloadsTable.setDefaultRenderer(Object.class, new DownloadsTableCellRenderer());
                JScrollPane jScrollPane1 = new JScrollPane();           
                jScrollPane1.setBounds(new Rectangle(10, 130, 400, 90));
                jScrollPane1.getViewport().add(DownloadsTable);
                gbc.gridx = 0;
                gbc.gridy = 210;
                gbl.setConstraints(jScrollPane1,gbc);
                p.add(jScrollPane1);
                gbc.gridx=1;
                gbc.gridy=230;
                gbc.weightx=0.0;
                JButton downloadbutton = new JButton();
                downloadbutton.setText("Download");
                gbl.setConstraints(downloadbutton,gbc);
                p.add(downloadbutton);
                JButton pausebutton = new JButton();
                pausebutton.setText("Freeze");
                gbc.gridx = 2;
                gbc.gridy = 230;
                gbl.setConstraints(pausebutton,gbc);
                p.add(pausebutton);
                JButton cancelbutton = new JButton();
                cancelbutton.setText("Cancel");
                gbc.gridx = 3;
                gbc.gridy = 230;
                gbl.setConstraints(cancelbutton, gbc);
                p.add(cancelbutton);
                frame1.add(p);
                frame1.show();
          }[http://www.geocities.com/justinknag/jjjjunit.jpg]
    I need to center the radio buttons, as well as the table. Also, I need to create some space in between everything.

    You know that you can nest JPanels, each with its own layout, you don't have to try to have everything placed in one JPanel that uses a single grand layout manager. I recommend that you read the Sun tutorial on layout managers, and try playing with them til you figure out what will work best. As it is all I see is an attempt to dump everything in one panel with GridBagLayout.
    Also, you would do well to clean up the code, to refactor it into several methods, otherwise it will become a spaghetti code mess.
    Good luck!
    Edit: Here's what I got when I did this:
    [flickr pic|http://farm4.static.flickr.com/3155/2906451640_8deedd7aa3_o.jpg]
    I used
    BoxLayout over-all for the main panel
    A combination of BorderLayout and GridLayout for the top panel
    gridlayout for the next radiobutton panel
    jscrollpane for the jtable
    and gridlayout for the buttons
    I avoided GridBagLayout, because I truly despise it.
    YMMV of course.
    Edited by: Encephalopathic on Oct 1, 2008 7:35 PM

  • Need help in Object-Relational Mapping

    I'm writing a simple two-tiered business application with Swing application on the client side and a DBMS on the server side. To make my client code more maintainable, I decided to create Business Objects instead of having my client accessing the database directly via SQL. For simplicity, I'm not using any features from the J2EE framework, and the Business Objects will be hosted on the client side, with one-to-one mapping to tables in the database. Since this is my first attempt in Object-Relational Mapping, I'm faced with the following problems:
    1. What kind of methods are appropriate for business objects? For example, if I have a Machine and Employee entity. A Machine is owned by an employee, and this is represented in the DB by storing the employee ID (not the name) as a foreign key in the Machine table. Let's say in the user interface I have a table that needs to display the list of Machines, but instead of displaying the owner employee's ID, I want to display the owner employee's name by doing a join select. Should the findMachines() method always perform a join select to get owner's name and store it in the Machine object which is returned, or should findMachines() simply return the owner's ID so the UI will need to make another SQL call (through the Employee object) to get the employee's name? The latter is more elegant, but would it be horribly inefficient if there are lots of machines to be displayed (and for each machine we make a separate select call to get the owner's name).

    Business objects should be separate from how they're persisted.
    When you say object-relational mapping, do you mean a tool like Hibernate? Or are you writing your own persistence layer using JDBC and SQL?
    I'd recommend that you read about the Data Access Object pattern and keep the persistence code out of the business objects themselves:
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
    url=http://www-106.ibm.com/developerworks/java/library/j-dao/

  • Need help with FLV type SWF playback in flash movie

    Hi,
    I have three external SWF files from a client without FLA
    sources. The SWFs were done 3 years ago by someone else so there is
    no way to modify the existing SWF files. These contain no
    interactivity but may involve nested clips on the main timeline.
    They are AS1 or AS2 files so they need to be done with AS2
    scripting to keep it simple.
    I need to call these SWF files inside another flash movie and
    play them in a player window as if they were video files with
    play/pause, seekbar and volume controls. The needed functionality
    is similar to FLV players. My controls will use custom graphic
    buttons and sliders mimicking the look of CNN video player window.
    Does anyone know a good tutorial on how to script these
    controls for SWF?
    Most likely I think I will load it in a clip and I am
    thinking that I will need to get the duration of the loaded swf in
    order to set up the seekbar.
    Thanks in advance,
    Attila

    I think your professor, or somebody, gave you directions with ActionScript 2 programming. In AS2, what oyu have here would have worked just fine. But, in AS3, you need to use a fairly different approach. Your buttons, and their instance name, can remain the same. But now, in AS3, you have to add event listeners in the following manner:
    yourButtonName.addEventListener(MouseEvent.CLICK, yourListenerFunction);
    In your case, you can do one of two things - A) assign a unique listener function to each button, or B) assign the same listsner to both functions:
    A)
    start_btn.addEventListener(MouseEvent.CLICK, startPolygon);
    stop_btn.addEventListener(MouseEvent.CLICK, stopPolygon);
    function startPolygon(e:MouseEvent):void{
        polygon.play();
    function stopPolygon(e:MouseEvent):void{
        polygon.stop();
    B)
    start_btn.addEventListener(MouseEvent.CLICK, controlPolygon);
    stop_btn.addEventListener(MouseEvent.CLICK, controlPolygon);
    function controlPolygon(e:MouseEvent):void{
       if (e.target.name == "start_btn") {//Test for the name of the object that dispatched the CLICK event
          polygon.play();
       } else if (e.target.name == "stop_btn") {
          polygon.stop();
    When I'm using several buttons that do the same/nearly similar things, I favor approach B over A, as it keeps me to jsut one single function to deal with.

  • Need help in deciding type of partition for tables

    Hi,
    I have few tables which have millions of record. In some of the tables, we have data of previous years, which we dont use now. Can we create a partition table for such type of tables.
    On other tables, How to decide if we have to use range/list/hash partitioning on our tables.
    Do i need to recreate indexes for this tables after creating partition tables.
    Please guide me.
    Best Regards,

    Partitioning decisions are based upon how you will access the data.
    If you access by date then partition by date.
    If you access by means of a list of values then use list.
    If you there is no pattern and you just need to break the data up into smaller buckets use hash.
    I see no reason why, based on what you have written, range partitioning by date would not be worthy of consideration.

Maybe you are looking for