I'm playing around with building a new web application using DB4O - piles of fun and some really interesting stuff learned. The one thing I'm struggling with is DB4O's current lack of support for stateless applications (i.e. web apps, mostly) and the need for automatically-generated IDs.
There are a number of creative and interesting approaches that I've been able to find that hook into DB4O's events, use GUIDs rather than numeric IDs or for whatever reason avoid using any system of ID at all.
While each approach has its merits, I'm wondering if the less-elegant approach might equally be the best fit. Consider the following pseudo-code:
If ID == 0 or null
Set ID = (typeof(myObject)).Count
myObject.Save
It seems like such a blindingly simple approach, it's usually about here that I start thinking, "I've missed something really obvious". Have I?