commit 67639b7565248536831d5b144ddfef79047236cc
Author: Christian Ehringfeld <c.ehringfeld@t-online.de>
Date:   Sun Jul 19 21:01:13 2015 +0200

    not working example, caused by a bug in em

diff --git a/samples/example/main.cpp b/samples/example/main.cpp
index f5ac428..62d010a 100644
--- a/samples/example/main.cpp
+++ b/samples/example/main.cpp
@@ -51,10 +51,10 @@ int main(int argc, char *argv[]) {
                                          "Mustermann", Person::Gender::MALE));
     gPtr->setMainTeacher(mainTeacher);
     //Persons will also persisted
-    e->create(groupPtr, true, true);
+    //e->create(groupPtr, true, true);
 
     /** ---------------------------------
-     * FIND
+     * FIND Group
      * ---------------------------------
      */
     QSharedPointer<Entity> groupFindPtr = e->findById<Group *>(1);
@@ -62,6 +62,19 @@ int main(int argc, char *argv[]) {
     qDebug()<< "Group:" << groupFindPtr->toString();
     qDebug() << "PersonSize:" << grp->getPersons().size();
     qDebug() << "MainTeacher:" << grp->getMainTeacher()->toString();
+
+    /** ---------------------------------
+     * FIND Person
+     * ---------------------------------
+     */
+    QSharedPointer<Entity> personFindPtr = e->findById(1,QString("Person*"));
+    e->refresh(personFindPtr);
+    QSharedPointer<Person> pers = personFindPtr.objectCast<Person>();
+    qDebug()<< "MainTeacher:" << personFindPtr->toString();
+    qDebug() << "GroupSize:" << pers->getGroupsMainTeacher().size();
+
+
+
     qDebug() << "Duration:" << t.elapsed();
     return 0;
 }
diff --git a/samples/example/models/person.cpp b/samples/example/models/person.cpp
index 38c9dfa..3a2f074 100644
--- a/samples/example/models/person.cpp
+++ b/samples/example/models/person.cpp
@@ -18,6 +18,9 @@ const QHash<QString, CuteEntityManager::Relation> Person::getRelations() const {
     auto hash = QHash<QString, CuteEntityManager::Relation>();
     hash.insert("groups", CuteEntityManager::Relation("groups", MANY_TO_MANY,
                 QString("persons")));
+    hash.insert("groupsMainTeacher",
+                CuteEntityManager::Relation("groupsMainTeacher",
+                                            ONE_TO_MANY, "mainTeacher"));
     return hash;
 }
 
@@ -120,3 +123,11 @@ void Person::addContact(Contact *contact) {
 void Person::addAddress(Address *address) {
     this->addresses.append(QSharedPointer<Address>(address));
 }
+QList<QSharedPointer<Group> > Person::getGroupsMainTeacher() const {
+    return groupsMainTeacher;
+}
+
+void Person::setGroupsMainTeacher(const QList<QSharedPointer<Group> > &value) {
+    groupsMainTeacher = value;
+}
+
diff --git a/samples/example/models/person.h b/samples/example/models/person.h
index c22a575..d2bde8e 100644
--- a/samples/example/models/person.h
+++ b/samples/example/models/person.h
@@ -25,6 +25,7 @@ class Person: public Entity {
     Q_PROPERTY(QDate birthday READ getBirthday WRITE setBirthday)
     Q_PROPERTY(Gender gender READ getGender WRITE setGender)
     Q_PROPERTY(QList<QSharedPointer<Group>> groups READ getGroups WRITE setGroups)
+    Q_PROPERTY(QList<QSharedPointer<Group>> groupsMainTeacher READ getGroupsMainTeacher WRITE setGroupsMainTeacher)
 
   public:
     enum class Gender {MALE, FEMALE, UNKNOWNGENDER};
@@ -76,7 +77,10 @@ class Person: public Entity {
     void addContact(Contact *contact);
     void addAddress(Address *address);
 
-  protected:
+    QList<QSharedPointer<Group> > getGroupsMainTeacher() const;
+    void setGroupsMainTeacher(const QList<QSharedPointer<Group> > &value);
+
+protected:
     QString firstName;
     QString familyName;
     QString namePrefix;
@@ -87,6 +91,7 @@ class Person: public Entity {
     QList <QSharedPointer<Contact>> contacts;
     QList <QSharedPointer<Address>> addresses;
     QList <QSharedPointer<Group>> groups;
+    QList <QSharedPointer<Group>> groupsMainTeacher;
 };
 
 
