Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 32
Registered: ‎11-21-2008
My Device: Not Specified
Accepted Solution

ObjectGroup and NonPersistableObjectException

I'm trying to reduce my in-memory handles by using the ObjectGroup.createGroup() on an array of objects.  The JDE 4.1 documentation does not mention anything about the objects needing to be Persistable or that a NonPersistableObjectException can be thrown.  The JDE 4.3 mentions in the class intro that it is for persistent handles but does not mention the exception.

 

Is there a way to group non-persistent objects?

 

Thanks,

Philippe

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: ObjectGroup and NonPersistableObjectException

Not the answer to your particular question, but this link will help you to find a solution:

 

Blackberry Memory Best Practices Book

Developer
Posts: 32
Registered: ‎11-21-2008
My Device: Not Specified

Re: ObjectGroup and NonPersistableObjectException

Not helpful but thanks.

 

Philippe

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: ObjectGroup and NonPersistableObjectException

[ Edited ]

Sorry for misunderstanding.

 

I see the workaround in implementation of your own grouping mechanism.

 

For example when you are grouping a list of objects you are creating an xml structure (one string class instance).

 

And when you are ungrouping you are parsing this xml and creating "live" object instances.

 

What do you think?

 

 

Message Edited by tbilisoft on 23-06-2009 08:36 PM
Developer
Posts: 32
Registered: ‎11-21-2008
My Device: Not Specified

Re: ObjectGroup and NonPersistableObjectException

I think the only reason they put in the Persistable requirement is so that to make the programmer think as to what objects might be copied (in the hopes the user is careful and limits the number of peristable objects and thus prevents the accidental inclusion of large trees of objects).  Otherwise it appears to be a completely pointless restriction (I added a bunch of "implements Persistable" but never persist the objects and it seem to run).

 

Thanks

Philippe

Highlighted
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: ObjectGroup and NonPersistableObjectException

Some classes cannot be declared as Persistable, because these classes have non-persistable fields inside.