- This topic has 6 replies, 4 voices, and was last updated 20 years, 1 month ago by Greg.
-
AuthorPosts
-
nimptMemberI’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!
nimptMemberIn 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!
Riyad KallaMembernimpt,
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)
nimptMemberI’ve tried the new 3.8.3, but it has the same problem. Thank you all the same! Waiting for dev’s reply!
GregMembernimpt,
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.
Dennis ByrneMemberI see this same probllem. The wizard builds all ejb’s with string as the primary key.
GregMemberThe 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.
-
AuthorPosts