Re: Advice on persistent storage in Java?

From: john martin (jmartin_at_cs.stanford.edu)
Date: 12/13/04


Date: Mon, 13 Dec 2004 01:48:44 -0600

Dimitri Maziuk wrote:
> john martin sez:
>
>>I need some advice on persistent storage in Java.
>
> ...
>
>>The two general options I'm considering are using an object oriented DB
>>(e.g., PERST, http://www.garret.ru/~knizhnik/perst.html), and a regular
>>SQL DB (e.g., hsqldb, http://hsqldb.sourceforge.net/).
>
>
> I've never used PERST & I use HSQLDB all the time.
>
> Is your data structure an object? -- i.e. does it have to
> have methods? If it's just data, it should map to regular
> relational schema, no need for OO DB. (You can store objects
> in HSQLDB, BTW, I just never needed that myself.)

the structure is a couple of different types of objects, although the
objects are meant to store user defined data (the user defines the
structure of the data in addition to the values), so the schema wouldn't
be known ahead of time. so it seems easiest to be able to store whole
objects.

>
> Most database engines are optimized for query speed. If you
> need to repeatedly load your data into DB, you won't get good
> performance (i.e. lots of INSERT/UPDATEs and relatively few
> SELECTs vs. lots of SELECTs & few INSERTs).

yeah, it'd be more querying than updating.

>
> HSQLDB doesn't have a good query optimizer (how much smarts can
> you fit into 200Kb?) so if you use a lot of complex SQL you may
> not get good performance.

the SQL would probably all be pretty basic.

>
> What you do get from RDB is SQL. From PERST docs, join of two
> tables requires half a dozen lines of code and as many objects
> (indexes, projections, result array, comparator). In SQL it's
> one line: less code to write, lower development & maintenance
> costs.
>
> OTGH, if you don't need advanced search capabilities of SQL
> and can do all your access via Hashmap or two, why not just
> make your data Serializable and dump it to disk yourself?

i guess i'm a bit wary of using serialization for long term storage, but
probably overly so. i'm thinking about using serialization for now
while i get started, and then switching over to something more robust
later on. although if i end up using hibernate, which lots of people
have recommended (i posted this same question in a couple of other
places), that wouldn't be the best design decision, since it would
ideally be more tightly integrated into the code than using
serialization or a DB via a persistence layer.

>
> Dima



Relevant Pages

  • Re: Problems with querying date field
    ... >> If you want to put a database somewhere for safekeeping, ... database - SQL isn't about persistence, ... says nothing about the physical storage media to be used. ... store data on a tape, or a disk, or a CD, or a file, or any physical ...
    (microsoft.public.sqlserver.programming)
  • Re: Should I place a Domain controller in each of the 40 stores?
    ... They should be able to do that, one common way is to use a SQL account in an mixed SQL authentication enviroment where the Apps use a dedicated local SQL account to connect to the DB, but again the app may work differently. ... Also note that although it is possible, it's NOT recommended to cluster for example a SQL server that is also a DC. ... We plan to place a SQL server in each store as part of a new POS ... implementation and also migrate to XP Embedded for the POS terminals. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Global Temp Table & Multiple Users
    ... design and I'm not sure if performance would be any better. ... about serialization is that it limits the dbms pounding that these reports ... what is happening is this a dynamic SQL ... > The inner proc generates a portion of the SQL, ...
    (microsoft.public.sqlserver.server)
  • Re: Need Aggregate Query Help!!!
    ... else than what I am suggesting. ... I was using Access SQL with JET backend. ... (SELECT EmpName, Store, SUM(Qty) ... GROUP BY EmpName, Store) as B ...
    (microsoft.public.access.queries)
  • Re: Something More Elegant
    ... c.CategoryID=%s;' % (store, store, categoryID) ... sql = 'select distinct p.ID from %sPackages p join ... distinct p.ID from productsPackages p join productsCategoriesPackages c ... query = 'select distinct p.ID from productsPackages p join ...
    (comp.lang.python)