Florian Lindner wrote: > > Florian Lindner wrote: > > >Hello, > > >I'm searching for the best concept of how to use and save > > >hierarchical data. I have a structure like PC file system with meta > > >data. There a folder objects and files objects of different types.
> > >Every object have data like permissions, date and author. And they > > >have type-specific data fields like resolution (of an image type) or > > >location (of an meeting > > > type) or ingredients (of an recipe type). > > >What is the best way to store that kind of data? What database is > > >recommendable? What concepts of persistance? Or not using managed > > >persistance and do it manually? > > > > If you want to do it manually, a hierarchical tree can be represented > > by just one table: > > > > CREATE TABLE tree ( > > id INTEGER PRIMARY KEY, > > parent_id INTEGER > > ); > > > > With managed persistence, be carefull not to configure it to load the > > entire tree at once. > > > > As for a DB, any decent relational DB will do. > > In this concept I need a table for every type of objekt I want? It depends on if you want the DB to handle data integrity for you. If you are happy to have everything as key-value pairs you can come away with two tables. Add a table with columns kay, values and a foreign key to the suggested tree table. If you want specific data integrity per type you will have to have one table per type. It also seems that some data is there for all types (permissions, date and author). Maybe you want to reuse that definition in one table. In the end it depends on what you will be using this tree of data for, how will you access it and what technology will be used? Will it be read-only or both reads and writes? Volumes? Number of users? If data is to be updated by several users I think youl should definitely use a relational database of some kind. If it is read-only then XML files will be good enough. Hibernate is a good persistence framework to use if you want to do the modeling in XML or Java. Fredrik --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]