Re: Object is not (yet) associated to a database container
Leo Mekenkamp <[email protected]>
| Newsgroups | gmane.comp.java.ozone.user |
|---|---|
| Message-ID | <1078234007.27121.8.camel@mars> |
On Tue, 2004-03-02 at 14:02, "Gonçalo E.D. Luiz" wrote:
> I'm getting that error when creating an HashMap inside the OzoneObject ctor.
public class FooImpl extends OzoneObject implements OzoneRemote {
private HashMap m;
public FooImpl() {
m = new HashMap();
}
}
Should not generate any errors. However:
public class FooImpl extends OzoneObject implements OzoneRemote {
private HashMap m;
public FooImpl() {
m = new HashMap();
m.put(self(), self()); // this does not work
m.put(this, this); // this is even worse
}
}
There is only one good solution to this problem:
public class FooImpl extends OzoneObject implements OzoneRemote {
private HashMap m;
public FooImpl() {
m = new HashMap();
}
public void onCreate() {
super.onCreate();
m.put(self(), self());
}
}
Cheers,
Leo
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click