Hybernate SessionFactory is not saving changes
===

The code below silently fails to update the database. There is no error message to report here. It seems as if the line "sessionFactory.getCurrentSession().saveOrUpdate(sn);" (towards the bottom of the snippet) is being ignored. What am I doing wrong?


    	public String getSerialNumber(String id) {
		log.debug("--------------------------------------------------------------------------------------------Looking for Serial number counter named: " + id);
		SerialNumber sn = (SerialNumber) sessionFactory.getCurrentSession().get(SerialNumber.class, id);
		if (sn == null) {
			//TODO Throw an error (maybe). The code below creates a new Serial number counter
			log.debug("NO Serial Number for: " + id + " was found.");
			
			sn = new SerialNumber();
			sn.setSerialNumberId(id);
			sn.setName("Unspecified");
			sn.setValue(1);
			log.debug("-----------------------------------------" + sn.toString());
			sessionFactory.getCurrentSession().save(sn);
			log.debug("--------------------------------------------------------------------------------------------Right after SAVE call. This is id --> " + id);
			return "1";
		}

		sn.setValue(sn.getValue()+1);
		log.debug("--update---------------------------------" + sn.toString());
		log.debug("--update---------------------------------" + sn.getValue());
		sessionFactory.getCurrentSession().saveOrUpdate(sn);
		
		log.debug("--update---------------------------------" + sn.getValue());
		log.debug("--update------------------------------------------------------------------------------------Right after SAVE call. This is id --> " + id);
		return sn.getValue().toString();
	}

