Hashtables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • doniravi
    New Member
    • Jan 2007
    • 12

    #1

    Hashtables

    How retrieve the more than one row from database into hastable using java
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    This is a Java question. I'll move the thread to the Java forum.

    moderator

    Comment

    • abctech
      New Member
      • Dec 2006
      • 157

      #3
      Originally posted by doniravi
      How retrieve the more than one row from database into hastable using java
      Hi,

      I am not an expert in Java but I have a basic idea on Hashtables and how to use them which I would like to share with you,

      As you might already know a Hashtable contains key-value pairs and it maps the keys to the values.Any non-null 'object' can be used as a key or a value.

      So when you retrieve records from your backend-table in a ResultSet what you can do is say pass that ResultSet as an argument to some function having a return type as 'Hashtable'.

      In this function you create a new empty Hashtable.
      Now you can first store your ResultSet-record in say some object and then you can add that object to the hashtable as a 'value' and you can keep the primary- key of that record as the 'key' of this hashtable-entry() if you like.

      Finally after adding all records one by one to the Hashtable until the end of the ResultSet your function can return it to the calling code.

      Hope this helps!

      Comment

      Working...