Simple Java Question - How to Overwrite Set

After working so much in Java, wondering how do i overwrite java.util.Set
My pojo is Set of associated object. For example
class Parent
private Set child = new HashSet(0);
public Set getChild() {
return this.child;
I wanna overwrite set of child objects in pojo with the set passed from UI tier
Any pointers/suggestions will be highly appreciated
Regards
Bansi

public void setChild(Set child) { this.child = child; }or if you need more control over the Set instance:
public void setChild(Set child)
    this.child.clear();
    this.child.addAll(child);
}

Similar Messages

  • Simple/silly question: how do I set/change default font/color for outgoing mail messages?

    Simple/silly question: how do I set/change default font/color for outgoing mail messages?

    Just a suggestion..........
    Download Thunderbird.  Easier to use when it comes to what you want to do w/your emails. 

  • Simple Java Question - How to test if a given string is numeric or not

    Hi Experts,
    I have written one Java program. It fetches user ID from UME. The code is as below:
    Iterator itr = role.getUserMembers(true);
    while (itr.hasNext()) {
    String uniqId = (String) itr.next();
    IUser thisUser = myUserFactory.getUser(uniqId);
    wdComponentAPI.getMessageManager().reportSuccess("here "+thisUser.getUid() );
    Used ID is thisUser.getUid() . I have to find out all user IDs which are numeric.
    Do we have any standard Java program (API) to find out whether thisUser.getUid()  is numeric or not.
    Regards,
    Gary

    Hi
    Just try to parse this string to integer or long number and catch the NumberFormatException.
    Somthing like:
    try
       Integer.parseInt(userIdString);
    catch(NumberFormatException e)
      //do sume thing when user id is not number
    good luck

  • Simple Query Question - How do I return the Last 3 records of a Table?

    Question.
    For example, I have a table that has 50 records.
    How do I, specify in SQL to only return the last 3 records of the table.
    Select a.* from table a where ????

    I was just trying to show an example to a friend on
    how something like this would work and if it was even possible. But it won't work. Here's a simple example:
    SQL> create table emp
      2  (id)
      3  as
      4  select object_id
      5  from   all_objects
      6  order  by object_id;
    Table created.
    SQL> select *
      2  from  (select rownum rn
      3               ,b.*
      4         from   emp b)
      5  where  rn > ( select (max(rownum) - 3)
      6                from    emp)
      7  ;
            RN         ID
         40830      55891
         40831      55892
         40832      55893So far, so good. These are the "last 3" rows inserted. Now delete a bunch of rows and insert 3 new ones:
    SQL> delete emp where id < 40000;
    33423 rows deleted.
    SQL> commit;
    Commit complete.
    SQL> insert into emp values (60000);
    1 row created.
    SQL> insert into emp values (60001);
    1 row created.
    SQL> insert into emp values (60002);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select *
      2  from  (select rownum rn
      3               ,b.*
      4         from   emp b)
      5  where  rn > ( select (max(rownum) - 3)
      6                from    emp)
      7  ;
            RN         ID
          7410      55891
          7411      55892
          7412      55893Here's the problem. Even though the "last 3 rows" are 60000 - 60002, I still get the same ones as the first query.

  • Simple java question, help please

    please help
    -i am just starting out in java and im havin an early problem. Im trying to run a small java script from a commant prompt but im getting the following error after i enter this command at my prompt
    c:\javatest>javac HelloARP.java
    javac is not as an internal or external command, operable program or batch file.
    when i enter
    c:\java -version
    i get the following message: registry key software\javasoft\java runtime enviornment\current version has value of 1.1 but 1.4 is requiured
    error: could not find java.dll
    error: could not find java 2 runtime enviornment
    -im sure this is a simple error on my part. all im trying to do is run my first lil program that i saved in notepad, its only 5 lines long. here is the lil test program im trying to execute
    class HelloARP {
    public static void main (String[] arguments) {
    System.out.println("What's good ARP?");
    - all responses and help are welcomed. Thank you ahead of time for anyone that can help me get started.

    Hi
    First of all uninstall your current JDK installation, if you can get to the registry delete the registry entries for the old version of java which was there on your machine.
    Now do a fresh install of your j2sdk1.4.1, make sure that you will install the JRE with the J2SDK1.4.1.
    Once you are done, set your classpath in autoexec.bat if you are using Windows 95/98
    or set your environment variables if you are using Win NT/2000/XP.
    If using solaris or other unix flavors see the included installation instructions provided.
    Let me if you face the same problem.
    Thanks
    Swaraj

  • Simple Java Question 2

    hey everyone!
    im stuck, on the math part.
    i need to add a formula to my applet, x = y*z, for example. For fixed values of y and z. So lets say y = 5 and z= 3. How do i get "15" to be displayed when an applet is started.
    I have looked through java.math but did come across anything but complicated stuff.
    your help is very appreciated.

    int y = 5, z = 3;
    System.out.println(y*z); //prints out '15'This will be printed out to standard output (the shell), for an application.
    I'm not sure how you want to print this using your applet.
    But the main point is that simple maths can be done using operators on primitive data types (int, byte, short, double, long, ) Check out this important resource.
    I recommend you read the whole tutorial, or at least the following sections:
    Learning the Java Language
    Writing Applets
    Writing Swing Applets
    regards,
    lutha

  • Simple java questions!

    Hi!
    Can someone tell me the answers of these questions, you can just bold the correct answer.Any help will be appreciated.
    Thanks in advance.
    Regards,
    sandy.
    1) Which of the following software components is not included in the standard Java SDK 2?
    (a)appletviewer(b)JMF(c)Jar tool(d)Swing(e)none of the above
    2) Which of the following is an abstract class in the Java API?
    (a)int (b)Integer (c)WindowListener (d)WindowAdapter (e)none of the above
    3) Which of the following types can be stored in a TreeMap?
    (a)int (b)boolean (c)char (d)String (e)none of the above
    4) How many main methods are allowed in a java program which comprises four user-defined classes?
    (a)one (b)two (c)three (d)four (e)none of the above.
    **********************************************************************

    about that main methods: i find it strange that only 1 main method is allowed, i would say: alot :)
    Just to give an example of the possibilities:
    public class Main {
      public static void main (String[] args) {}
      public static void main (int i) {}
      public void main() {}
      public void main (int i, String blah) {}
    }All is allowed, only the
    public static void main (String[] args) {}will be used as the startup method for the program.
    So in other words, that question not complete.
    Greets,
    Barre

  • Help for simple java question

    May i know how to set the image .jpg or gif into the label ?
    how to get the time in this format::Monday 12th Jan 2004
    thanks

    Hi,
    If i want click the button then the image of the JLabel will be change.. how to write in syntax?
    i know the c1 = new JLabel(new ImageIcon("sysImage/Send.gif"));
    but i want another image after click command button.
    is it c1.setImageIcon("abc.gif"); ? i try,but error..
    how to apply the date fill into syntax? i not really know read the API
    thanks

  • A simple Java question...

    How to wrap the text on the Button in Java?
    For example, the text on the button is too long, I would like to switch it into two lines, but I don't know how to do it. Can anyone tell me how to do it?
    Thank you very much!!!

    Someone told me about this....
    after Java 1.1.7 and Swing 1.0.3, Swing do enable HTML rendering, so you can create a multiline button with the HTML code. eg.
    JButton myButton = new JButton ("<html><center>Chevrolet<br>Light Truck</center></html>");
    here have more 3 methods for create multiline button.
    1. combination of JLabels and the JButton
    JButton myButton = new JButton();
    myButton.setLayout(new BorderLayout());
    JLabel myLabel1 = new JLabel("Line1");
    JLabel myLabel2 = new JLabel("Line2");
    myButton.add(BorderLayout.NORTH,myLabel1);
    myButton.add(BorderLayout.SOUTH,myLabel2);
    2. create a new ButtonUI that formats your text properly
    3. extend JButton and overriding paint method. tokenize string based on \n and recalculations spacing (no good)
    Does it really work?

  • Newbie question:  How do I set the input for a series of audio recordings to be different, if I only have a 2 channel interface?

    I am using a 2 channel interface (Apogee Duet) and I can record a voice and guitar track fine.  My question is how do I record a third audio track after the fact?  It seems when I attempt to record an additional track, say bass for example, Logic treats it as though it is on input 1 or 2 (which hardware wise it is of course) and merges them in a sense.   I don't know how to make it a seperate independant track, despite the fact that it was recorded through an input that I also used to record something else on a diferent track.
    Thanks in advance, I very much appreciate any help.

    Thanks for the response.  I know it sounds ridiculously basic.  Yes I am creating a new track and selecting it.  The third track appears in the arrange window, but changes to, for example, the third track affect the 1st.  Doesn't matter if it's a 1/4 inch guitar or XLR mic.  Yes I'm listening to the headphone output from the Duet.
    I think the fundamental problem is my not understanding something about mono/stereo, or prehaps input and output settings.  I just can't seem to find the appropriate controls/settings.

  • Simple IPhoto Questions-How to reduce picture file size?

    Hello,
    I know how to reduce the size of photos using the Mail program, but is there a simple way to reduce the size of photo files and keep them for sending through the internet at later dates. I would like to keep the photos at their original size for viewing, but transfer photos to a file where they will be used to send over the net in much smaller format size.
    thanks

    As Larry says, you can resize the pics on Export using the File -> Export command.
    and keep them for sending through the internet at later dates.
    The intention in iPhoto is that you would only reduce the size on a case-by-case basis, rather than resize the whole library. As iPhoto always maintains the Originals this require quite a lot of disk space
    Regards
    TD

  • Three simple java questions

    Issue 1:
    if(totaliNumber < 1001) //Hello there, OR statements don't appear to work!
    totaliNumber = 1001;
    if(totaliNumber > 9999)
    totaliNumber = 1001;
    iNumber = totaliNumber;
    ++totaliNumber;This is only giving me the number 1001 each time it is called. if theres any other way to give me the next number other than keeping a count, let me know...
    Issue 2:
    public boolean exists(int nNumber)
    //method
    //some lines down
    int temp = 0;
    for(int i = 0; i < MAX_ENTRIES; i++)
    temp = arrayOfMembers.getMemberNumber();
    if(arrayOfMembers[i].exists(temp)); //cannot find symbol : method: exists(int) <--------------------------------------
    return arrayOfMembers[i];
    return null; //not found!Issue 3: How do I test a method that returns an array of integers? I want to print it out to see the results of the functiion.  A simple print to the cmd box is fine i.e., System.out.print("");
    full source code can be found here:
    [http://docs.google.com/Doc?docid=0AXeIbNxo5as1ZGZkZnF3cmZfMzgxZ3E0cnRoZm0&hl=en|http://docs.google.com [/Doc?docid=0AXeIbNxo5as1ZGZkZnF3cmZfMzgxZ3E0cnRoZm0&hl=en]  http://docs.google.com/Doc?docid=0AXeIbNxo5as1ZGZkZnF3cmZfMzgycDV3dmgyeDY&hl=en|/Doc?docid=0AXeIbNxo5as1ZGZkZnF3cmZfMzgxZ3E0cnRoZm0&hl=en]  http://docs.google.com/Doc?docid=0AXeIbNxo5as1ZGZkZnF3cmZfMzgycDV3dmgyeDY&hl=en]
    [http://docs.google.com/Doc?docid=0AXeIbNxo5as1ZGZkZnF3cmZfMzgzM2M3NjRyZG4&hl=en|http://docs.google.com/Doc?docid=0AXeIbNxo5as1ZGZkZnF3cmZfMzgzM2M3NjRyZG4&hl=en]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    if(totaliNumber < 1001) //Hello there, OR statements don't appear to work!
    totaliNumber = 1001;
    if(totaliNumber > 9999)
    totaliNumber = 1001;
    iNumber = totaliNumber;
    ++totaliNumber;This is part of a constructor and is supposed to generate a new number each time the constructor is used/called.
    public boolean exists(int nNumber)
    //method
    //some lines down
    int temp = 0;
    for(int i = 0; i < MAX_ENTRIES; i++)
    temp = arrayOfMembers.getMemberNumber();
    if(arrayOfMembers[i].exists(temp)); //cannot find symbol : method: exists(int) <--------------------------------------
    return arrayOfMembers[i];
    return null; //not found!exists is a member function of arrayOfMembersarrayOfMembers = new Member[defaultnumberofmembers];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Stupid question: How do I set an Illustrator document to 4:3 aspect ratio?

    Is this as simple as make a 4" wide X 3" tall rectangle.... and then proportionately scaling it up from there?  I know this is an ignorant question... but thanks for confirming my assumption... or providing accurate instructions.
    Thanks!  Have an excellent day.

    You can do it that way and then once you have the size you want go to Object>Artborads>Covert to Artboards.
    Or in the New Document dialogue simply enter the dimensiions you need it is a pretty simple equation to figure if you know one dimension.
    Just in case File>New gets you the New Document dialog

  • Simple Java Question

    Hi Experts,
    I am getting following run time error message while running a Web Dynpro program:
       java.lang.ClassCastException: com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCException: List must contain AbstractList (ProxyList) of Type 'com.sasol.pr.create.Bapimereqitemimp$Bapimereqitemimp_List', not of 'class com.sasol.pr.create.Bapimereqitem$Bapimereqitem_List'!
    Detailed error message is:
    Web Dynpro Client Type HTML Client
    User agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1)
    Version null
    DOM version null
    Client Type msie6
    Client Type Profile ie6
    ActiveX enabled
    Cookies enabled
    Frames enabled
    Java Applets enabled
    JavaScript enabled
    Tables enabled
    VB Script enabled
    Server
    Web Dynpro Runtime Vendor: SAP, build ID: 7.0011.20070125102926.0000 (release=645_VAL_REL, buildtime=2007-01-31:20:18:32[UTC], changelist=434634, host=pwdfm101), build date: Thu Apr 12 16:35:25 IST 2007
    J2EE Engine No information available
    Java VM Java HotSpot(TM) 64-Bit Server VM, version:1.4.2 1.4.2.12-061213-10:06-IA64W IA64W, vendor: Hewlett-Packard Company
    Operating system HP-UX, version: B.11.23, architecture: IA64W
    Session & Other
    Session Locale en_US
    Time of Failure Tue Apr 17 14:05:49 IST 2007 (Java Time: 1176798949444)
    Web Dynpro Code Generation Infos
    local/Pr_Create_16042007_I
    SapDictionaryGenerationCore 6.4009.00.0000.20041026131628.0000 (release=630_REL, buildtime=2004-11-02:22:13:11[UTC], changelist=295793, host=PWDFM027.wdf.sap.corp)
    SapDictionaryGenerationTemplates (unknown)
    SapGenerationFrameworkCore 6.4009.00.0000.20041026132141.0000 (release=630_REL, buildtime=2004-11-02:22:05:28[UTC], changelist=295805, host=PWDFM027.wdf.sap.corp)
    SapIdeWebDynproCheckLayer 6.4009.00.0000.20041026133106.0000 (release=630_REL, buildtime=2004-11-02:22:21:59[UTC], changelist=295820, host=PWDFM027.wdf.sap.corp)
    SapMetamodelCommon 6.4009.00.0000.20040909194107.0000 (release=630_REL, buildtime=2004-11-02:22:06:42[UTC], changelist=280398, host=PWDFM027.wdf.sap.corp)
    SapMetamodelCore 6.4009.00.0000.20040909194107.0000 (release=630_REL, buildtime=2004-11-02:22:06:29[UTC], changelist=280398, host=PWDFM027.wdf.sap.corp)
    SapMetamodelDictionary 6.4009.00.0000.20040805191532.0000 (release=630_REL, buildtime=2004-11-02:22:10:20[UTC], changelist=270520, host=PWDFM027.wdf.sap.corp)
    SapMetamodelWebDynpro 6.4009.00.0000.20041026132448.0000 (release=630_REL, buildtime=2004-11-02:22:17:25[UTC], changelist=295810, host=PWDFM027.wdf.sap.corp)
    SapWebDynproGenerationCTemplates 6.4009.00.0000.20041102105304.0000 (release=630_REL, buildtime=2004-11-02:22:38:28[UTC], changelist=297524, host=PWDFM027)
    SapWebDynproGenerationCore 6.4009.00.0000.20041026133106.0000 (release=630_REL, buildtime=2004-11-02:22:22:31[UTC], changelist=295820, host=PWDFM027.wdf.sap.corp)
    SapWebDynproGenerationTemplates 6.4009.00.0000.20041102105304.0000 (release=630_REL, buildtime=2004-11-02:22:38:28[UTC], changelist=297524, host=PWDFM027)
    sap.com/tcwddispwda
    No information available null
    sap.com/tcwdcorecomp
    No information available null
    Detailed Error Information
    Detailed Exception Chain
    java.lang.ClassCastException: com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCException: List must contain AbstractList (ProxyList) of Type 'com.sasol.pr.create.Bapimereqitemimp$Bapimereqitemimp_List', not of 'class com.sasol.pr.create.Bapimereqitem$Bapimereqitem_List'!
         at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.setRelatedModelObjects(DynamicRFCModelClass.java:807)
         at com.sasol.pr.create.Bapi_Pr_Create_Input.setPritem(Bapi_Pr_Create_Input.java:403)
         at com.sasol.pr.creation.PrCreationCust.executeBapi_Pr_Create(PrCreationCust.java:215)
         at com.sasol.pr.creation.wdp.InternalPrCreationCust.executeBapi_Pr_Create(InternalPrCreationCust.java:240)
         at com.sasol.pr.creation.ApplView.onActionSearch(ApplView.java:152)
         at com.sasol.pr.creation.wdp.InternalApplView.wdInvokeEventHandler(InternalApplView.java:258)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
         at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132)
         at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:299)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:759)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:712)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:261)
         at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:160)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Can you please have a look on it and suggest me the solution.
    Regards,
    RK

    Hi Ravinda,
    You add to one of your WD RFC Adaptive model relations not instance of com.sasol.pr.create.Bapimereqitemimp$Bapimereqitemimp_List BUT com.sasol.pr.create.Bapimereqitem$Bapimereqitem_List
    Check the place where you instanciate your model, establish relations and bind model to model class.
    Best regards, Maksim Rashchynski.

  • Simple Java Question vs. Visual Basic 6

    What are the core advantages in using Jbuilder9?
    What are the disadvantages of using Jbuilder9?
    And what advantages does Jbuilder have over VB6?
    And What is UI? And IDE????

    I think you first need to ask yourself wether Java or
    Microsoft is the way to go. Java is portable and secure
    (among other things).
    If you are looking for graphical tools to build web
    applications, you may want to consider Java Studio
    Creator, which will be available in Early Access in a
    few weeks time:
    http://wwws.sun.com/software/products/jscreator/index.html
    hth,
    Alexis

Maybe you are looking for