db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: Java Class in Derby Table column?
Date Fri, 08 May 2009 19:31:54 GMT
Hi Jim,

You can always store an arbitrary object in a Derby VARCHAR FOR BIT DATA 
column. You just have to write your own serialization logic to turn your 
TreeMap into a byte[] and vice versa. Your table would look something 
like this:

create table AddressBook
    encodedName varchar( 1000) primary key,
    personalDetails varchar for bit data( 32672 )

Let me know if I'm being cryptic here. I'd be happy to explain this 
solution in greater detail if you think it is useful.

Hope this helps,

Jim Crowell wrote:
> Hello,
> I am developing a Java Stand Alone Application. Presently the data entered
> is saved in HDD files of the host. Soon I will be changing the HDD files
> structure to the Apache Derby  Data Base. I am commencing to layout the Data
> Base tables.
> For my Address Book feature I have implemented a Java TreeMap component with
> the following “Ordered Pairs”:
> ‘key’
> Encoded String to uniquely identify the person name.
> ‘value’
> A custom Java Class that contains the person’s control, contact info and
> personal info. The contact info and personal info parameters are maintained
> in their own custom Java Classes.
> Question:
> Basically I would like to place the Java TreeMap into a Derby  table and
> update just the appropriate “Ordered Pairs” as they are entered by my end
> user. end.
> Can I setup a 2 column table as follows:
> ‘Column 0’		The TreeMap ‘key’, i.e. the encoded person name.
> ‘Column 1’		The custom Java Class.
> I am using Java 1.5x, Eclipse and Win XP Pro development platform.
> I am also testing on a Mac OS X 10.5 [Leopard] node.
> Regards,
> Jim Crowell...  
> -----
> Regards,
> Jim...

View raw message