Current position:  Home > Default > Map access problems

Map access problems

Time:November 30
Advertisement
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[]>();
         try
              //Open connections
              connSpe = getConnection("", Constants.JNDI_R);
              connSpe.createStatement().execute(SET_LOCK_MODE_WAIT);
              int rowCount = 0;
              pstmtModel = connSpe.prepareStatement(MYSQL.GET_FRACTION_LOOKUP);
              rsModel = pstmtModel.executeQuery();
              if (rsModel != null)
                   Integer[] price = new Integer[2];
                   while (rsModel.next())
                        price[0] = rsModel.getInt("NUM");
                        price[1] = rsModel.getInt("DEN");
                        double value = rsModel.getDouble("VALUE");
                        log.info("Fraction Value : "+value);
                        log.info("Fraction Num : "+price[0]);
                        log.info("Fraction Den : "+price[1]);
                        fractionLookupMap.put(value, price);
                        rowCount++;
                   log.info("Map size : "+fractionLookupMap.size());
                   log.info("Fraction Lookup Rows Retrieved: " + rowCount);
              //close connectionsetc         
         catch(SQLException se)
              log.info("Error in getFractionLookup");
              throw new DatabaseTransactionException(se, "Error communicating with database","","");
         finally
              try
                   //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?
Advertisement
Nevermind - solved it, object reference issue

Backing Map Access : Cross-cache joins

-0001-11-30

Hi, I have been experimenting with cross-cache joins using Entry Processors in Coherence 3.7.1. (I have already sent a query to Dave Felcey regarding this - I will post any response from him here - but I just wondered if anyone else has had the same

Fix many web access problems with IFS 9.0.1 on Solaris (and other OS's)...

2015-10-11

When the installation is done according to the documentation, web access does not work because the scripts that add entries to the jserv.properties file add duplicate references to wrapper.env and wrapper.classpath. Look at the jserv.properties file

Fact sheet access problem in EP7.0

-0001-11-30

Hi, We have moved our content from EP6.0 System to EP7.0 System.  We are on CRM 4.0 AND BW3.5.  After we installed the Business package on EP7.0 System we moved the content.  Every thing is working fine except Fact Sheet.  We are facing access proble

JNDI NIS object access problem

-0001-11-30

JNDI NIS object access problem: Hi all, After long fight, i'm now able to connect to my NIS server on my network. the initial context factory is 'com.sun.jndi.nis.NISCtxFactory' and provider url are given and i obtain namingennumeration of items in t

RE: Database (SQL-SERVER) access problem

-0001-11-30

Have you used NT Control Panel/ ODBC to set up the ODBC data source name? You have to define the data source (database) SecTrade as well as the driver to be used (SQL Server). This can be done by selecting the Add button on the Data Sources screen in

Not enough access problem

-0001-11-30

Does anyone know how to fix the not enough access problem that came about after the upgrade?Welcome to the discussions, see this thread for a possible solution posted by iphone3Gguy http://discussions.apple.com/thread.jspa?messageID=10991733&#1099173

Write access problem with external Storage Device Connected to macbook

-0001-11-30

Hi All, I have write access problem ( gives only read-access, but no write access) with an external HDD device (NTFS formatted ) connected to my macbook. Could anyone suggest me a file system ( apart from FAT32) which is compatiable with both Mac OS

TFS 2013: Access problem when adding a AD group to members

-0001-11-30

Hi there! I have a big access problem. It seems I cant log into TFS if I add a AD group to a collection but I can log in if I add single users from the same group. EDIT: The group I want to add is from another domain. Maybe thats the reason for the p

Magic Mouse accessibility problem

-0001-11-30

Have discovered an accessibility problem with the Magic Mouse. My right hand middle (right click) finger is heavily bandaged at the moment. Mouse will not accept right clicks, even all the way on the edge. Interprets them as left/single button click.

N95 8gb One access problem:( plz help

-0001-11-30

Hello there I got N95 8gb , i tried using the one touch access problem using both bluetooth and usb cable. Both didn't work. I also tried the older pc suite which i used to use with my N80, but it ididn't work.(it worked perfectly when i had N80) . A

Security Upgrade 2007-002 (PPC) created website access problems?

-0001-11-30

I recently installed this upgrade, and I think it may be causing interference accessing certain websites, namely motleyfool.com, hotmail.com, and firstrade.com. I'm having this difficulty on multiple machines. Is anyone else having this same problem?

Installing ios8.2 does not resolve Google map navigation problem or gps tracking!

-0001-11-30

Installing ios 8.2 does not resolve Google map navigation problem.I have tried to install both of them lots of times but in each case I receive the same in my XE.bat file: Instance created. DIM-00019: create service error O/S-Error: (OS 1387) Unable

Expression using Map access not working....

2015-10-11

I am attempting to use the ability to access a Map by key from a binding expression on the jsp. I have extended HashMap and overridden the get method in order to return a Boolean from the get(key) method. This works: rendered="#{bean.enabledFunctionS

Windows 2012 R2 - Access problems to NFS shares via IPv6

2015-10-11

Hello, we setup some NFS shares on HNAS storage box. The connection to this storage is only possible over IPv6 network. My server with Windows 2012 R2 has the feature 'Client for NFS' installed and a 'showmount -e servername/or IPv6 address' works. I

Map serialization problem

-0001-11-30

Greetings, gurus. I have a weird problem I cannot overcome quite a long time now. I have a client-server application I am developing. Server holds a handler, which accepts requests and sends responses. In one scenario, the request is received, respon

N95 GPRS MAP LOCATON PROBLEMS

-0001-11-30

Hi, Ive just recently brought the N95 and I am having problems with the GPRS location. I have followed the manual but I just cannot get it to work. Everytime I go into the 'Map' to check my location I keep getting a message saying 'No Network Connect

Iomega Home Media Network Hard Drive network access problem

-0001-11-30

Hello all                          Having trouble accessing Iomega media drive ce,web interface is not responding.Iam able to ping ,map and access shares using win7 and winxp systems.Read and writie to shares.Earlier in 2012-13 experienced similar pr

Sharepoint foundation 2010 externel https access problems

2015-10-11

I have a very strange problem with my sharepoint foundation 2010 site. I have a site which is accessible from outside on https (we have a valid certificate). I configured IIS for http and https. Also I configured internal and externel access for this

ASA 5505 VPN client LAN access problem

2015-10-11

Hello, I'm not expert in ASA and routing so I ask some support the following case. There is a Cisco VPN client (running on Windows 7) and an ASA5505. The goals are client could use remote gateway on ASA for Skype and able to access the devices in ASA