In EJB 2.0 gets/sets are declared abstract.
The container implements them for you.

-tim

> -----Original Message-----
> From: Juan Lorandi (Chile) [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 11, 2000 1:42 PM
> To: Orion-Interest
> Subject: RE: EJB2.0 Generated class uncompilable
> 
> 
> geez! setBar is abstract....
> no abstract methods needed...
> 
> The container uses indeirection to implement DB code...
> 
> so, your get/set pair should look like:
> //
> public java.util.Set bars;
> //
> public Set getBars()
> {
>       return bars;
> }
> public void setBars(Set bars)
> {
>       this.bars = bars;
> }
> 
> and so on for Identity, and all other fields
> 
> HTH
> 
> JP
> 
> -----Original Message-----
> From: Peter Pontbriand [mailto:[EMAIL PROTECTED]]
> Sent: Lunes, 11 de Diciembre de 2000 13:38
> To: Orion-Interest
> Subject: Re: EJB2.0 Generated class uncompilable
> 
> 
> 
> ----- Original Message -----
> From: "Tim Drury" <[EMAIL PROTECTED]>
> To: "Orion-Interest" <[EMAIL PROTECTED]>
> Sent: Friday, December 08, 2000 5:39 PM
> Subject: RE: EJB2.0 Generated class uncompilable
> 
> 
> >
> > Since your bean is called "Foo" I'm going to guess
> > that it is a trivial "Hello World" bean.  Why don't
> > you post the bean code and the ejb-jar.xml (don't
> > attach/zip/etc - just dump it)?
> >
> > -tim
> 
> Well, it is rather trivial at the moment. That makes the 
> deployments errors
> all the more frustrating, of course.
> BTW, blowing away the entire deployment does _not_ eliminate 
> the deploytment
> problems - that was one of the first things we tried.
> 
> Here's the current state of the source:
> 
> Foo.java is:
> 
> ---------------------
> /* Generated by Together */
> 
> package com.foo.components.foo.bean;
> 
> import javax.ejb.EntityBean;
> import javax.ejb.EntityContext;
> import java.rmi.RemoteException;
> import javax.ejb.EJBException;
> import javax.ejb.CreateException;
> import java.sql.SQLException;
> import javax.ejb.FinderException;
> import java.util.Set;
> 
> import com.canlink.components.base.GUID;
> import com.foo.components.foo.*;
> 
> public abstract class FooBean implements EntityBean, FooBusiness
> {
>     private EntityContext ejbContext;
>     private transient boolean isModified = false;
> 
>     public void setEntityContext(EntityContext context) throws
> RemoteException, EJBException
>     {
>         ejbContext = context;
>     }
> 
>     public void unsetEntityContext() throws RemoteException, 
> EJBException
>     {
>         ejbContext = null;
>     }
> 
>     public void ejbActivate() throws RemoteException, EJBException
>     {
>     }
> 
>     public void ejbPassivate() throws RemoteException, EJBException
>     {
>     }
> 
>     public void ejbRemove() throws RemoteException, EJBException
>     {
>     }
> 
>     public void ejbStore() throws RemoteException, EJBException
>     {
>         isModified = false;
>     }
> 
>     public void ejbLoad() throws RemoteException, EJBException
>     {
>     }
> 
>     public EntityPK ejbCreate(Set bars)
>         throws
>             CreateException,
>             EJBException,
>             RemoteException,
>             SQLException
>     {
>      setIdentity(GUID.getNewGUID());
>         setBars(bars);
>         isModified = true;
>         return null;
>     }
> 
>     public void ejbPostCreate(Set bars)
>         throws CreateException, EJBException, 
> RemoteException, SQLException
>     {}
> 
>  public boolean isModified()
>     {
>         return isModified;
>     }
> 
>     abstract public Set getBars();
> 
>     abstract protected void setBars(Set bars);
> 
>  public FooValueObject get()
>         throws RemoteException
>     {
>   return new FooValueObject(
>             (EntityPK)ejbContext.getPrimaryKey(),
>             getBars());
>     }
> 
>  public FooValueObject set(FooValueObject mutator)
>         throws  RemoteException
>     {
>         setBars(mutator.getBars());
>         isModified = true;
>         return get();
>     }
> 
>     abstract public long getIdentity();
> 
>     abstract protected void setIdentity(long identity);
> 
> }
> ---------------------
> 
> Bar.java is:
> ---------------------
> /* Generated by Together */
> 
> package com.foo.components.foo.bean;
> 
> import javax.ejb.EntityBean;
> import javax.ejb.EntityContext;
> import java.rmi.RemoteException;
> import javax.ejb.EJBException;
> import javax.ejb.CreateException;
> import java.sql.SQLException;
> import javax.ejb.FinderException;
> import java.util.Set;
> 
> import com.canlink.components.base.GUID;
> import com.foo.components.foo.*;
> 
> public abstract class BarBean implements BarBusiness, EntityBean
> {
>     private EntityContext ejbContext;
>     private boolean isModified = false;
> 
>     public void setEntityContext(EntityContext context) throws
> RemoteException, EJBException
>     {
>         ejbContext = context;
>     }
> 
>     public void unsetEntityContext() throws RemoteException, 
> EJBException
>     {
>         ejbContext = null;
>     }
> 
>     public void ejbActivate() throws RemoteException, EJBException
>     {
>     }
> 
>     public void ejbPassivate() throws RemoteException, EJBException
>     {
>     }
> 
>     public void ejbRemove() throws RemoteException, EJBException
>     {
>     }
> 
>     public void ejbStore() throws RemoteException, EJBException
>     {
>         isModified = false;
>     }
> 
>     public void ejbLoad() throws RemoteException, EJBException
>     {
>     }
> 
>     public EntityPK ejbCreate(Set foos)
>         throws
>             CreateException,
>             EJBException,
>             RemoteException,
>             SQLException
>     {
>      setIdentity(GUID.getNewGUID());
>         isModified = true;
>         return null;
>     }
> 
>     public void ejbPostCreate(Set foos)
>         throws CreateException, EJBException, 
> RemoteException, SQLException
>     {}
> 
>  public boolean isModified()
>     {
>         return isModified;
>     }
> 
>     abstract public Set getFoos();
> 
>     abstract protected void setFoos(Set foos);
> 
>  public BarValueObject get()
>         throws RemoteException
>     {
>         return new BarValueObject(
>             (EntityPK)ejbContext.getPrimaryKey(),
>             getFoos());
>     }
> 
>     public BarValueObject set(BarValueObject mutator)
>         throws  RemoteException
>     {
>         setFoos(mutator.getFoos());
> 
>         isModified = true;
>         return get();
>     }
> 
>     abstract public long getIdentity();
> 
>     abstract protected void setIdentity(long identity);
> }
> ---------------------
> 
> ejb-jar.xml is:
> ---------------------
> <?xml version="1.0"?>
> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
> JavaBeans 2.0//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd">
> 
> <ejb-jar>
>     <enterprise-beans>
>         <entity>
>             <description>A Bar, having a set of Foos</description>
>             <display-name>Bar_Component</display-name>
>             <ejb-name>BarEJB</ejb-name>
>             <abstract-schema-name>BarEJBSchema</abstract-schema-name>
>             <home>com.foo.components.foo.BarHome</home>
>             <remote>com.foo.components.foo.Bar</remote>
>             <ejb-class>com.foo.components.foo.bean.BarBean</ejb-class>
>             <persistence-type>Container</persistence-type>
>             
> <prim-key-class>com.foo.components.foo.EntityPK</prim-key-class>
>             <reentrant>False</reentrant>
>             <cmp-field>
>                 <field-name>identity</field-name>
>             </cmp-field>
>             <cmp-field>
>                 <field-name>foos</field-name>
>             </cmp-field>
>             <ejb-ref>
>                 <ejb-ref-name>ejb/FooEJB</ejb-ref-name>
>                 <ejb-ref-type>Entity</ejb-ref-type>
>                 <home>com.foo.components.foo.FooHome</home>
>                 <remote>com.foo.components.foo.Foo</remote>
>                 <ejb-link>ejb/FooEJB</ejb-link>
>             </ejb-ref>
>         </entity>
>         <entity>
>             <description>A Foo having a set of Bars</description>
>             <display-name>Foo_Component</display-name>
>             <ejb-name>FooEJB</ejb-name>
>             <abstract-schema-name>FooEJBSchema</abstract-schema-name>
>             <home>com.foo.components.foo.FooHome</home>
>             <remote>com.foo.components.foo.Foo</remote>
>             <ejb-class>com.foo.components.foo.bean.FooBean</ejb-class>
>             
> <prim-key-class>com.foo.components.foo.EntityPK</prim-key-class>
>             <reentrant>False</reentrant>
>             <persistence-type>Container</persistence-type>
>             <cmp-field>
>                 <field-name>identity</field-name>
>             </cmp-field>
>             <cmp-field>
>                 <field-name>bars</field-name>
>             </cmp-field>
>             <ejb-ref>
>                 <ejb-ref-name>ejb/BarEJB</ejb-ref-name>
>                 <ejb-ref-type>Entity</ejb-ref-type>
>                 <home>com.foo.components.foo.BarHome</home>
>                 <remote>com.foo.components.foo.Bar</remote>
>                 <ejb-link>ejb/BarEJB</ejb-link>
>             </ejb-ref>
>         </entity>
>     </enterprise-beans>
>     <relationships>
>         <ejb-relation>
>             <ejb-relation-name>Foo-Bar</ejb-relation-name>
>             <ejb-relationship-role>
> 
> <ejb-relationship-role-name>foo-has-bars</ejb-relationship-role-name>
>                 <multiplicity>many</multiplicity>
>                 <role-source>
>                     <ejb-name>FooEJB</ejb-name>
>                 </role-source>
>                 <cmr-field>
>                     <cmr-field-name>bars</cmr-field-name>
>                     
> <cmr-field-type>java.util.Collection</cmr-field-type>
>                 </cmr-field>
>             </ejb-relationship-role>
>             <ejb-relationship-role>
> 
> <ejb-relationship-role-name>bar-has-foos</ejb-relationship-role-name>
>                 <multiplicity>many</multiplicity>
>                 <role-source>
>                     <ejb-name>BarEJB</ejb-name>
>                 </role-source>
>                 <cmr-field>
>                     <cmr-field-name>foos</cmr-field-name>
>                     
> <cmr-field-type>java.util.Collection</cmr-field-type>
>                 </cmr-field>
>             </ejb-relationship-role>
>         </ejb-relation>
>     </relationships>
> </ejb-jar>
> ---------------------
> 
> P. Pontbriand
> Canlink Interactive Technologies inc.
> 
> 

Reply via email to