     (mapping [:CreationTime] :CreationTime)
     (mapping [:Validity] :Validity)
     (mapping [:ProductName] :ProductName)
-    (mapping [:ProductVersion] :ProductVersion)))
-;ASSOC MANAGER: SERVICE   (column "serviceId" :serviceId :notnull)
-;ASSOC MANAGER: MANAGER   (column "managerId" :managerId :notnull)
+    (mapping [:ProductVersion] :ProductVersion))
+  (add-relation [:managerId :Id]); ?????
+  (add-relation :manager_fk_ServiceId))
+;TODO ASSOC MANAGER: MANAGER   (column "managerId" :managerId :notnull) // IS IT NOT RELATION!?
+
+
 
 (foreach [:resource]
   (add-instance :Resource
     (mapping-pk [:Id] :ID)
     (mapping [:Name] :Name)
     (mapping [:CreationTime] :CreationTime)
-    (mapping [:Validity] :Validity)))
-;ASSOC RESOURCE: MANAGER   (column "managerId" :managerId :notnull)
-;ASSOC RESOURCE: SHARE (table "resourceshare" :resourceshare   (column "resourceId" :resourceId :pk :notnull) (column "shareId" :shareId :pk :notnull))
+    (mapping [:Validity] :Validity))
+  (add-relation :resource_fk_ManagerId))
+;TODO ASSOC RESOURCE: SHARE (table "resourceshare" :resourceshare   (column "resourceId" :resourceId :pk :notnull) (column "shareId" :shareId :pk :notnull))
 
 (foreach [:service]
   (add-instance :Service

    (mapping [:Name] :Name)
    (mapping [:CreationTime] :CreationTime)
    (mapping [:Validity] :Validity)
    (mapping [:Description] :Description)))
;ASSOC SHARE: SERVICE   (column "serviceId" :serviceId :notnull)
;ASSOC SHARE: ENDPOINT (table "shareendpoint" :shareendpoint (column "shareId" :shareId :pk :notnull) (column "endpointId" :endpointId :pk :notnull))

(table "domain" :domain
  (column "Id" :Id :pk :notnull)
  (column "Name" :Name)
  (column "CreationTime" :CreationTime :notnull)
  (column "Validity" :Validity)
  (column "Description" :Description)
  (column "locationId" :locationId))

(table "userdomain" :userdomain
  (column "Id" :Id :pk :notnull)
  (column "Level" :Level)
  (column "userDomainId" :userDomainId))

(table "userdomainpolicy" :userdomainpolicy
  (column "userDomainId" :userDomainId :pk :notnull)
  (column "policyId" :policyId :pk :notnull))



;????????????????????????????
(table "mappingpolicy" :mappingpolicy
  (column "Id" :Id :pk :notnull)
  (column "Name" :Name)
  (column "CreationTime" :CreationTime :notnull)
  (column "Validity" :Validity)
  (column "Scheme" :Scheme :notnull)
  (column "shareId" :shareId :notnull))

(table "policy" :policy
  (column "Id" :Id :pk :notnull)
  (column "Name" :Name)
  (column "CreationTime" :CreationTime :notnull)
  (column "Validity" :Validity)
  (column "Scheme" :Scheme :notnull))
    (mapping [:StartTime] :StartTime)
    (mapping [:IssuerCA] :IssuerCA)
    (mapping [:DowntimeAnnounce] :DowntimeAnnounce)
    (mapping [:DowntimeInfo] :DowntimeInfo))
  (add-relation :endpoint_fk_ServiceId))


(foreach [:location]
  (add-instance :Location
