- This topic has 4 replies, 3 voices, and was last updated 21 years, 2 months ago by
europarl.
-
AuthorPosts
-
fmfaulknerMemberI’ve specified, for some beans, that only the local interface should be generated, but am getting errors on the remote home interface because it is partially generated. How do you prevent remote home interfaces from being generated on certain beans?
May 10, 2004 at 3:12 pm #206851
GregMemberCould you describe your situation a little more? Are you having trouble with session or entity beans? Are you getting errors in MyEclipse or when deploying to a appserver? I tried creating local interfaces and I don’t get any errors or partially generated remote interfaces. But I am probably not correctly recreating your situation. Which files do you believe are getting generated incorrectly? Let us know and we can try to help.
May 17, 2004 at 10:57 am #207081
europarlMemberDear support team,
I have a similar problem, which is surely coming from a misuse of XDoclet, but let me expose it anyway!
I have created with the wizard an entity bean named FooBean starting like this:
* @ejb.bean name = "Foo" * type = "CMP" * cmp-version = "2.x" * display-name = "FooBean" * description = "FooBean CMP" * view-type = "local" * local-jndi-name = "local/ec.ep.dit.isp.test.ejb.FooBean" * primkey-field = "pk" * * @ejb.persistence table-name = "foo" * * @jboss.persistence create-table = "false" * remove-table = "false" * datasource = "java:jdbc/mysql" * datasource-mapping = "mySQL" */ public abstract class FooBean implements EntityBean { /** The EntityContext */ private EntityContext context; /** * @ejb.persistence column-name = "pk" jdbc-type = "INTEGER" */ abstract public Integer getPk(); /** * @ejb.persistence column-name = "pk" jdbc-type = "INTEGER" */ abstract public void setPk(Integer newVal); /** * @ejb.persistence column-name = "msg" jdbc-type = "VARCHAR" */ abstract public String getMsg(); /** * @ejb.persistence column-name = "msg" jdbc-type = "VARCHAR" */ abstract public void setMsg(String newVal);
After running XDoclet I get FooCMP (which extends FooBean) correctly created. I also get the FooLocalHome and FooLocal interfaces.
Unfortunately, FooLocal (extends javax.ejb.EJBLocalObject) is empty – I expect to find there at least the fields of my entity bean.
FYI: I can generate perfect local or remote interfaces of session beans.
Thanks for any feedback,
Kind regards,
DavidMay 17, 2004 at 11:45 am #207088
GregMemberDavid,
For get/set fields in your CMP bean to show up in FooLocal you have to set @ejb.interface-method view-type=”local” for each method you want to appear in the EJBLocalObject. Also, just a FYI, you only have to declare @ejb.persistence … once per get/set pair. Declaring them twice causes no problems though.
/** * * @ejb.bean name = "Foo" * type = "CMP" * cmp-version = "2.x" * display-name = "FooBean" * description = "FooBean CMP" * view-type = "local" * local-jndi-name = "local/ec.ep.dit.isp.test.ejb.FooBean" * primkey-field = "pk" * * @ejb.persistence table-name = "foo" * * @jboss.persistence create-table = "false" * remove-table = "false" * datasource = "java:jdbc/mysql" * datasource-mapping = "mySQL" * */ public abstract class FooBean implements EntityBean { /** The EntityContext */ private EntityContext context; /** * @ejb.persistence * column-name = "pk" * jdbc-type = "INTEGER" * * @ejb.interface-method * view-type = "local" */ abstract public Integer getPk(); /** * @ejb.interface-method * view-type = "local" */ abstract public void setPk(Integer newVal); /** * @ejb.persistence * column-name = "msg" * jdbc-type = "VARCHAR" * * @ejb.interface-method * view-type = "local" */ abstract public String getMsg(); /** * @ejb.interface-method * view-type = "local" */ abstract public void setMsg(String newVal);
It seems logical that the @ejb.bean …. view-type=local would propogate to the underlying CMP fields. But that attribute is only used to say that local interfaces are available in this bean, it doesn’t automatically make all get/set methods local. So you have to specify them individually.
May 18, 2004 at 2:52 am #207119
europarlMemberThis works like a charm.
Once again: kudos for MyEclipse support team!
David
-
AuthorPosts