Revision abb9e8c5
Von Christian Ehringfeld vor mehr als 10 Jahren hinzugefügt
| src/relation.h | ||
|---|---|---|
|
#include <QHash>
|
||
|
namespace CuteEntityManager {
|
||
|
enum RelationType {
|
||
|
ONE_TO_ONE, //e.g. specialization, heritage
|
||
|
ONE_TO_MANY, //@OneToMany(cascade=ALL, mappedBy="customer") e.g. QList<QSharedPointer<Person>>
|
||
|
MANY_TO_ONE, //e.g. QSharedPointer<Person>
|
||
|
ONE_TO_ONE = 0, //e.g. specialization, heritage
|
||
|
ONE_TO_MANY = 1, //@OneToMany(cascade=ALL, mappedBy="customer") e.g. QList<QSharedPointer<Person>>
|
||
|
MANY_TO_ONE = 2, //e.g. QSharedPointer<Person>
|
||
|
//1-n Entity foreign key in same table
|
||
|
MANY_TO_MANY, //e.g. QList<QSharedPointer<Person>> - realized with seperated database table
|
||
|
MANY_TO_MANY = 3, //e.g. QList<QSharedPointer<Person>> - realized with seperated database table
|
||
|
};
|
||
|
|
||
|
enum InheritanceStrategy {
|
||
| ... | ... | |
|
* @param type
|
||
|
* @param mappedBy Q_PROPERTY in foreign Entity
|
||
|
*/
|
||
|
explicit Relation(QString propertyName, RelationType type, QString mappedBy = QString(),
|
||
|
QList<CascadeType> cascadeType = {MERGE, PERSIST, REFRESH});
|
||
|
explicit Relation(QString propertyName, RelationType type,
|
||
|
QString mappedBy = QString(),
|
||
|
QList<CascadeType> cascadeType = {MERGE, PERSIST, REFRESH});
|
||
|
~Relation();
|
||
|
RelationType getType() const;
|
||
|
void setType(const RelationType &value);
|
||
Auch abrufbar als: Unified diff
example not working - wip, maybe tomorrow