You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@juddi.apache.org by Steve Viens <sv...@attbi.com> on 2003/04/11 13:21:05 UTC

[juddi-Users] re: ID Fields in juddi database.

Rick, great observation and a good question - I'm glad to see you're 
digging into the code. I hope you don't mind but I'd like to include the 
jUDDI-users on my reply in case others have an opinion and would like to 
comment on it.

It is intended behavior actually. We were not really concerned about 
making the contact id unique since it's only ever referenced in context 
with a business entity - the combination business_key + contact_id is 
completely unique and we don't have to be concerned with maintaining a 
unique sequential number generator. We use this same approach for 
many/most/all? repeating values in the UDDI data structure.

What we do care about is that the order of the contacts are retained and 
by inserting using the index of a for-loop and selecting using an 'ORDER 
BY CONTACT_ID' we know we will always return these values in the same 
order they were sent to us. This allows UDDI clients to implement 
functionality that let's users set the order of these values - as long as 
the UDDI request is sent to us in that order we'll guarantee to return 
them in that order.

That said, if you can suggest a reason to make these ID's unique please 
don't hesitate to bring it up. We (well, I) didn't see the need at the 
time but - I'm not perfect!

cheers,

Steve

> Hi Steve,
> 
> 	I have things up and running, but I do have a few questions 
about the 
> database tables.
> 
> I am using mySQL on linux.  Most of the tables have id fields such as 
> contact_id in the the contact table.  This field is set in the code to 
> the index of an entry in a vector.  For example in the file 
> ContactTable.java the method insert sets the id as follows.
> 
>   for (int contactID=0; contactID<listSize; contactID++)
>        {
>          Contact contact = (Contact)contactList.elementAt(contactID);
> 
>          statement.setInt(2,contactID);
>          statement.setString(3,contact.getUseType());
>          statement.setString(4,contact.getPersonNameValue());
> 
>          log.info("insert into CONTACT table:\n\n\t" + insertSQL +
>            "\n\t BUSINESS_KEY=" + businessKey.toString() +
>            "\n\t CONTACT_ID=" + contactID +
>            "\n\t USE_TYPE=" + contact.getUseType() +
>            "\n\t PERSON_NAME=" + contact.getPersonNameValue() + "\n");
> 
>          statement.executeUpdate();
> .
> .
> .
> .
> 
> This means that each call to insert will create rows that may/will have 
> the same contact_id value.  (the contact_id will not be unique ).  Is 
> this the intended behavior?  Most of the code that I have written/used 
> has the id fields as auto_increment so that it can be used as a unique 
> index into the table.
> 
> I found this out by looking at my database tables after creating 
> several entries.  The ID fields of the tables were pretty much all 0 
> since I was doing things 1 entry at a time.  It just looked strange to 
> me.
> 
> 
> Thanks
> 
> Rick
> 
> 
> 
> 
> 

Steve Viens
Consulting Software Engineer
www.steveviens.com
sviens@attbi.com
603.682.5230
 
Sun Certified Architect for Java™ Technology
Sun Certified Developer for the Java™ 2 Platform
Sun Certified Programmer for the Java™ 2 Platform


--
This message was sent using Sake Mail, a web-based email tool from
Endymion Corporation.  http://www.endymion.com/products/sake