facebook

problem in entity bean code generation

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #221003 Reply

    nimpt
    Member

    I’m using 3.8 with jboss + postgresql. When I create a cmp bean and generate the codes, there’s always a problem. All generated interfaces which have a create() method (by ejbCreate()) have a signature. In my cmp bean, the signature of ejbCreate is “public String ejbCreate(…)…”, but in the other interfaces, they’re “test.interfaces.First” (remote interface) or “test.interfaces.FirstLocal” (local interface). What’s wrong with this? Should I edit some xdoclet codes? Thanks for replies!

    #221016 Reply

    nimpt
    Member

    In fact, I’m just trying to use myeclipse ide. Environment is 3.8.1 and eclipse 3.0.1, jdk1.4.2, jboss 4.0 rc2, postgresql 8.0. I just created a ejb project, and added a bean named FirstBean in a package named try.ejb. And then add stardard ejbxdoclet and jbossxdoclet in project properties. Finally, I run xdoclet to generate all the interfaces. But after it, I check try.interfaces.FirstBeanHome, the signature of create() is:

    public try.interfaces.FirstBean create()
    throws javax.ejb.CreateException,java.rmi.RemoteException;

    In try.ejb.FirstBean, it’s

    public String ejbCreate() throws CreateException
    {
    return null;
    }

    I haven’t changed any other codes (java source or xdoclet). What’s the problem?
    Thank you for ur support!

    #221044 Reply

    Riyad Kalla
    Member

    nimpt,
    This has been sent off to our EJB dev to have a look. You might consider upgrading to MyEclipse 3.8.3 if you are new to it for the best experience. (just released this morning)

    #221098 Reply

    nimpt
    Member

    I’ve tried the new 3.8.3, but it has the same problem. Thank you all the same! Waiting for dev’s reply!

    #221198 Reply

    Greg
    Member

    nimpt,

    The ejbCreate() method on the your bean implementation class and the create() method on the home interface are two separate methods. The CMP spec states that the return type of the ejbCreate() method should be the type of the primary key for your EJB. The create() method on the FirstBeanHome object returns an object that implements your remote interface FirstBean. The Appserver is handling everything between the time you call create() on the HOME object and when ejbCreate() is called on your bean implementation class.

    For a more detailed explanation of what is going on and more info on CMP, I would look at the CMP section under Enterprise Java Beans in the J2EE 1.4 Tutorial from Sun. Also, I would recommend Enterprise Java Beans from O’Reilly. There is alot of good CMP/EJB information in there.

    #221735 Reply

    Dennis Byrne
    Member

    I see this same probllem. The wizard builds all ejb’s with string as the primary key.

    #221744 Reply

    Greg
    Member

    The wizard just uses a template that has a String as the return type for the primary key. It doesn’t know the type of your primary key so it just has a default.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: problem in entity bean code generation

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