private int insert() {
        
        int n = getWritableFieldsCount();
        String fields = "";
        String separator = "";
        String values = "";
        Object[] valuesObj = new Object[n];
        int i =0;
         
          
        for(BeanTableMapping mapping: tableFields)
        {
            if(!mapping.isAutoincrement() || mapping.isWritable())
            {
                try {
                    fields += separator+mapping.getTableName()+"."+mapping.getTableFieldName();
                    values += separator+"?";
                    separator = ",";
                    Method getter = new PropertyDescriptor(mapping.getBeanFieldName(), mapping.getHoldingClass()).getReadMethod();
                    valuesObj[i] = getter.invoke(beanObj);
                    i += 1;
                } catch (Exception ex) {
                    Logger.getLogger(GenericCrud.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            
        }
        
        
        int nup = 0;
        
        String SQL1 = "INSERT INTO "+fromQuery+" ("+ fields + ")  VALUES("+values+")";
        HashMap<String, Object> preparedUpdateKEYS = database.preparedUpdateKEYS(SQL1,valuesObj);
        for(String tableCol: preparedUpdateKEYS.keySet())
        {
            //Search corresponding bean mapping
            BeanTableMapping currentMapping = null;
            for(BeanTableMapping mapping: tableFields)
            {
                if(mapping.getTableFieldName().equals(tableCol))
                {
                    currentMapping = mapping;
                    break;
                }
            }
            if(currentMapping!=null)
            {
                try {
                    Method setter = new PropertyDescriptor(currentMapping.getBeanFieldName(), currentMapping.getHoldingClass()).getWriteMethod();
                    setter.invoke(beanObj, preparedUpdateKEYS.get(tableCol));
                } catch (Exception ex) {
                    Logger.getLogger(GenericCrud.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        
        return nup;
      }