I'm having some fields to be updated in hashmap and I'm trying to put it in the session.update(Object object). But Im getting exception error as Unknown entity: java.util.HashMap. Here is my code.
 private Map <String, Object> conditions=new HashMap <String, Object>();
    public void addCondition(String field, Object condition){
            conditions.put(field, condition);
        }
    public Object getFilter(String field){
            return conditions.get(field);
        }
    public Map<String,Object>getFilterMap(){        
            return conditions;
        }
To Update these fields:
 class_name.addCondition("loginName", "dadan_evil"); 
    class_name.addCondition("lastName", "Pirate");
    session.update(filter.getFilterMap());//I tried this, but not working
User.hbm.xml:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC 
 "-//Hibernate/Hibernate Mapping DTD//EN"
 "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> 
<hibernate-mapping>
   <class name="in.co.User" table="user">
      <meta attribute="class-description">
         This class contains the user detail. 
      </meta>
      <id name = "loginName" type="string" column="loginName">
      </id>
      <property name="passCode" column="passCode" type="string"/>
      <property name="firstName" column="firstName" type="string"/>
      <property name="lastName" column="lastName" type="string"/>
      <property name="alternateEMail" column="alternateEMail" type="string"/>
      <property name="mobile" column="mobile" type="string"/>
      <property name="sysAdmin" column="sysAdmin" type="boolean"/>
      <property name="deleted" column="deleted" type="boolean"/>
      <property name="authenticationCode" column="authenticationCode" type="string"/>
      <property name="authenticated" column="authenticated" type="boolean"/>
   </class>
</hibernate-mapping>
And my update method:
private static void updateFromQuery(DBFilter filter) throws Exception {
        Session session = factory.openSession();
        try{
            Class<?> className = filter.getCollectionClass();
            Criteria criteria = session.createCriteria(className);
            criteria.add(Restrictions.allEq(filter.getFilterMap()));
            //I dont know how to update this, just an imaginary parameter
            session.update(filter.getFilterMap());
        }catch(HibernateException e){
            e.printStackTrace();
        }finally{
            session.close();
        }
    }
And I can't write down a string query either because I have got multiple tables and different values. And I'm even getting the class Names dynamically. So I can't use the string query to be common for all. So, if I can then please tell me.
Now, how can I update this two values to the database. Please help
