Current position:  Home > Default > Map access problems

Map access problems

Time:November 30
Hi all,
I am populating a hashmap from data. One set of data is the keys and the rest is put inside an array and becomes the value.
private static final  LookupMap<Double, Integer> getFractionLookupMap(){
          Connection connSpe = null;
         PreparedStatement pstmtModel = null;
         ResultSet rsModel = null;  
         Map<Double, Integer[]> fractionLookupMap = new HashMap<Double, Integer[]>();
              //Open connections
              connSpe = getConnection("", Constants.JNDI_R);
              int rowCount = 0;
              pstmtModel = connSpe.prepareStatement(MYSQL.GET_FRACTION_LOOKUP);
              rsModel = pstmtModel.executeQuery();
              if (rsModel != null)
                   Integer[] price = new Integer[2];
                   while (
                        price[0] = rsModel.getInt("NUM");
                        price[1] = rsModel.getInt("DEN");
                        double value = rsModel.getDouble("VALUE");
              "Fraction Value : "+value);
              "Fraction Num : "+price[0]);
              "Fraction Den : "+price[1]);
                        fractionLookupMap.put(value, price);
         "Map size : "+fractionLookupMap.size());
         "Fraction Lookup Rows Retrieved: " + rowCount);
              //close connectionsetc         
         catch(SQLException se)
    "Error in getFractionLookup");
              throw new DatabaseTransactionException(se, "Error communicating with database","","");
                   //close stuff
              catch(SQLException se)
                   //throw stuff
         return new FractionLookupMap(fractionLookupMap);
     }Inside this method all seems OK with with the correct amount of pairings in the map and the correct data in there.
However when i try to use the data inside it doesn't work as expected. I am iterating through the keys to find the nearest value to the lookup value. This seems fine, with all key values correct, but when i try to get the value pairing for that key (or any in fact) i receive the value of the LAST value pairing put onto the map!
Integer[] price = (Integer[]) GenericDao.getFractionLookupMap().getLookupMapResult(value);where FractionLookupMap().getLookupMapResult(value) is simple a lookup on the hashmap object.
This was working perfectly before but i made a change to how the map was populated and made the method static so i'm assuming it had something to do with this but i cant see what.
Any pointers?
Nevermind - solved it, object reference issue