New2EJB: Why do we write default ejbCreate() ?

Hi Java Gurus,
I have 3 related questions. These may be a very trivial but I am new :-)
1. Why do we need a default constructors in JavaBeans?
2. Why do we need ejbCreate() with no parametres in Enterprise JavaBeans?
3. What do I need to do to if I need to pass parameters to perform initializations for both JavaBeans and Enterprise JavaBeans?
Thanks in advance.
sledge_hammer

I'll add to that...
The first question, i am sorry that i dont know
exactly. If you are creating a java bean (not ejb),
is the default constructor mandatory?No, it is not necessary to have a default constructor (i.e. no-arg constructor) for a Java bean. If you don't define one, the compiler will creaste it. But if you define anything other than the no-arg constructor, the default constructor would not be present.
2, yes, you should provide an ejbCreate(int x) and an
ejbPostCreate(int x) in your EJB class. The first
method returns the primary key object while the
second returns null. The ejbCreate() is not
required.In case of an entity bean, it is mostly required to have an ejbCreate(some param) method with some arg. There is no restriction that the no-arg version should be defined too.

Similar Messages

  • Why ServletRequest and ServletResponse default data encoding is ISO8859-1?

    why ServletRequest and ServletResponse default data encoding is ISO8859-1 not System default file.encoding?
    So if my servlet contents Chinese charactors it can't write once runs any system with different encoding types.
    for example:
    import java.io.*;
    import java.util.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    public class HelloServlet extends HttpServlet {
      public void doGet (
         HttpServletRequest     req,
         HttpServletResponse     res
        ) throws ServletException, IOException
        res.setContentType("text/html");
        String hello = "Hello world 世界你好";
        PrintWriter pw = res.getWriter();
        pw.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">");
        pw.println("<head>");
        pw.println("<title>" + hello + "</title>");   
        pw.println("</head>");   
        pw.println();
        pw.println("<body>");
        pw.println();
        pw.println("<h1>" + hello +"</h1>");
        pw.println("</body>");
        pw.close();
      public HelloServlet() {}

    A server parses parameters using the common ISO 8859-1 charset. When a browser uses another charset, it is supposed to send the encoding information in the Content-Type header of the request, but almost no browsers do.
    In the Servlet 2.2 API (e.g Tomcat 3.x), the methods that parse parameter input always assume that it's sent as ISO 8859-1. So they create a String containing the correct bytes but incorrect charset.
    In that case, you can use the com.oreilly.servlet.ParameterParser class and its setCharacterEncoding method :
    http://www.servlets.com/cos/index.html
    However,in Servlet 2.3 (e.g Tomcat 4), a new method on the HttpServletRequest object was added in order to be able to specify the request's parameters charset encoding:
      // Set the charset as Shift_JIS
      req.setCharacterEncoding("Shift_JIS");
      // Read a parameter using that charset
      String name = req.getParameter("name");The setCharacterEncoding call may throw java.io.UnsupportedEncodingException if the encoding is not supported.

  • Good morning! i'd like to know why when I write an email in Mail, it creates numerous copies each second which fill the trash box. My email is set up with IMAP and is a gmail account. Thanks

    good morning! i'd like to know why when I write an email in Mail, it creates numerous copies each second which fill the trash box. My email is set up with IMAP and is a gmail account. Thanks

    Open Mail preferences and select Accounts then MailBox Behavior. You probably need to unclick the safe draft to server.

  • Why is the write speed so slow to my NAS

    Hi, I am trying to improve the write speed from my MBP to the NAS.  I am using the Thunderbolt ethernet adapter connected to an Airport Extreme 7.6.1 using a wired connection. I have a Synology DS213 with a wired connection to the Airport Extreme as well. I am using CAT6 cables.
    In testing my performance, I noticed writing files from my MBP to the NAS was very slow; whereas my read performance was much better.  Please see the tests below to explain this further.
    Using the Blackmagicdesign Disk Speed Test Utility using a 5Gb test file written to the NAS, I see the following:
    Write speed is 7 to 8MB/s  This write speed is what concerns me.
    Read speed is between 60 MB/s and 75 MB/s
    Using 2 finder windows (drag a file from one window(MBP) to the other(NAS)) and watch the disk activity on the Activity Monitor with a 1Gb file
    When writing a file to the NAS from the MBP:
    Write speed will burst to 19 to 23 MB/s but it will drop to below 10 MB/s at times.
    When writing a file to the MBP from the NAS
    Write speed is: 46 to 60 MB/s
    Why would the write speed from my MBP to the NAS be so slow ; whereas, the write speed from the NAS to the MBP is very fast.
    Synology has 2 WB 'green' disks configured as raid 1.   I understand that part of the influence of writing from the NAS to the MBP is utilzing the advantage of writing to a SSD ; whereas, writing to the NAS it is writing to a slower drive.  
    Is 19 to 23 MB/s burst with dips below 10 MB/s during a copy typical?   The other thing is I dont understand why the Disk Speed Utility never records write speeds to the NAS over 10 MB/s whereas the Activity Monitor will show the bursts at times of 19 to 23 MB/s
    If 7 to 8 MB/s write speeds is too slow, what can I look at to improve this?  Since writing the file in the other direction is pretty fast considering, how could the issue be a network one?

    I was transferring my iPhoto library from an older MBP to a new retina and having the same issue - transfers almost immediately slowing to less than 100k/sec over my beautiful Time Warner-provided WiFi router using regular OSX folder sharing.  I couldn't find any software updates as some other similar threads suggested.
    I put my iPhoto library in a .tar.gz archive and that immediately transfered at about 7mb/sec, much much faster!  So, without having diagnosed the issue, perhaps I've uncovered evidence that one or both of my machines doesn't like transferring big file trees.  I bet a zip or any other archive would do the trick.

  • Where to write default search message

    Hi guys
    I am searching a long to find where to write default search message on site search module.
    http://webmar.businesscatalyst.com/index
    When user click on the GO button next to the search box site search module must show a default message like your search box is empty, you search box is blank etc,.. but where do i wirte the default message in bc.
    Thanks
    Andy

    <input id="field" type="text" onfocus="if(this.value == 'Search ...') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'Search ...'; }" value="Search ..." name="CAT_Search">
    Try this code where your search box is. you can see how that code works on my site at http://www.lawryk.com
    Message was edited by: Brad Lawryk

  • What does radio mean in the contact selection instead of mobile or home, and why is it the default?

    What does radio mean in the contact selection instead of mobile or home, and why is it the default?
    When adding a new contact, the number shows up as "radio" instead of "mobile" or "home" and I have to change it every time. What does "radio" mean and why is it the default? can that be changed?

    Radio is a type of phone service offered by certain carriers.  Sprint for instance offers their Sprint Direct Connect Phones (a.k.a Nextel) which have built in Radios.  Short Wave or CB radio type features. Also referred to as Push to Talk services.
    http://shop.sprint.com/mysprint/services_solutions/category.jsp?catId=solution_s dc&catName=Sprint%20Direct%20Connect
    Think a walkie talkie in your Phone.
    I get the Radio option when using Hotmail contacts as the default Contact creator. If I change it to iCloud or Gmail I no longer get the Radio option in the labels.
    If you are using a service such as Hotmail/Outlook.com for your contacts the radio option may be present.
    You can change which service is the default service to create new contacts with by going to Settings->Mail Contacts & Calendars->Contacts->Default Account
    The Radio label is just an identifier for those types of Phones so you know its a number for a radio phone.

  • Why non-blocking write would block usually?

    I want to know that why my non-blocking socket's write will consume such a long time. sometimes 400ms worst.
    and this is my strace result:
    19:17:48.886276 write(1306, "\n\365\31:h#\t\7\237\20\3\21\337\36\276\317\6\3023\6\204\223,-\306\30\322\"\f\1\30\0\n"..., 121) = 121 <0.403088>
    It use 0.403088 seconds to finish the write, And I am sure of that the fd 1306 is a non-blocking socket.
    Another records shows:
    19:15:27.949736 write(995, "\n\365'\236UN\24\10\26Y\16\30\373\26\306\240\36\267z\10\20\342\f\17\301&\253\240\2\325\\\314\354"..., 160) = 160 <0.368412>
    19:15:28.410003 write(1466, "\n\365't\360`\20\10\20\342&\253\240\36\267z\10\26Y\26\306\240\16\30\373\2\325\\\f\17\301\314\354"..., 194) = 194 <0.199244>
    19:15:28.627854 write(1821, "\n\365'\260*s*\f\17\301\16\30\373\10\26Y\10\20\342\26\306\240\2\325\\&\253\240\36\267z\314\354"..., 160) = 160 <0.397758>
    19:15:29.029411 write(755, "\n\365'f\356\1\1&\253\240\36\267z\10\26Y\26\306\240\16\30\373\f\17\301\2\325\\\10\20\342\314\354"..., 160) = 160 <0.399817>
    19:15:29.440261 write(614, "\n\365'b\345H\6\36\267z&\253\240\10\26Y\2\325\\\26\306\240\10\20\342\f\17\301\16\30\373\314\354"..., 305) = 305 <0.396985>
    19:15:29.846446 write(892, "\n\365'\354\2256t\16\30\373\f\17\301\2\325\\\10\20\342\10\26Y&\253\240\26\306\240\36\267z\314\354"..., 160) = 160 <0.399170>
    19:15:30.250257 write(515, "\n\365'\376\343\214i\10\20\342\26\306\240\f\17\301&\253\240\10\26Y\2\325\\\36\267z\16\30\373\314\354"..., 231) = 231 <0.398990>
    19:15:30.652666 write(262, "\n\365'\274so\6&\253\240\10\26Y\2\325\\\26\306\240\36\267z\16\30\373\f\17\301\10\20\342\314\354"..., 168) = 168 <0.396569>
    19:17:46.885289 write(908, "t\213\16\222\0\0\0\0\240@\33L\0\0\3219\0\0\333J\0\0\2218\0\0\2\0|\203\16\222\0"..., 189) = 189 <0.396330>
    19:17:47.351419 write(1529, "\n\365\31\352\2\10\252\36\276\317\30\322\"\6\204\223\6\3023\f\1\30\7\237\20\3\21\337,-\306\0\n"..., 128) = 128 <0.293829>
    19:17:47.651080 write(683, "\n\365\31~ZG=\30\322\"\6\204\223\7\237\20\36\276\317\6\3023\3\21\337,-\306\f\1\30\0\n"..., 121) = 121 <0.398178>
    19:17:48.062419 write(175, "\n\365\31\224H\260\313\f\1\30\6\3023\3\21\337\36\276\317\6\204\223\7\237\20,-\306\30\322\"\0\n"..., 121) = 121 <0.398811>
    19:17:48.467481 write(569, "\n\365\31v5]H\3\21\337\30\322\"\f\1\30\6\3023\6\204\223\7\237\20,-\306\36\276\317\0\n"..., 121) = 121 <0.192335>
    19:17:48.663023 write(173, "\n\365\31\376\nJ\0\36\276\317,-\306\7\237\20\30\322\"\3\21\337\6\204\223\6\3023\f\1\30\0\n"..., 121) = 121 <0.206703>
    19:17:48.886276 write(1306, "\n\365\31:h#\t\7\237\20\3\21\337\36\276\317\6\3023\6\204\223,-\306\30\322\"\f\1\30\0\n"..., 121) = 121 <0.403088>
    BTW, This application is for the service of 3-4K client.
    And I do want to ask that:
    1.Why non-blocking write will make our process lose the CPU ( I think it is blocked ).
    2.What our process waiting for? Why not just return EAGAIN?
    3.Can we avoid this problem?
    Our server's info:
    Linux hz172-96 2.6.32-bpo.5-amd64 #1 SMP Mon May 2 11:40:03 UTC 2011 x86_64 GNU/Linux
    Looking forward to your answer, Thank you!

    thank you for your answer.
    and i have resolve this ploblem in using the linux kernel 2.6.30, using  kernel  2.6.32 before.
    but, i don't kown Is there some bug in linux kernel 2.6.32 or for other reason.

  • Bex : selection variable - write default values

    Hi,
    In Bex, I want to write default values by abap in selection option of report.
    How to do this?
    Thanks.

    Hi,
    create a variable of single value with "No ready for input" and "Mandatory"
    <u>Procedure of Exit:</u>
    1: Tcode -> cmod
    2: Select the Project for Varaiables -> Components --> change
    3: select EXIT_SAPLRRS0_001 
    4: select ZXRSRU01
    5:
      WHEN '<Var Name>'.
        IF i_step = '1'.
          l_s_range-low      = <default value>.
          l_s_range-sign     = 'I'.
          l_s_range-opt      = 'EQ'.
          APPEND l_s_range TO e_t_range.
        ENDIF.
    6: Save
    7: Activate
    8: Activate the project
    Hope its done
    Regards
    Happy Tony
    <b>Points == Thanks</b>

  • Why does DataOutputStream write Boolean as 1 Byte?

    Im trying to conserve space in a file storing booleans.
    why does dataoutputstream write booleans as a byte?
    is there a way to write a bit only?
    thanks!

    Hi,
    A boolean does even allocate at least 8 bits when it is declared in the code.
    From the VM spec:
    "3.2.4 There Is No boolean Type
    Although Java defines a boolean type, the Java Virtual Machine does not
    have instructions dedicated to operations on boolean values. Instead, a
    Java expression that operates on boolean values is compiled to use the int
    data type to represent boolean variables.
    Although the Java Virtual Machine has support for the creation of arrays of
    type boolean (see the description of the newarray instruction), it does not
    have dedicated support for accessing and modifying elements of boolean
    arrays. Arrays of type boolean are accessed and modified using the byte
    array instructions.1
    For more information on the treatment of boolean values in the Java Virtual
    Machine, see Chapter 7, "Compiling for the Java Virtual Machine.""http://java.sun.com/docs/books/vmspec/html/Overview.doc.html#22909
    /Kaj

  • Why does Elements 6 default to such funky quality levels when saving?

    Sometimes when doing "save as" it defaults to "3" and other times "5", etc...how does it decide what to offer? And don't I want to use "12" anyway? For a "mainstream photo editor" why doesn't it default to "12" for everyone? Doesn't Adobe want to show that their program creates great-looking pictures? Of course I could be misunderstanding the concept :)

    I am far away from being an expert on this subject. But, until you get better answers from experts, the following observations that i made on my PC might help a little bit.
    On my PC, often, when I "save-as" a jpeg photo with a "quality" of 10 and later re-edit and save-as again that photo, PSE will preset again the quality of 10. It seems that the quality that i preset is somehow "sticky". But I do not know the exact rules used by PSE for this somehow "sticky" reuse of the quality.
    Perhaps, you might wish to make some experiments on your PC and if you are lucky you might even (like me) get along with the behavior of PSE (a behavior, that unfortunately does not seems to be documented in the PSE help Documents). If you (or somebody else) finds out something about the rules used by PSE: I will be grateful to hear about it.
    Notes: on my PC is use Windows XP with SP3 and PSE V6. As far as I remember, PSE V5 (and perhaps even some of the earlier PSE versions) had a similar behavior on the subject of the preset jpgeg quality. Also, I perform most of my edits with the Full Editor of PSE (i.e.: I am not using the limited Editing facilities of the Organizer).
    I also believe to have noticed (but I am not really sure about it) the following: As long I do not exceptionally change for the saving of one particular photo the jpeg quality, PSE has in my environment the tendency of using my preferred quality of 10 for the first Save-as of a photo that had never been edited before. I do not know, whether this is because PSE somehow remember that I used 10 the last time that I saved a photo that had been edited for the first time.

  • Email question: I set my Full Name in Preferences/Accounts/Account Information.  Why does my name default to a partial version of my name on incoming/outgoing mail?  How can I correct this?

    Email question: I set my Full Name in Preferences/Accounts/Account Information.  Why does my name default to a partial version of my name on incoming/outgoing mail?  How can I correct this?

    Lurup wrote:
    I apologize for my ignorance, but what do you mean by 'everything'? The computer name, e-mail accounts, icloud accounts etc?
    My work computer (this mac) i use with my private icloud account so I have access to my private calendars etc. My husband's airbook is also connected to that icloud (since I only have 1 icloud account) and so is our shared ipad. Is that where the problem is? Do I need to change everything on those devises into my name too? Thanks again for you time and help!
    So you are sharing the account. Very bad idea.
    Get your husband his own account and stop sharing yours, they are free.

  • Why my apple write the item is over 20mb when i want to buy item? What shall i do to download?

    Why my apple write the item is over 20mb when i want to buy item? What shall i do to download item over 20 mb its a new problem

    It usually means you're connected to a 3G network and the cell provider won't allow a download that big over the network. Try to download it when you are connected to a WiFi network.

  • Why does the eprint default to photo paper

    why does the eprint default to photo paper?

    Please read this post then provide some details.
    http://h30434.www3.hp.com/t5/Other-printing-questions/Want-Good-Answers-Ask-Good-Questions/m-p/2094#...
    Say "Thanks" by clicking the Kudos Star in the post that helped you.
    Although I work for HP my posts and replies are my own
    Please mark the post that solves your problem as "Accepted Solution"

  • Why do my transitions default to .1 sec?

    Hi, I'm editing some wedding footage and I've done this before and can't figure out why I'm having a problem. I want to use a standard transitions (cross dissolve) between two clips. It's standard 1 second, but when I put it into my timeline, it changes to .1 second and looks like a very quick flash. I've tried to edit it and change it back to 1 second, but no go. I'm sure that I have handles, so that can't be my problem. Does anyone have any suggestions?
    Thanks

    >Why do my transitions default to .1 sec?
    Because you don't have enough "handles" ... handles are simply frames of the clip BEFORE an IN point or AFTER an OUT point.  If you don't have any handle frames to support the transition, the transition duration is reduced accordingly.  To fix, simply move the IN and/or OUT point of the clip(s) to provide the handle frames needed for the duration of the transition you want to use.
    For example, if you want to add a 20 frame dissolve between two clips, move the OUT point of the outgoing clip back 10 frames and the IN point of the incoming clip forward 10 frames.  10+10=20 so it will now support a 20 frame transition.
    -DH

  • Why is the "Write" (new message) button greyed out? I can't write any new emails.

    Having trouble generating any new emails; The Write button in the toolbar is greyed out. Does anybody know why?

    Try to reset default.
    Right click on the Write button and select 'Customise'
    click on 'Restore default set' button.
    click on 'Done to close window.
    Please check to see if any addons are conflicting by restarting in Safe Mode.
    Help > Restart with addons disabled.
    If it works in TB Safe Mode then maybe an addon is causing a conflict.
    You would have to enable all addons - restart as normal and then gradually disable each in turn to see which one is the problem.
    Please post image of the top section showing all the toolbars and their buttons.

Maybe you are looking for

  • Opening appleworks label file in new imac,

    My christmas card labels were created in appleworks labels, now there is no way to open the cwk label file in my new imac. I don't have access to my appleworks in my old computer, can someone help!!!

  • Mobile YouTube website not loading videos over 3G

    This problem has only surfaced in the last couple of weeks for myself and a couple of other friends. When I go to http://m.youtube.com and try to load a video using 3G, it doesn't load. The same video will load with no problems over 3G if I use the Y

  • Unable to execute Map from Database link

    Hi Been trying to research this issue but have had no luck in finding an answer. Here is the situation: We have an apex application that resides on database "A" Our OWB Design Repository (11.1.0.7) and Runtime Environment both exist on database "B" M

  • Getting ODI-1228 : Missing IN or OUT parameter at index:: 12

    Hi, I am getting following error while executing ODI package : ODI-1226: Step DATA_LOAD_STAGE fails after 1 attempt(s). ODI-1240: Flow DATA_LOAD_STAGE fails while performing a Loading operation. This flow loads target table STAGE_ITEM_MOD_SYN. ODI-12

  • Por que mis imagenes pierden calidad al importarlas en muse

    Al colocar imagenes en mi proyecto en muse estas pierden calidad no importa el formato .png .jpeg ni tampoco la fuente ejemplo photoshop o flash, ayuda pues estoy tratando de colocar el logo de la empresa en todos los casos esta pixelado, En adobe mu