12-17-2012 01:16 PM
I am struggling a bit with data binding. I receive the data in XML-format. I store it in objects for later use. These objects are made Persistable since I want to store them in a hashtable which in turn is stored in persistent storage.
The application is made up of separate projects so definitions of these objects (classes) are shared between the projects via linked source like many other classes. Basically its a background project containing Listeners and some action modules and a GUI project with business logic. This split has worked fine uptil now.
The problem I have run into seems to emanate from having the classes that define the data linked and made "Persistable"
These linked classes that implements "Persistable" causes an error message when the second project is started
in the simulator.
Error Starting MobismaLogHandler Class 'bbcommon.BBConstants' multiply defined
Or is it some other problem??
Solved! Go to Solution.
12-17-2012 03:47 PM
12-17-2012 04:31 PM
Thanks for replying
I can reduce the description of the setup to 3 Eclipse projects.
1. Background engine. Listeners and action threads.
2. Gui and business logic.
3. Common classes.
The common classes are linked vith standard "Link source" methods, not a library. It will result in the same
package name in the other 2 projects. Otherwise it would not compile correctly.
Do I understand you correctly that if a class that is going to be shared between 2 projects and is implementing "Persistable" thn it has to be in a library?
I did use a libray to share code between projects in the previous relese of the app but changed to linked source since it seemed simpler.
Your suggestion of changing the package name defeats the whole idea of having a shared common source would it not?
12-17-2012 04:44 PM
12-17-2012 05:12 PM
Have started out trying a libray. Will test that first.
Ant is a new stumble stone to learn
12-17-2012 05:25 PM - edited 12-17-2012 06:37 PM
"Do I understand you correctly that if a class that is going to be shared between 2 projects and is implementing "Persistable" then it has to be in a library?"
Pretty much. To be 100% accurate, there can only be one 'definition' of a persisted class on the BlackBerry. The easiest way to achieve this is to have the Persisted classes defined in a Library and have applications sharing that Library.
"I did use a library to share code between projects in the previous release of the app but changed to linked source since it seemed simpler."
I think it is simpler too, and it saves issues with packaging too since you know each 'application' is complete. But this issue is the result.
"Your suggestion of changing the package name defeats the whole idea of having a shared common source would it not?"
Yes - because then each 'application' would not be able to read data stored by the other application.
Now, I am not sure I have enough information to make a recommendation to you with 100% confidence, but I think you have two options:
a) create a Library, and import that Library on the Build path of the projects that use this. Then you will ship cods for each of the projects and for the Library.
b) merge everything into one project.
There is a another perhaps less palatable option, and that is to make all the Persistable Objects standard Rim objects. For example, you could store all your Objects as Strings in XML format, and convert them to Objects by parsing them as part of the retrieval from Persistent Store. So your application program still gets an Object, but the data that is persisted is the XML String. But, in addition to the fact that this involves converting Objects to and from standard RIM Java classes, it also means that the Persisted data will not be removed from the device when your app is deleted.
Hope this makes sense.
12-17-2012 05:49 PM
I think taht sums it up pretty good. I am going for the Library solution.
12-18-2012 06:54 PM
12-18-2012 07:40 PM - edited 12-19-2012 04:26 AM
This should not be a problem. You can package as many cods as you like with an application to App World. Some applications I put on App World are multiple projects and I just add all the appropriate cods to the App World deployment.