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: 109
Registered: ‎02-09-2009
My Device: Not Specified

Problems with strange NonPersistableObjectExceptions at runtime

During compile time, I get no errors or warnings, but when I try to persist my object, I get the exception. The stack trace is all outside my code, so I am not sure what is going on.

 

I am trying to persist an Object that contains many other objects, each of which contains a few more. Every custom class in it implements Persistable, and several have some primitives. Is there some better way to tell what is going on?

 

Thanks! 

Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Problems with strange NonPersistableObjectExceptions at runtime

There is no way to sort this out at compile time- in fact, I was passing Persistables for a while but realized this

didn't help anything as Object is persistable but every subclass needs to be persistable too. Often you get an autocommit

to blow up- and this will not involve your code. I had two classes mixed up and once I dumpted the class names

and stared at the same output for an hour it made sense as I was just passing the wrong thing.

 

I guess if you know where your pointers are you can check each of them but it could take effort.

 

Now, I'm only using my fake-persistable-DB classes and hashes of strings for perstent objects. Sure, the "db" index targets are

objects but I only have a few of these and they tend to be simple data classes so the suspect list is now limited

and if I wanted to be really OO I could make a specific interface the DB needs to implement.

 

Developer
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: Problems with strange NonPersistableObjectExceptions at runtime

[ Edited ]
Usually a common gotcha is when you have a persistable vector, but what you put in the vector is not marked persistable.
Message Edited by mreed on 05-09-2009 08:19 PM
Developer
Posts: 109
Registered: ‎02-09-2009
My Device: Not Specified

Re: Problems with strange NonPersistableObjectExceptions at runtime

Took me a while, but I found out I had left the interface on a class with a Random. Thanks!