Herunterladen als
root/src/relation.h @ bb5e9339
24c5480c | Christian Ehringfeld | #ifndef RELATION_H
|
|
#define RELATION_H
|
|||
#include <QString>
|
|||
namespace CuteEntityManager {
|
|||
enum RelationType {
|
|||
bb5e9339 | SebastianDiel | ONE_TO_ONE, //e.g. specialization, heritage
|
|
ba800d6d | Christian Ehringfeld | ONE_TO_MANY, //@OneToMany(cascade=ALL, mappedBy="customer")
|
|
MANY_TO_ONE, //1-n Entity foreign key in same table
|
|||
MANY_TO_MANY,
|
|||
};
|
|||
enum CascadeType {
|
|||
ALL,
|
|||
MERGE,
|
|||
PERSIST,
|
|||
REFRESH,
|
|||
REMOVE,
|
|||
24c5480c | Christian Ehringfeld | };
|
|
class Relation {
|
|||
public:
|
|||
Relation();
|
|||
Relation(QString propertyName, RelationType type, bool optional = true);
|
|||
ba800d6d | Christian Ehringfeld | /**
|
|
* @brief Relation
|
|||
* @param propertyName
|
|||
* @param type
|
|||
* @param mappedBy Q_PROPERTY in foreign Entity
|
|||
*/
|
|||
Relation(QString propertyName, RelationType type, QString mappedBy, QString tableName = "",
|
|||
CascadeType cascadeType = ALL);
|
|||
24c5480c | Christian Ehringfeld | ~Relation();
|
|
RelationType getType() const;
|
|||
void setType(const RelationType &value);
|
|||
QString getPropertyName() const;
|
|||
void setPropertyName(const QString &value);
|
|||
bool getOptional() const;
|
|||
void setOptional(bool value);
|
|||
ba800d6d | Christian Ehringfeld | QString getMappedBy() const;
|
|
void setMappedBy(const QString &value);
|
|||
QString getTableName() const;
|
|||
void setTableName(const QString &value);
|
|||
CascadeType getCascadeType() const;
|
|||
void setCascadeType(const CascadeType &value);
|
|||
24c5480c | Christian Ehringfeld | protected:
|
|
QString propertyName;
|
|||
ba800d6d | Christian Ehringfeld | QString mappedBy;
|
|
QString tableName;
|
|||
24c5480c | Christian Ehringfeld | RelationType type;
|
|
ba800d6d | Christian Ehringfeld | CascadeType cascadeType;
|
|
24c5480c | Christian Ehringfeld | bool optional;
|
|
};
|
|||
}
|
|||
#endif // RELATION_H
|