commit d518fe5466ea2aa9a5582e1e84b983ba1f4e93e9
Author: Christian Ehringfeld <c.ehringfeld@t-online.de>
Date:   Fri Jul 31 19:30:02 2015 +0200

    update

diff --git a/EntityManager.pro b/EntityManager.pro
index 572c4c7..03ddf5e 100644
--- a/EntityManager.pro
+++ b/EntityManager.pro
@@ -22,7 +22,6 @@ src/entity.h \
     src/schema/sqlitequerybuilder.h \
     src/relation.h \
     src/entityinstancefactory.h \
-    src/condition.h \
     src/cache.h \
     src/entityhelper.h \
     src/logger.h
@@ -41,7 +40,6 @@ src/entity.cpp \
     src/schema/sqlitequerybuilder.cpp \
     src/relation.cpp \
     src/entityinstancefactory.cpp \
-    src/condition.cpp \
     src/cache.cpp \
     src/entityhelper.cpp \
     src/logger.cpp
diff --git a/samples/example/main.cpp b/samples/example/main.cpp
index 5c5add2..d815693 100644
--- a/samples/example/main.cpp
+++ b/samples/example/main.cpp
@@ -63,16 +63,6 @@ int main(int argc, char *argv[]) {
         e->create(groupPtr, true, true);
     }
 
-    /** ---------------------------------
-     * FIND Pupil
-     * ---------------------------------
-     */
-    QSharedPointer<Entity> pupilFindPtr = e->findById(22, QString("Pupil*"));
-    QSharedPointer<Pupil> pupilPtr = pupilFindPtr.objectCast<Pupil>();
-    qDebug() << "Pupil:" << pupilPtr->toString();
-    qDebug() << "GroupSize:" << pupilPtr->getGroups().size();
-
-
     /** ---------------------------------
      * FIND Group
      * ---------------------------------
@@ -107,13 +97,6 @@ int main(int argc, char *argv[]) {
     qDebug() << "FoundMainTeacherGroupSize:" <<
              foundMainTeacher->getMaintainedGroups().size();
 
-    qDebug() << "-----------------------------";
-    QSharedPointer<Pupil> foundPupil = e->findById<Pupil *>
-                                       (13).objectCast<Pupil>();
-    qDebug() << "FoundPupil:" << foundPupil->toString();
-    qDebug() << "FoundPupilGroupSize:" <<
-             foundPupil->getGroups().size();
-
     qDebug() << "-----------------------------";
 
     qDebug() << "Duration:" << t.elapsed();
diff --git a/samples/example/models/group.cpp b/samples/example/models/group.cpp
index e1ba588..5e3bd16 100644
--- a/samples/example/models/group.cpp
+++ b/samples/example/models/group.cpp
@@ -8,10 +8,10 @@ Group::Group() : Entity() {
 
 const QHash<QString, CuteEntityManager::Relation> Group::getRelations() const {
     auto hash = QHash<QString, CuteEntityManager::Relation>();
-    hash.insert("pupils", CuteEntityManager::Relation("pupils",
-                RelationType::MANY_TO_MANY));
     hash.insert("persons", CuteEntityManager::Relation("persons",
                 RelationType::MANY_TO_MANY));
+    hash.insert("pupils", CuteEntityManager::Relation("pupils",
+                RelationType::MANY_TO_MANY, QString("groups")));
     hash.insert("mainTeacher", CuteEntityManager::Relation("mainTeacher",
                 RelationType::MANY_TO_ONE));
     return hash;
diff --git a/samples/example/models/pupil.cpp b/samples/example/models/pupil.cpp
index b01b9e7..a39409d 100644
--- a/samples/example/models/pupil.cpp
+++ b/samples/example/models/pupil.cpp
@@ -30,7 +30,6 @@ void Pupil::setLegalGuardianNote(const QString &value) {
 const QHash<QString, Relation> Pupil::getRelations() const {
     auto hash = Person::getRelations();
     hash.insert("groups", CuteEntityManager::Relation("groups",
-                RelationType::MANY_TO_MANY,
-                QString("pupils")));
+                RelationType::MANY_TO_MANY));
     return hash;
 }
diff --git a/src/condition.cpp b/src/condition.cpp
deleted file mode 100644
index e8db733..0000000
--- a/src/condition.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2015 Christian Ehringfeld <c.ehringfeld@t-online.de>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-#include "condition.h"
-using namespace CuteEntityManager;
-Condition::Condition() {
-
-}
-
diff --git a/src/condition.h b/src/condition.h
deleted file mode 100644
index 1ef4169..0000000
--- a/src/condition.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2015 Christian Ehringfeld <c.ehringfeld@t-online.de>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef CONDITION_H
-#define CONDITION_H
-
-namespace CuteEntityManager {
-class Condition {
-  public:
-    Condition();
-};
-}
-
-#endif // CONDITION_H
diff --git a/src/querybuilder.cpp b/src/querybuilder.cpp
index 379124a..8378095 100644
--- a/src/querybuilder.cpp
+++ b/src/querybuilder.cpp
@@ -972,7 +972,7 @@ void QueryBuilder::bindValues(const QHash<QString, QVariant> &h, QSqlQuery &q,
                               bool ignoreID, const QString &primaryKey) const {
     QHash<QString, QVariant>::const_iterator i = h.constBegin();
     while (i != h.constEnd()) {
-        if (!ignoreID || (ignoreID && !(i.key() == primaryKey))) {
+        if ((!ignoreID || (ignoreID && !(i.key() == primaryKey))) && !i.value().isNull()) {
             this->bindValue(i.key(), i.value(), q);
         }
         ++i;
@@ -1012,7 +1012,7 @@ QString QueryBuilder::attributes(const QHash<QString, QVariant> &m,
     if (!m.isEmpty()) {
         QHash<QString, QVariant>::const_iterator i = m.constBegin();
         while (i != m.constEnd()) {
-            if (!ignoreID || (ignoreID && !(i.key() == primaryKey))) {
+            if ((!ignoreID || (ignoreID && !(i.key() == primaryKey))) && !i.value().isNull()) {
                 if (!(rc == "")) {
                     rc += " " + conjunction + " ";
                 }
