views:

170

answers:

2
+1  Q: 

Subsonic and DB4O

I was recently reading Rob Conery's post about DB4O and it was very interesting. My question is really concerned with class generation and future use of Subsonic and DB4O.

As Subsonic looks at the database and then generates classes how would this work for DB4O. Would the classes have to be written by hand and then DB4O would store the objects as defined by the class or would there be some database design procedure that a class generator like Subsonic could use?

Will Subsonic include DB4O as one of the databases it works against in future builds?

+1  A: 

The only place i can see for Subsonic in this technology stack would be to use Subsonic to replicate (instead of/in addition to NHibernate) a db4o database to some RDBMS.

See: http://www.db4o.com/about/productinformation/drs/

It makes more sense for db4o to latch on to Subsonic to do RDBMS persistance then it is for Subonic to use db4o to generate/re-use classes. A db4o file does not contain a fully qualified domain schema. It could thus be possible that a db4o domain has some unpersisted types that can never be discovered by a tool such as Subsonic because no object of that type has ever been written to the database.

Martijn Laarman
I didnt realise that DB4O did a RDBMS replication service. Useful! Good point about the use of Subsonic etc. I guess what I am thinking is a way to generate classes to start with to begin DB4O use based on some sort of data storage design and then IF Subsonic could be used to query the DB4O database
Jon
You could subsonic to generate classes from a database and then decouple those classes and store them in db4o :) Other way round won't work due to the lack of a schema in db4o as mentioned in my post. So subsonic wont be able to query a db4o database in the sameway it can with it a RDBMS.
Martijn Laarman
A: 

Would the classes have to be written by hand and then DB4O would store the objects as defined by the class or would there be some database design procedure that a class generator like Subsonic could use?

With either SubSonic or DB4O, you can write your classes by hand. In fact, this is a pretty normal way to do things. Once you've created your classes by hand, SubSonic can generate relational database tables. DB4O doesn't need relational database tables, so there is no value add to SubSonic at that point.

Will Subsonic include DB4O as one of the databases it works against in future builds?

That doesn't make sense. DB4O is an object-oriented database. There is no relational mapping needed. SubSonic is an object-relational mapping tool and therefore it's only relevant for relational databases.

SubSonic has no use in the DB4O world.

Michael Maddox
EURKEA! Light bulb just come on. If I have Person class with a List<Pet> property then Subsonic would construct the SQL to go across the Person,Pet and PersonPet link table and return the info to populate class objects but in DB4O none of that is necessary. Thanks. On my other point I was just trying to think of generating classes from my existing database to have somewhere to start from. I have a lot of tables and dont fancy writing loads of classes to start with
Jon
@Jon: You can use T4 to generate classes from a database. There are many ways to do this and many samples out there. SubSonic is one example of using T4 to generate classes from a database, but it is hardly unique in this regard. There are many code generators out there as well like CodeSmith and MyGeneration. You can even write your own (but please don't!).
Michael Maddox