facebook

Creating fields for a CMP Entity bean

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #200581 Reply

    chrismalan
    Member

    I did read the bit on creatng entity beans completely. I also searched these pages.

    Is there anyway to create persistent fields in a CMP Entity bean but hand entering them in the generated file? I must be missing something. One of my beans has 14 fields. Hand entering the getters and setters (yes, I know they are only one line long) and their xdoclet tags takes a bit of time.

    From my one day experience with MyEclipse it is nice to use and undoubtedly will become nicer with more experience.

    Thanks,

    Chris Malan

    #200590

    Scott Anderson
    Participant

    Chris,

    Well, getters and setters can be generated automatically from the Java editor. Just open your EJB file and right-click to select Source > Generate getter and setter…

    I think you’ll still need to put the one-line XDoclet tags in though, unless someone else has a clever shortcut. Anyone?

    –Scott
    MyEclipse Support

    #200638

    chrismalan
    Member

    Hi Scott,

    Thanks for a speedy reply. What you say is true for Java Beans. The getter and setter methods are generated from the private global variables. A CMP Entity bean has no variables for any persistent fields. The getters and setters are also abstract, like so: public abstract void setUserName(String newUserName); That is the one line part. Unfortunately the xdoclet tags are longer.

    Has anyone else ever asked about this? I would have thought CMP Entity beans were commonly used. However, when trying to find a host for my J2EE application it seemed that PHP was much more common, and cheaper to host. Just the type of thing to find out when one has spent much time on J2EE and is finally getting on top of it and is even starting to like it. Oh well, wrong again. I won’t be the first time I made a wrong decision.

    #200644

    Scott Anderson
    Participant

    I would have thought CMP Entity beans were commonly used.

    Actually, in our J2EE consulting practice we never use them, for a variety of reasons. For a good overview of the issues around them, I’d suggest the Bitter EJB book. There are much easier and straightforward persistence mechanisms than CMP.

    By the way, this portal is all PHP, even though we’re a J2EE consultancy and offer no services around PHP. That should tell you how easy it is to get started. 🙂

    –Scott
    MyEclipse Support

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Creating fields for a CMP Entity bean

You must be logged in to post in the forum log in