Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/JobAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/JobAdapter.cs	(revision 2065)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/JobAdapter.cs	(revision 2066)
@@ -338,9 +338,14 @@
     }
 
-    public ICollection<Job> FindJobs(State state, int cores, int memory) {
+    public ICollection<Job> FindJobs(State state, int cores, int memory,
+      Guid resourceId) {
       return
          base.FindMultiple(
            delegate() {
-             return Adapter.GetDataByStateCoresMemory(state.ToString(), cores, memory);
+             return Adapter.GetDataByStateCoresMemoryResource(
+               state.ToString(), 
+               cores,
+               memory, 
+               resourceId);
            });
     }
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/dsHiveServer.Designer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/dsHiveServer.Designer.cs	(revision 2065)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/dsHiveServer.Designer.cs	(revision 2066)
@@ -76,4 +76,6 @@
         private global::System.Data.DataRelation relationR_37;
         
+        private global::System.Data.DataRelation relationR_44;
+        
         private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
         
@@ -454,4 +456,5 @@
             this.relationR_56 = this.Relations["R_56"];
             this.relationR_37 = this.Relations["R_37"];
+            this.relationR_44 = this.Relations["R_44"];
         }
         
@@ -541,4 +544,8 @@
                         this.tableClient.ClientConfigIdColumn}, false);
             this.Relations.Add(this.relationR_37);
+            this.relationR_44 = new global::System.Data.DataRelation("R_44", new global::System.Data.DataColumn[] {
+                        this.tableJob.JobIdColumn}, new global::System.Data.DataColumn[] {
+                        this.tableJob.ParentJobIdColumn}, false);
+            this.Relations.Add(this.relationR_44);
         }
         
@@ -1938,9 +1945,9 @@
             
             [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-            public JobRow AddJobRow(System.Guid JobId, System.Guid ParentJobId, string JobState, ClientRow parentClientRowByR_21, double Percentage, byte[] SerializedJob, System.DateTime DateCreated, System.DateTime DateCalculated, int Priority, ProjectRow parentProjectRowByR_49, System.Guid UserId, int CoresNeeded, int MemoryNeeded) {
+            public JobRow AddJobRow(System.Guid JobId, JobRow parentJobRowByR_44, string JobState, ClientRow parentClientRowByR_21, double Percentage, byte[] SerializedJob, System.DateTime DateCreated, System.DateTime DateCalculated, int Priority, ProjectRow parentProjectRowByR_49, System.Guid UserId, int CoresNeeded, int MemoryNeeded) {
                 JobRow rowJobRow = ((JobRow)(this.NewRow()));
                 object[] columnValuesArray = new object[] {
                         JobId,
-                        ParentJobId,
+                        null,
                         JobState,
                         null,
@@ -1954,4 +1961,7 @@
                         CoresNeeded,
                         MemoryNeeded};
+                if ((parentJobRowByR_44 != null)) {
+                    columnValuesArray[1] = parentJobRowByR_44[0];
+                }
                 if ((parentClientRowByR_21 != null)) {
                     columnValuesArray[3] = parentClientRowByR_21[0];
@@ -4457,4 +4467,14 @@
             
             [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+            public JobRow JobRowParent {
+                get {
+                    return ((JobRow)(this.GetParentRow(this.Table.ParentRelations["R_44"])));
+                }
+                set {
+                    this.SetParentRow(value, this.Table.ParentRelations["R_44"]);
+                }
+            }
+            
+            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
             public bool IsParentJobIdNull() {
                 return this.IsNull(this.tableJob.ParentJobIdColumn);
@@ -4603,4 +4623,14 @@
                 else {
                     return ((AssignedResourcesRow[])(base.GetChildRows(this.Table.ChildRelations["R_56"])));
+                }
+            }
+            
+            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+            public JobRow[] GetJobRows() {
+                if ((this.Table.ChildRelations["R_44"] == null)) {
+                    return new JobRow[0];
+                }
+                else {
+                    return ((JobRow[])(base.GetChildRows(this.Table.ChildRelations["R_44"])));
                 }
             }
@@ -7402,11 +7432,9 @@
             this._adapter.DeleteCommand = new global::System.Data.SqlClient.SqlCommand();
             this._adapter.DeleteCommand.Connection = this.Connection;
-            this._adapter.DeleteCommand.CommandText = @"DELETE FROM [dbo].[Job] WHERE (([JobId] = @Original_JobId) AND ((@IsNull_ParentJobId = 1 AND [ParentJobId] IS NULL) OR ([ParentJobId] = @Original_ParentJobId)) AND ((@IsNull_JobState = 1 AND [JobState] IS NULL) OR ([JobState] = @Original_JobState)) AND ((@IsNull_ResourceId = 1 AND [ResourceId] IS NULL) OR ([ResourceId] = @Original_ResourceId)) AND ((@IsNull_Percentage = 1 AND [Percentage] IS NULL) OR ([Percentage] = @Original_Percentage)) AND ((@IsNull_DateCreated = 1 AND [DateCreated] IS NULL) OR ([DateCreated] = @Original_DateCreated)) AND ((@IsNull_DateCalculated = 1 AND [DateCalculated] IS NULL) OR ([DateCalculated] = @Original_DateCalculated)) AND ((@IsNull_Priority = 1 AND [Priority] IS NULL) OR ([Priority] = @Original_Priority)) AND ((@IsNull_ProjectId = 1 AND [ProjectId] IS NULL) OR ([ProjectId] = @Original_ProjectId)) AND ((@IsNull_UserId = 1 AND [UserId] IS NULL) OR ([UserId] = @Original_UserId)) AND ((@IsNull_CoresNeeded = 1 AND [CoresNeeded] IS NULL) OR ([CoresNeeded] = @Original_CoresNeeded)) AND ((@IsNull_MemoryNeeded = 1 AND [MemoryNeeded] IS NULL) OR ([MemoryNeeded] = @Original_MemoryNeeded)))";
+            this._adapter.DeleteCommand.CommandText = @"DELETE FROM [dbo].[Job] WHERE (([JobId] = @Original_JobId) AND ((@IsNull_ParentJobId = 1 AND [ParentJobId] IS NULL) OR ([ParentJobId] = @Original_ParentJobId)) AND ((@IsNull_ResourceId = 1 AND [ResourceId] IS NULL) OR ([ResourceId] = @Original_ResourceId)) AND ((@IsNull_Percentage = 1 AND [Percentage] IS NULL) OR ([Percentage] = @Original_Percentage)) AND ((@IsNull_DateCreated = 1 AND [DateCreated] IS NULL) OR ([DateCreated] = @Original_DateCreated)) AND ((@IsNull_DateCalculated = 1 AND [DateCalculated] IS NULL) OR ([DateCalculated] = @Original_DateCalculated)) AND ((@IsNull_Priority = 1 AND [Priority] IS NULL) OR ([Priority] = @Original_Priority)) AND ((@IsNull_ProjectId = 1 AND [ProjectId] IS NULL) OR ([ProjectId] = @Original_ProjectId)) AND ((@IsNull_UserId = 1 AND [UserId] IS NULL) OR ([UserId] = @Original_UserId)) AND ((@IsNull_CoresNeeded = 1 AND [CoresNeeded] IS NULL) OR ([CoresNeeded] = @Original_CoresNeeded)) AND ((@IsNull_MemoryNeeded = 1 AND [MemoryNeeded] IS NULL) OR ([MemoryNeeded] = @Original_MemoryNeeded)))";
             this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text;
             this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_JobId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "JobId", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
             this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_ParentJobId", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ParentJobId", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
             this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_ParentJobId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ParentJobId", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
-            this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_JobState", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "JobState", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
-            this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_JobState", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "JobState", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
             this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_ResourceId", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ResourceId", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
             this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_ResourceId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ResourceId", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
@@ -7430,5 +7458,5 @@
             this._adapter.InsertCommand.Connection = this.Connection;
             this._adapter.InsertCommand.CommandText = @"INSERT INTO [dbo].[Job] ([JobId], [ParentJobId], [JobState], [ResourceId], [Percentage], [SerializedJob], [DateCreated], [DateCalculated], [Priority], [ProjectId], [UserId], [CoresNeeded], [MemoryNeeded]) VALUES (@JobId, @ParentJobId, @JobState, @ResourceId, @Percentage, @SerializedJob, @DateCreated, @DateCalculated, @Priority, @ProjectId, @UserId, @CoresNeeded, @MemoryNeeded);
-SELECT JobId, ParentJobId, JobState, ResourceId, Percentage, SerializedJob, DateCreated, DateCalculated, Priority, ProjectId, UserId, CoresNeeded, MemoryNeeded FROM Job WHERE (JobId = @JobId) ORDER BY Priority";
+WITH ClientGroups(ClientGroupId) AS (SELECT ClientGroupId FROM ClientGroup_Resource WHERE (ResourceId = @ResourceId) UNION ALL SELECT g.ClientGroupId FROM ClientGroup_Resource AS g INNER JOIN ClientGroups AS gr ON gr.ClientGroupId = g.ResourceId) SELECT JobId, ParentJobId, JobState, ResourceId, Percentage, SerializedJob, DateCreated, DateCalculated, Priority, ProjectId, UserId, CoresNeeded, MemoryNeeded FROM Job WHERE (JobId = @JobId) ORDER BY Priority";
             this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text;
             this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@JobId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "JobId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
@@ -7453,20 +7481,22 @@
                 "[CoresNeeded] = @CoresNeeded, [MemoryNeeded] = @MemoryNeeded WHERE (([JobId] = @" +
                 "Original_JobId) AND ((@IsNull_ParentJobId = 1 AND [ParentJobId] IS NULL) OR ([Pa" +
-                "rentJobId] = @Original_ParentJobId)) AND ((@IsNull_JobState = 1 AND [JobState] I" +
-                "S NULL) OR ([JobState] = @Original_JobState)) AND ((@IsNull_ResourceId = 1 AND [" +
-                "ResourceId] IS NULL) OR ([ResourceId] = @Original_ResourceId)) AND ((@IsNull_Per" +
-                "centage = 1 AND [Percentage] IS NULL) OR ([Percentage] = @Original_Percentage)) " +
-                "AND ((@IsNull_DateCreated = 1 AND [DateCreated] IS NULL) OR ([DateCreated] = @Or" +
-                "iginal_DateCreated)) AND ((@IsNull_DateCalculated = 1 AND [DateCalculated] IS NU" +
-                "LL) OR ([DateCalculated] = @Original_DateCalculated)) AND ((@IsNull_Priority = 1" +
-                " AND [Priority] IS NULL) OR ([Priority] = @Original_Priority)) AND ((@IsNull_Pro" +
-                "jectId = 1 AND [ProjectId] IS NULL) OR ([ProjectId] = @Original_ProjectId)) AND " +
-                "((@IsNull_UserId = 1 AND [UserId] IS NULL) OR ([UserId] = @Original_UserId)) AND" +
-                " ((@IsNull_CoresNeeded = 1 AND [CoresNeeded] IS NULL) OR ([CoresNeeded] = @Origi" +
-                "nal_CoresNeeded)) AND ((@IsNull_MemoryNeeded = 1 AND [MemoryNeeded] IS NULL) OR " +
-                "([MemoryNeeded] = @Original_MemoryNeeded)));\r\nSELECT JobId, ParentJobId, JobStat" +
-                "e, ResourceId, Percentage, SerializedJob, DateCreated, DateCalculated, Priority," +
-                " ProjectId, UserId, CoresNeeded, MemoryNeeded FROM Job WHERE (JobId = @JobId) OR" +
-                "DER BY Priority";
+                "rentJobId] = @Original_ParentJobId)) AND ((@IsNull_ResourceId = 1 AND [ResourceI" +
+                "d] IS NULL) OR ([ResourceId] = @Original_ResourceId)) AND ((@IsNull_Percentage =" +
+                " 1 AND [Percentage] IS NULL) OR ([Percentage] = @Original_Percentage)) AND ((@Is" +
+                "Null_DateCreated = 1 AND [DateCreated] IS NULL) OR ([DateCreated] = @Original_Da" +
+                "teCreated)) AND ((@IsNull_DateCalculated = 1 AND [DateCalculated] IS NULL) OR ([" +
+                "DateCalculated] = @Original_DateCalculated)) AND ((@IsNull_Priority = 1 AND [Pri" +
+                "ority] IS NULL) OR ([Priority] = @Original_Priority)) AND ((@IsNull_ProjectId = " +
+                "1 AND [ProjectId] IS NULL) OR ([ProjectId] = @Original_ProjectId)) AND ((@IsNull" +
+                "_UserId = 1 AND [UserId] IS NULL) OR ([UserId] = @Original_UserId)) AND ((@IsNul" +
+                "l_CoresNeeded = 1 AND [CoresNeeded] IS NULL) OR ([CoresNeeded] = @Original_Cores" +
+                "Needed)) AND ((@IsNull_MemoryNeeded = 1 AND [MemoryNeeded] IS NULL) OR ([MemoryN" +
+                "eeded] = @Original_MemoryNeeded)));\r\nWITH ClientGroups(ClientGroupId) AS (SELECT" +
+                " ClientGroupId FROM ClientGroup_Resource WHERE (ResourceId = @ResourceId) UNION " +
+                "ALL SELECT g.ClientGroupId FROM ClientGroup_Resource AS g INNER JOIN ClientGroup" +
+                "s AS gr ON gr.ClientGroupId = g.ResourceId) SELECT JobId, ParentJobId, JobState," +
+                " ResourceId, Percentage, SerializedJob, DateCreated, DateCalculated, Priority, P" +
+                "rojectId, UserId, CoresNeeded, MemoryNeeded FROM Job WHERE (JobId = @JobId) ORDE" +
+                "R BY Priority";
             this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text;
             this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@JobId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "JobId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
@@ -7486,6 +7516,4 @@
             this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_ParentJobId", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ParentJobId", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
             this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_ParentJobId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ParentJobId", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
-            this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_JobState", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "JobState", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
-            this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_JobState", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "JobState", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
             this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_ResourceId", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ResourceId", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
             this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_ResourceId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ResourceId", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
@@ -7519,10 +7547,41 @@
             this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
             this._commandCollection[0].Connection = this.Connection;
-            this._commandCollection[0].CommandText = "SELECT * FROM dbo.Job WHERE JobState = @State AND CoresNeeded <= @CoresNeeded AND" +
-                " MemoryNeeded <= @MemoryNeeded ORDER BY Priority";
+            this._commandCollection[0].CommandText = @"WITH ClientGroups(ClientGroupId)
+AS
+(
+-- Anchor member definition
+    SELECT ClientGroupId
+    FROM ClientGroup_Resource
+    WHERE ResourceId = @ResourceId
+    UNION ALL
+-- Recursive member definition
+    SELECT g.ClientGroupId
+    FROM ClientGroup_Resource AS g
+    INNER JOIN  ClientGroups AS gr
+        ON gr.ClientGroupId = g.ResourceId
+)
+
+SELECT * FROM dbo.Job WHERE JobState =@State AND CoresNeeded <= @CoresNeeded
+ AND MemoryNeeded <= @MemoryNeeded AND 
+(
+ -- no assigned resources - can be executed everywhere
+ NOT EXISTS (SELECT * FROM AssignedResources 
+ WHERE JobId = Job.JobId)
+ 
+ -- the resource itself is assigned to the job
+ OR  EXISTS ((SELECT * FROM AssignedResources 
+  WHERE JobId = Job.JobId 
+  AND ResourceId = @ResourceId)) 
+  
+  -- a group of the resource is assigned to the job
+ OR  EXISTS ((SELECT * FROM AssignedResources  
+  WHERE JobId = Job.JobId AND
+  ResourceId IN (SELECT * FROM ClientGroups))))
+ORDER BY Priority";
             this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
-            this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@State", global::System.Data.SqlDbType.VarChar, 18, global::System.Data.ParameterDirection.Input, 0, 0, "JobState", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+            this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@State", global::System.Data.SqlDbType.VarChar, 2147483647, global::System.Data.ParameterDirection.Input, 0, 0, "JobState", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
             this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CoresNeeded", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 0, 0, "CoresNeeded", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
             this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@MemoryNeeded", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 0, 0, "MemoryNeeded", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+            this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@ResourceId", global::System.Data.SqlDbType.UniqueIdentifier, 16, global::System.Data.ParameterDirection.Input, 0, 0, "ResourceId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
             this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand();
             this._commandCollection[1].Connection = this.Connection;
@@ -7533,5 +7592,5 @@
             this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand();
             this._commandCollection[2].Connection = this.Connection;
-            this._commandCollection[2].CommandText = @"SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, ParentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId FROM Job WHERE ((JobState = 'calculating')  OR (JobState = 'abort') OR (JobState = 'requestSnapshot ') OR (JobState = 'requestSnapshotSent')) AND (ResourceId = @ResourceId)";
+            this._commandCollection[2].CommandText = @"SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, ParentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId FROM Job WHERE (JobState = 'calculating' OR JobState = 'abort' OR JobState = 'requestSnapshot ' OR JobState = 'requestSnapshotSent') AND (ResourceId = @ResourceId)";
             this._commandCollection[2].CommandType = global::System.Data.CommandType.Text;
             this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@ResourceId", global::System.Data.SqlDbType.UniqueIdentifier, 16, global::System.Data.ParameterDirection.Input, 0, 0, "ResourceId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
@@ -7566,5 +7625,7 @@
             this._commandCollection[7] = new global::System.Data.SqlClient.SqlCommand();
             this._commandCollection[7].Connection = this.Connection;
-            this._commandCollection[7].CommandText = "SELECT * FROM dbo.Job WHERE ProjectId = @ProjectId";
+            this._commandCollection[7].CommandText = "SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, P" +
+                "arentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId F" +
+                "ROM Job WHERE (ProjectId = @ProjectId)";
             this._commandCollection[7].CommandType = global::System.Data.CommandType.Text;
             this._commandCollection[7].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@ProjectId", global::System.Data.SqlDbType.UniqueIdentifier, 16, global::System.Data.ParameterDirection.Input, 0, 0, "ProjectId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
@@ -7588,5 +7649,5 @@
         [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
         [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)]
-        public virtual int FillByStateCoresMemory(dsHiveServer.JobDataTable dataTable, string State, global::System.Nullable<int> CoresNeeded, global::System.Nullable<int> MemoryNeeded) {
+        public virtual int FillByStateCoresMemoryResource(dsHiveServer.JobDataTable dataTable, string State, global::System.Nullable<int> CoresNeeded, global::System.Nullable<int> MemoryNeeded, System.Guid ResourceId) {
             this.Adapter.SelectCommand = this.CommandCollection[0];
             if ((State == null)) {
@@ -7608,4 +7669,5 @@
                 this.Adapter.SelectCommand.Parameters[2].Value = global::System.DBNull.Value;
             }
+            this.Adapter.SelectCommand.Parameters[3].Value = ((System.Guid)(ResourceId));
             if ((this.ClearBeforeFill == true)) {
                 dataTable.Clear();
@@ -7618,5 +7680,5 @@
         [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
         [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)]
-        public virtual dsHiveServer.JobDataTable GetDataByStateCoresMemory(string State, global::System.Nullable<int> CoresNeeded, global::System.Nullable<int> MemoryNeeded) {
+        public virtual dsHiveServer.JobDataTable GetDataByStateCoresMemoryResource(string State, global::System.Nullable<int> CoresNeeded, global::System.Nullable<int> MemoryNeeded, System.Guid ResourceId) {
             this.Adapter.SelectCommand = this.CommandCollection[0];
             if ((State == null)) {
@@ -7638,4 +7700,5 @@
                 this.Adapter.SelectCommand.Parameters[2].Value = global::System.DBNull.Value;
             }
+            this.Adapter.SelectCommand.Parameters[3].Value = ((System.Guid)(ResourceId));
             dsHiveServer.JobDataTable dataTable = new dsHiveServer.JobDataTable();
             this.Adapter.Fill(dataTable);
@@ -7945,5 +8008,5 @@
         [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
         [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)]
-        public virtual int Delete(System.Guid Original_JobId, global::System.Nullable<global::System.Guid> Original_ParentJobId, string Original_JobState, global::System.Nullable<global::System.Guid> Original_ResourceId, global::System.Nullable<double> Original_Percentage, global::System.Nullable<global::System.DateTime> Original_DateCreated, global::System.Nullable<global::System.DateTime> Original_DateCalculated, global::System.Nullable<int> Original_Priority, global::System.Nullable<global::System.Guid> Original_ProjectId, global::System.Nullable<global::System.Guid> Original_UserId, global::System.Nullable<int> Original_CoresNeeded, global::System.Nullable<int> Original_MemoryNeeded) {
+        public virtual int Delete(System.Guid Original_JobId, global::System.Nullable<global::System.Guid> Original_ParentJobId, global::System.Nullable<global::System.Guid> Original_ResourceId, global::System.Nullable<double> Original_Percentage, global::System.Nullable<global::System.DateTime> Original_DateCreated, global::System.Nullable<global::System.DateTime> Original_DateCalculated, global::System.Nullable<int> Original_Priority, global::System.Nullable<global::System.Guid> Original_ProjectId, global::System.Nullable<global::System.Guid> Original_UserId, global::System.Nullable<int> Original_CoresNeeded, global::System.Nullable<int> Original_MemoryNeeded) {
             this.Adapter.DeleteCommand.Parameters[0].Value = ((System.Guid)(Original_JobId));
             if ((Original_ParentJobId.HasValue == true)) {
@@ -7955,15 +8018,15 @@
                 this.Adapter.DeleteCommand.Parameters[2].Value = global::System.DBNull.Value;
             }
-            if ((Original_JobState == null)) {
+            if ((Original_ResourceId.HasValue == true)) {
+                this.Adapter.DeleteCommand.Parameters[3].Value = ((object)(0));
+                this.Adapter.DeleteCommand.Parameters[4].Value = ((System.Guid)(Original_ResourceId.Value));
+            }
+            else {
                 this.Adapter.DeleteCommand.Parameters[3].Value = ((object)(1));
                 this.Adapter.DeleteCommand.Parameters[4].Value = global::System.DBNull.Value;
             }
-            else {
-                this.Adapter.DeleteCommand.Parameters[3].Value = ((object)(0));
-                this.Adapter.DeleteCommand.Parameters[4].Value = ((string)(Original_JobState));
-            }
-            if ((Original_ResourceId.HasValue == true)) {
+            if ((Original_Percentage.HasValue == true)) {
                 this.Adapter.DeleteCommand.Parameters[5].Value = ((object)(0));
-                this.Adapter.DeleteCommand.Parameters[6].Value = ((System.Guid)(Original_ResourceId.Value));
+                this.Adapter.DeleteCommand.Parameters[6].Value = ((double)(Original_Percentage.Value));
             }
             else {
@@ -7971,7 +8034,7 @@
                 this.Adapter.DeleteCommand.Parameters[6].Value = global::System.DBNull.Value;
             }
-            if ((Original_Percentage.HasValue == true)) {
+            if ((Original_DateCreated.HasValue == true)) {
                 this.Adapter.DeleteCommand.Parameters[7].Value = ((object)(0));
-                this.Adapter.DeleteCommand.Parameters[8].Value = ((double)(Original_Percentage.Value));
+                this.Adapter.DeleteCommand.Parameters[8].Value = ((System.DateTime)(Original_DateCreated.Value));
             }
             else {
@@ -7979,7 +8042,7 @@
                 this.Adapter.DeleteCommand.Parameters[8].Value = global::System.DBNull.Value;
             }
-            if ((Original_DateCreated.HasValue == true)) {
+            if ((Original_DateCalculated.HasValue == true)) {
                 this.Adapter.DeleteCommand.Parameters[9].Value = ((object)(0));
-                this.Adapter.DeleteCommand.Parameters[10].Value = ((System.DateTime)(Original_DateCreated.Value));
+                this.Adapter.DeleteCommand.Parameters[10].Value = ((System.DateTime)(Original_DateCalculated.Value));
             }
             else {
@@ -7987,7 +8050,7 @@
                 this.Adapter.DeleteCommand.Parameters[10].Value = global::System.DBNull.Value;
             }
-            if ((Original_DateCalculated.HasValue == true)) {
+            if ((Original_Priority.HasValue == true)) {
                 this.Adapter.DeleteCommand.Parameters[11].Value = ((object)(0));
-                this.Adapter.DeleteCommand.Parameters[12].Value = ((System.DateTime)(Original_DateCalculated.Value));
+                this.Adapter.DeleteCommand.Parameters[12].Value = ((int)(Original_Priority.Value));
             }
             else {
@@ -7995,7 +8058,7 @@
                 this.Adapter.DeleteCommand.Parameters[12].Value = global::System.DBNull.Value;
             }
-            if ((Original_Priority.HasValue == true)) {
+            if ((Original_ProjectId.HasValue == true)) {
                 this.Adapter.DeleteCommand.Parameters[13].Value = ((object)(0));
-                this.Adapter.DeleteCommand.Parameters[14].Value = ((int)(Original_Priority.Value));
+                this.Adapter.DeleteCommand.Parameters[14].Value = ((System.Guid)(Original_ProjectId.Value));
             }
             else {
@@ -8003,7 +8066,7 @@
                 this.Adapter.DeleteCommand.Parameters[14].Value = global::System.DBNull.Value;
             }
-            if ((Original_ProjectId.HasValue == true)) {
+            if ((Original_UserId.HasValue == true)) {
                 this.Adapter.DeleteCommand.Parameters[15].Value = ((object)(0));
-                this.Adapter.DeleteCommand.Parameters[16].Value = ((System.Guid)(Original_ProjectId.Value));
+                this.Adapter.DeleteCommand.Parameters[16].Value = ((System.Guid)(Original_UserId.Value));
             }
             else {
@@ -8011,7 +8074,7 @@
                 this.Adapter.DeleteCommand.Parameters[16].Value = global::System.DBNull.Value;
             }
-            if ((Original_UserId.HasValue == true)) {
+            if ((Original_CoresNeeded.HasValue == true)) {
                 this.Adapter.DeleteCommand.Parameters[17].Value = ((object)(0));
-                this.Adapter.DeleteCommand.Parameters[18].Value = ((System.Guid)(Original_UserId.Value));
+                this.Adapter.DeleteCommand.Parameters[18].Value = ((int)(Original_CoresNeeded.Value));
             }
             else {
@@ -8019,19 +8082,11 @@
                 this.Adapter.DeleteCommand.Parameters[18].Value = global::System.DBNull.Value;
             }
-            if ((Original_CoresNeeded.HasValue == true)) {
+            if ((Original_MemoryNeeded.HasValue == true)) {
                 this.Adapter.DeleteCommand.Parameters[19].Value = ((object)(0));
-                this.Adapter.DeleteCommand.Parameters[20].Value = ((int)(Original_CoresNeeded.Value));
+                this.Adapter.DeleteCommand.Parameters[20].Value = ((int)(Original_MemoryNeeded.Value));
             }
             else {
                 this.Adapter.DeleteCommand.Parameters[19].Value = ((object)(1));
                 this.Adapter.DeleteCommand.Parameters[20].Value = global::System.DBNull.Value;
-            }
-            if ((Original_MemoryNeeded.HasValue == true)) {
-                this.Adapter.DeleteCommand.Parameters[21].Value = ((object)(0));
-                this.Adapter.DeleteCommand.Parameters[22].Value = ((int)(Original_MemoryNeeded.Value));
-            }
-            else {
-                this.Adapter.DeleteCommand.Parameters[21].Value = ((object)(1));
-                this.Adapter.DeleteCommand.Parameters[22].Value = global::System.DBNull.Value;
             }
             global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
@@ -8163,5 +8218,4 @@
                     System.Guid Original_JobId, 
                     global::System.Nullable<global::System.Guid> Original_ParentJobId, 
-                    string Original_JobState, 
                     global::System.Nullable<global::System.Guid> Original_ResourceId, 
                     global::System.Nullable<double> Original_Percentage, 
@@ -8255,15 +8309,15 @@
                 this.Adapter.UpdateCommand.Parameters[15].Value = global::System.DBNull.Value;
             }
-            if ((Original_JobState == null)) {
+            if ((Original_ResourceId.HasValue == true)) {
+                this.Adapter.UpdateCommand.Parameters[16].Value = ((object)(0));
+                this.Adapter.UpdateCommand.Parameters[17].Value = ((System.Guid)(Original_ResourceId.Value));
+            }
+            else {
                 this.Adapter.UpdateCommand.Parameters[16].Value = ((object)(1));
                 this.Adapter.UpdateCommand.Parameters[17].Value = global::System.DBNull.Value;
             }
-            else {
-                this.Adapter.UpdateCommand.Parameters[16].Value = ((object)(0));
-                this.Adapter.UpdateCommand.Parameters[17].Value = ((string)(Original_JobState));
-            }
-            if ((Original_ResourceId.HasValue == true)) {
+            if ((Original_Percentage.HasValue == true)) {
                 this.Adapter.UpdateCommand.Parameters[18].Value = ((object)(0));
-                this.Adapter.UpdateCommand.Parameters[19].Value = ((System.Guid)(Original_ResourceId.Value));
+                this.Adapter.UpdateCommand.Parameters[19].Value = ((double)(Original_Percentage.Value));
             }
             else {
@@ -8271,7 +8325,7 @@
                 this.Adapter.UpdateCommand.Parameters[19].Value = global::System.DBNull.Value;
             }
-            if ((Original_Percentage.HasValue == true)) {
+            if ((Original_DateCreated.HasValue == true)) {
                 this.Adapter.UpdateCommand.Parameters[20].Value = ((object)(0));
-                this.Adapter.UpdateCommand.Parameters[21].Value = ((double)(Original_Percentage.Value));
+                this.Adapter.UpdateCommand.Parameters[21].Value = ((System.DateTime)(Original_DateCreated.Value));
             }
             else {
@@ -8279,7 +8333,7 @@
                 this.Adapter.UpdateCommand.Parameters[21].Value = global::System.DBNull.Value;
             }
-            if ((Original_DateCreated.HasValue == true)) {
+            if ((Original_DateCalculated.HasValue == true)) {
                 this.Adapter.UpdateCommand.Parameters[22].Value = ((object)(0));
-                this.Adapter.UpdateCommand.Parameters[23].Value = ((System.DateTime)(Original_DateCreated.Value));
+                this.Adapter.UpdateCommand.Parameters[23].Value = ((System.DateTime)(Original_DateCalculated.Value));
             }
             else {
@@ -8287,7 +8341,7 @@
                 this.Adapter.UpdateCommand.Parameters[23].Value = global::System.DBNull.Value;
             }
-            if ((Original_DateCalculated.HasValue == true)) {
+            if ((Original_Priority.HasValue == true)) {
                 this.Adapter.UpdateCommand.Parameters[24].Value = ((object)(0));
-                this.Adapter.UpdateCommand.Parameters[25].Value = ((System.DateTime)(Original_DateCalculated.Value));
+                this.Adapter.UpdateCommand.Parameters[25].Value = ((int)(Original_Priority.Value));
             }
             else {
@@ -8295,7 +8349,7 @@
                 this.Adapter.UpdateCommand.Parameters[25].Value = global::System.DBNull.Value;
             }
-            if ((Original_Priority.HasValue == true)) {
+            if ((Original_ProjectId.HasValue == true)) {
                 this.Adapter.UpdateCommand.Parameters[26].Value = ((object)(0));
-                this.Adapter.UpdateCommand.Parameters[27].Value = ((int)(Original_Priority.Value));
+                this.Adapter.UpdateCommand.Parameters[27].Value = ((System.Guid)(Original_ProjectId.Value));
             }
             else {
@@ -8303,7 +8357,7 @@
                 this.Adapter.UpdateCommand.Parameters[27].Value = global::System.DBNull.Value;
             }
-            if ((Original_ProjectId.HasValue == true)) {
+            if ((Original_UserId.HasValue == true)) {
                 this.Adapter.UpdateCommand.Parameters[28].Value = ((object)(0));
-                this.Adapter.UpdateCommand.Parameters[29].Value = ((System.Guid)(Original_ProjectId.Value));
+                this.Adapter.UpdateCommand.Parameters[29].Value = ((System.Guid)(Original_UserId.Value));
             }
             else {
@@ -8311,7 +8365,7 @@
                 this.Adapter.UpdateCommand.Parameters[29].Value = global::System.DBNull.Value;
             }
-            if ((Original_UserId.HasValue == true)) {
+            if ((Original_CoresNeeded.HasValue == true)) {
                 this.Adapter.UpdateCommand.Parameters[30].Value = ((object)(0));
-                this.Adapter.UpdateCommand.Parameters[31].Value = ((System.Guid)(Original_UserId.Value));
+                this.Adapter.UpdateCommand.Parameters[31].Value = ((int)(Original_CoresNeeded.Value));
             }
             else {
@@ -8319,19 +8373,11 @@
                 this.Adapter.UpdateCommand.Parameters[31].Value = global::System.DBNull.Value;
             }
-            if ((Original_CoresNeeded.HasValue == true)) {
+            if ((Original_MemoryNeeded.HasValue == true)) {
                 this.Adapter.UpdateCommand.Parameters[32].Value = ((object)(0));
-                this.Adapter.UpdateCommand.Parameters[33].Value = ((int)(Original_CoresNeeded.Value));
+                this.Adapter.UpdateCommand.Parameters[33].Value = ((int)(Original_MemoryNeeded.Value));
             }
             else {
                 this.Adapter.UpdateCommand.Parameters[32].Value = ((object)(1));
                 this.Adapter.UpdateCommand.Parameters[33].Value = global::System.DBNull.Value;
-            }
-            if ((Original_MemoryNeeded.HasValue == true)) {
-                this.Adapter.UpdateCommand.Parameters[34].Value = ((object)(0));
-                this.Adapter.UpdateCommand.Parameters[35].Value = ((int)(Original_MemoryNeeded.Value));
-            }
-            else {
-                this.Adapter.UpdateCommand.Parameters[34].Value = ((object)(1));
-                this.Adapter.UpdateCommand.Parameters[35].Value = global::System.DBNull.Value;
             }
             global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
@@ -8369,5 +8415,4 @@
                     System.Guid Original_JobId, 
                     global::System.Nullable<global::System.Guid> Original_ParentJobId, 
-                    string Original_JobState, 
                     global::System.Nullable<global::System.Guid> Original_ResourceId, 
                     global::System.Nullable<double> Original_Percentage, 
@@ -8379,5 +8424,5 @@
                     global::System.Nullable<int> Original_CoresNeeded, 
                     global::System.Nullable<int> Original_MemoryNeeded) {
-            return this.Update(Original_JobId, ParentJobId, JobState, ResourceId, Percentage, SerializedJob, DateCreated, DateCalculated, Priority, ProjectId, UserId, CoresNeeded, MemoryNeeded, Original_JobId, Original_ParentJobId, Original_JobState, Original_ResourceId, Original_Percentage, Original_DateCreated, Original_DateCalculated, Original_Priority, Original_ProjectId, Original_UserId, Original_CoresNeeded, Original_MemoryNeeded);
+            return this.Update(Original_JobId, ParentJobId, JobState, ResourceId, Percentage, SerializedJob, DateCreated, DateCalculated, Priority, ProjectId, UserId, CoresNeeded, MemoryNeeded, Original_JobId, Original_ParentJobId, Original_ResourceId, Original_Percentage, Original_DateCreated, Original_DateCalculated, Original_Priority, Original_ProjectId, Original_UserId, Original_CoresNeeded, Original_MemoryNeeded);
         }
     }
@@ -11053,4 +11098,5 @@
                 if (((updatedRows != null) 
                             && (0 < updatedRows.Length))) {
+                    this.SortSelfReferenceRows(updatedRows, dataSet.Relations["R_44"], false);
                     result = (result + this._jobTableAdapter.Update(updatedRows));
                     allChangedRows.AddRange(updatedRows);
@@ -11154,4 +11200,5 @@
                 if (((addedRows != null) 
                             && (0 < addedRows.Length))) {
+                    this.SortSelfReferenceRows(addedRows, dataSet.Relations["R_44"], false);
                     result = (result + this._jobTableAdapter.Update(addedRows));
                     allAddedRows.AddRange(addedRows);
@@ -11235,4 +11282,5 @@
                 if (((deletedRows != null) 
                             && (0 < deletedRows.Length))) {
+                    this.SortSelfReferenceRows(deletedRows, dataSet.Relations["R_44"], true);
                     result = (result + this._jobTableAdapter.Update(deletedRows));
                     allChangedRows.AddRange(deletedRows);
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/dsHiveServer.xsd
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/dsHiveServer.xsd	(revision 2065)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/dsHiveServer.xsd	(revision 2066)
@@ -355,14 +355,12 @@
           <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="JobTableAdapter" GeneratorDataComponentClassName="JobTableAdapter" Name="Job" UserDataComponentName="JobTableAdapter">
             <MainSource>
-              <DbSource ConnectionRef="HiveServerConnectionString (Settings)" DbObjectName="[HeuristicLab.Hive_DBTesting].dbo.Job" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="FillByStateCoresMemory" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetDataByStateCoresMemory" GeneratorSourceName="FillByStateCoresMemory" GetMethodModifier="Public" GetMethodName="GetDataByStateCoresMemory" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataByStateCoresMemory" UserSourceName="FillByStateCoresMemory">
+              <DbSource ConnectionRef="HiveServerConnectionString (Settings)" DbObjectName="[HeuristicLab.Hive_DBTesting].dbo.Job" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="FillByStateCoresMemoryResource" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetDataByStateCoresMemoryResource" GeneratorSourceName="FillByStateCoresMemoryResource" GetMethodModifier="Public" GetMethodName="GetDataByStateCoresMemoryResource" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataByStateCoresMemoryResource" UserSourceName="FillByStateCoresMemoryResource">
                 <DeleteCommand>
                   <DbCommand CommandType="Text" ModifiedByUser="false">
-                    <CommandText>DELETE FROM [dbo].[Job] WHERE (([JobId] = @Original_JobId) AND ((@IsNull_ParentJobId = 1 AND [ParentJobId] IS NULL) OR ([ParentJobId] = @Original_ParentJobId)) AND ((@IsNull_JobState = 1 AND [JobState] IS NULL) OR ([JobState] = @Original_JobState)) AND ((@IsNull_ResourceId = 1 AND [ResourceId] IS NULL) OR ([ResourceId] = @Original_ResourceId)) AND ((@IsNull_Percentage = 1 AND [Percentage] IS NULL) OR ([Percentage] = @Original_Percentage)) AND ((@IsNull_DateCreated = 1 AND [DateCreated] IS NULL) OR ([DateCreated] = @Original_DateCreated)) AND ((@IsNull_DateCalculated = 1 AND [DateCalculated] IS NULL) OR ([DateCalculated] = @Original_DateCalculated)) AND ((@IsNull_Priority = 1 AND [Priority] IS NULL) OR ([Priority] = @Original_Priority)) AND ((@IsNull_ProjectId = 1 AND [ProjectId] IS NULL) OR ([ProjectId] = @Original_ProjectId)) AND ((@IsNull_UserId = 1 AND [UserId] IS NULL) OR ([UserId] = @Original_UserId)) AND ((@IsNull_CoresNeeded = 1 AND [CoresNeeded] IS NULL) OR ([CoresNeeded] = @Original_CoresNeeded)) AND ((@IsNull_MemoryNeeded = 1 AND [MemoryNeeded] IS NULL) OR ([MemoryNeeded] = @Original_MemoryNeeded)))</CommandText>
+                    <CommandText>DELETE FROM [dbo].[Job] WHERE (([JobId] = @Original_JobId) AND ((@IsNull_ParentJobId = 1 AND [ParentJobId] IS NULL) OR ([ParentJobId] = @Original_ParentJobId)) AND ((@IsNull_ResourceId = 1 AND [ResourceId] IS NULL) OR ([ResourceId] = @Original_ResourceId)) AND ((@IsNull_Percentage = 1 AND [Percentage] IS NULL) OR ([Percentage] = @Original_Percentage)) AND ((@IsNull_DateCreated = 1 AND [DateCreated] IS NULL) OR ([DateCreated] = @Original_DateCreated)) AND ((@IsNull_DateCalculated = 1 AND [DateCalculated] IS NULL) OR ([DateCalculated] = @Original_DateCalculated)) AND ((@IsNull_Priority = 1 AND [Priority] IS NULL) OR ([Priority] = @Original_Priority)) AND ((@IsNull_ProjectId = 1 AND [ProjectId] IS NULL) OR ([ProjectId] = @Original_ProjectId)) AND ((@IsNull_UserId = 1 AND [UserId] IS NULL) OR ([UserId] = @Original_UserId)) AND ((@IsNull_CoresNeeded = 1 AND [CoresNeeded] IS NULL) OR ([CoresNeeded] = @Original_CoresNeeded)) AND ((@IsNull_MemoryNeeded = 1 AND [MemoryNeeded] IS NULL) OR ([MemoryNeeded] = @Original_MemoryNeeded)))</CommandText>
                     <Parameters>
                       <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@Original_JobId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="JobId" SourceColumnNullMapping="false" SourceVersion="Original" />
                       <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_ParentJobId" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="ParentJobId" SourceColumnNullMapping="true" SourceVersion="Original" />
                       <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@Original_ParentJobId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="ParentJobId" SourceColumnNullMapping="false" SourceVersion="Original" />
-                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_JobState" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="JobState" SourceColumnNullMapping="true" SourceVersion="Original" />
-                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Original_JobState" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="JobState" SourceColumnNullMapping="false" SourceVersion="Original" />
                       <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_ResourceId" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="ResourceId" SourceColumnNullMapping="true" SourceVersion="Original" />
                       <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@Original_ResourceId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="ResourceId" SourceColumnNullMapping="false" SourceVersion="Original" />
@@ -389,5 +387,5 @@
                   <DbCommand CommandType="Text" ModifiedByUser="false">
                     <CommandText>INSERT INTO [dbo].[Job] ([JobId], [ParentJobId], [JobState], [ResourceId], [Percentage], [SerializedJob], [DateCreated], [DateCalculated], [Priority], [ProjectId], [UserId], [CoresNeeded], [MemoryNeeded]) VALUES (@JobId, @ParentJobId, @JobState, @ResourceId, @Percentage, @SerializedJob, @DateCreated, @DateCalculated, @Priority, @ProjectId, @UserId, @CoresNeeded, @MemoryNeeded);
-SELECT JobId, ParentJobId, JobState, ResourceId, Percentage, SerializedJob, DateCreated, DateCalculated, Priority, ProjectId, UserId, CoresNeeded, MemoryNeeded FROM Job WHERE (JobId = @JobId) ORDER BY Priority</CommandText>
+WITH ClientGroups(ClientGroupId) AS (SELECT ClientGroupId FROM ClientGroup_Resource WHERE (ResourceId = @ResourceId) UNION ALL SELECT g.ClientGroupId FROM ClientGroup_Resource AS g INNER JOIN ClientGroups AS gr ON gr.ClientGroupId = g.ResourceId) SELECT JobId, ParentJobId, JobState, ResourceId, Percentage, SerializedJob, DateCreated, DateCalculated, Priority, ProjectId, UserId, CoresNeeded, MemoryNeeded FROM Job WHERE (JobId = @JobId) ORDER BY Priority</CommandText>
                     <Parameters>
                       <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@JobId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="JobId" SourceColumnNullMapping="false" SourceVersion="Current" />
@@ -409,9 +407,41 @@
                 <SelectCommand>
                   <DbCommand CommandType="Text" ModifiedByUser="true">
-                    <CommandText>SELECT * FROM dbo.Job WHERE JobState = @State AND CoresNeeded &lt;= @CoresNeeded AND MemoryNeeded &lt;= @MemoryNeeded ORDER BY Priority</CommandText>
-                    <Parameters>
-                      <Parameter AllowDbNull="true" AutogeneratedName="State" ColumnName="JobState" DataSourceName="[HeuristicLab.Hive_DBTesting].dbo.Job" DataTypeServer="varchar(18)" DbType="AnsiString" Direction="Input" ParameterName="@State" Precision="0" ProviderType="VarChar" Scale="0" Size="18" SourceColumn="JobState" SourceColumnNullMapping="false" SourceVersion="Current" />
+                    <CommandText>WITH ClientGroups(ClientGroupId)
+AS
+(
+-- Anchor member definition
+    SELECT ClientGroupId
+    FROM ClientGroup_Resource
+    WHERE ResourceId = @ResourceId
+    UNION ALL
+-- Recursive member definition
+    SELECT g.ClientGroupId
+    FROM ClientGroup_Resource AS g
+    INNER JOIN  ClientGroups AS gr
+        ON gr.ClientGroupId = g.ResourceId
+)
+
+SELECT * FROM dbo.Job WHERE JobState =@State AND CoresNeeded &lt;= @CoresNeeded
+ AND MemoryNeeded &lt;= @MemoryNeeded AND 
+(
+ -- no assigned resources - can be executed everywhere
+ NOT EXISTS (SELECT * FROM AssignedResources 
+ WHERE JobId = Job.JobId)
+ 
+ -- the resource itself is assigned to the job
+ OR  EXISTS ((SELECT * FROM AssignedResources 
+  WHERE JobId = Job.JobId 
+  AND ResourceId = @ResourceId)) 
+  
+  -- a group of the resource is assigned to the job
+ OR  EXISTS ((SELECT * FROM AssignedResources  
+  WHERE JobId = Job.JobId AND
+  ResourceId IN (SELECT * FROM ClientGroups))))
+ORDER BY Priority</CommandText>
+                    <Parameters>
+                      <Parameter AllowDbNull="true" AutogeneratedName="State" ColumnName="JobState" DataSourceName="[HeuristicLab.Hive_DBTesting].dbo.Job" DataTypeServer="varchar(MAX)" DbType="AnsiString" Direction="Input" ParameterName="@State" Precision="0" ProviderType="VarChar" Scale="0" Size="2147483647" SourceColumn="JobState" SourceColumnNullMapping="false" SourceVersion="Current" />
                       <Parameter AllowDbNull="true" AutogeneratedName="CoresNeeded" ColumnName="CoresNeeded" DataSourceName="[HeuristicLab.Hive_DBTesting].dbo.Job" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@CoresNeeded" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="CoresNeeded" SourceColumnNullMapping="false" SourceVersion="Current" />
                       <Parameter AllowDbNull="true" AutogeneratedName="MemoryNeeded" ColumnName="MemoryNeeded" DataSourceName="[HeuristicLab.Hive_DBTesting].dbo.Job" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@MemoryNeeded" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="MemoryNeeded" SourceColumnNullMapping="false" SourceVersion="Current" />
+                      <Parameter AllowDbNull="false" AutogeneratedName="ResourceId" ColumnName="ResourceId" DataSourceName="[HeuristicLab.Hive_DBTesting].dbo.Job" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@ResourceId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="ResourceId" SourceColumnNullMapping="false" SourceVersion="Current" />
                     </Parameters>
                   </DbCommand>
@@ -419,6 +449,6 @@
                 <UpdateCommand>
                   <DbCommand CommandType="Text" ModifiedByUser="false">
-                    <CommandText>UPDATE [dbo].[Job] SET [JobId] = @JobId, [ParentJobId] = @ParentJobId, [JobState] = @JobState, [ResourceId] = @ResourceId, [Percentage] = @Percentage, [SerializedJob] = @SerializedJob, [DateCreated] = @DateCreated, [DateCalculated] = @DateCalculated, [Priority] = @Priority, [ProjectId] = @ProjectId, [UserId] = @UserId, [CoresNeeded] = @CoresNeeded, [MemoryNeeded] = @MemoryNeeded WHERE (([JobId] = @Original_JobId) AND ((@IsNull_ParentJobId = 1 AND [ParentJobId] IS NULL) OR ([ParentJobId] = @Original_ParentJobId)) AND ((@IsNull_JobState = 1 AND [JobState] IS NULL) OR ([JobState] = @Original_JobState)) AND ((@IsNull_ResourceId = 1 AND [ResourceId] IS NULL) OR ([ResourceId] = @Original_ResourceId)) AND ((@IsNull_Percentage = 1 AND [Percentage] IS NULL) OR ([Percentage] = @Original_Percentage)) AND ((@IsNull_DateCreated = 1 AND [DateCreated] IS NULL) OR ([DateCreated] = @Original_DateCreated)) AND ((@IsNull_DateCalculated = 1 AND [DateCalculated] IS NULL) OR ([DateCalculated] = @Original_DateCalculated)) AND ((@IsNull_Priority = 1 AND [Priority] IS NULL) OR ([Priority] = @Original_Priority)) AND ((@IsNull_ProjectId = 1 AND [ProjectId] IS NULL) OR ([ProjectId] = @Original_ProjectId)) AND ((@IsNull_UserId = 1 AND [UserId] IS NULL) OR ([UserId] = @Original_UserId)) AND ((@IsNull_CoresNeeded = 1 AND [CoresNeeded] IS NULL) OR ([CoresNeeded] = @Original_CoresNeeded)) AND ((@IsNull_MemoryNeeded = 1 AND [MemoryNeeded] IS NULL) OR ([MemoryNeeded] = @Original_MemoryNeeded)));
-SELECT JobId, ParentJobId, JobState, ResourceId, Percentage, SerializedJob, DateCreated, DateCalculated, Priority, ProjectId, UserId, CoresNeeded, MemoryNeeded FROM Job WHERE (JobId = @JobId) ORDER BY Priority</CommandText>
+                    <CommandText>UPDATE [dbo].[Job] SET [JobId] = @JobId, [ParentJobId] = @ParentJobId, [JobState] = @JobState, [ResourceId] = @ResourceId, [Percentage] = @Percentage, [SerializedJob] = @SerializedJob, [DateCreated] = @DateCreated, [DateCalculated] = @DateCalculated, [Priority] = @Priority, [ProjectId] = @ProjectId, [UserId] = @UserId, [CoresNeeded] = @CoresNeeded, [MemoryNeeded] = @MemoryNeeded WHERE (([JobId] = @Original_JobId) AND ((@IsNull_ParentJobId = 1 AND [ParentJobId] IS NULL) OR ([ParentJobId] = @Original_ParentJobId)) AND ((@IsNull_ResourceId = 1 AND [ResourceId] IS NULL) OR ([ResourceId] = @Original_ResourceId)) AND ((@IsNull_Percentage = 1 AND [Percentage] IS NULL) OR ([Percentage] = @Original_Percentage)) AND ((@IsNull_DateCreated = 1 AND [DateCreated] IS NULL) OR ([DateCreated] = @Original_DateCreated)) AND ((@IsNull_DateCalculated = 1 AND [DateCalculated] IS NULL) OR ([DateCalculated] = @Original_DateCalculated)) AND ((@IsNull_Priority = 1 AND [Priority] IS NULL) OR ([Priority] = @Original_Priority)) AND ((@IsNull_ProjectId = 1 AND [ProjectId] IS NULL) OR ([ProjectId] = @Original_ProjectId)) AND ((@IsNull_UserId = 1 AND [UserId] IS NULL) OR ([UserId] = @Original_UserId)) AND ((@IsNull_CoresNeeded = 1 AND [CoresNeeded] IS NULL) OR ([CoresNeeded] = @Original_CoresNeeded)) AND ((@IsNull_MemoryNeeded = 1 AND [MemoryNeeded] IS NULL) OR ([MemoryNeeded] = @Original_MemoryNeeded)));
+WITH ClientGroups(ClientGroupId) AS (SELECT ClientGroupId FROM ClientGroup_Resource WHERE (ResourceId = @ResourceId) UNION ALL SELECT g.ClientGroupId FROM ClientGroup_Resource AS g INNER JOIN ClientGroups AS gr ON gr.ClientGroupId = g.ResourceId) SELECT JobId, ParentJobId, JobState, ResourceId, Percentage, SerializedJob, DateCreated, DateCalculated, Priority, ProjectId, UserId, CoresNeeded, MemoryNeeded FROM Job WHERE (JobId = @JobId) ORDER BY Priority</CommandText>
                     <Parameters>
                       <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@JobId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="JobId" SourceColumnNullMapping="false" SourceVersion="Current" />
@@ -438,6 +468,4 @@
                       <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_ParentJobId" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="ParentJobId" SourceColumnNullMapping="true" SourceVersion="Original" />
                       <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@Original_ParentJobId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="ParentJobId" SourceColumnNullMapping="false" SourceVersion="Original" />
-                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_JobState" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="JobState" SourceColumnNullMapping="true" SourceVersion="Original" />
-                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Original_JobState" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="JobState" SourceColumnNullMapping="false" SourceVersion="Original" />
                       <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_ResourceId" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="ResourceId" SourceColumnNullMapping="true" SourceVersion="Original" />
                       <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@Original_ResourceId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="ResourceId" SourceColumnNullMapping="false" SourceVersion="Original" />
@@ -490,5 +518,5 @@
                 <SelectCommand>
                   <DbCommand CommandType="Text" ModifiedByUser="true">
-                    <CommandText>SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, ParentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId FROM Job WHERE ((JobState = 'calculating')  OR (JobState = 'abort') OR (JobState = 'requestSnapshot ') OR (JobState = 'requestSnapshotSent')) AND (ResourceId = @ResourceId)</CommandText>
+                    <CommandText>SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, ParentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId FROM Job WHERE (JobState = 'calculating' OR JobState = 'abort' OR JobState = 'requestSnapshot ' OR JobState = 'requestSnapshotSent') AND (ResourceId = @ResourceId)</CommandText>
                     <Parameters>
                       <Parameter AllowDbNull="true" AutogeneratedName="ResourceId" ColumnName="ResourceId" DataSourceName="[HeuristicLab.Hive_DBTesting].dbo.Job" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@ResourceId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="ResourceId" SourceColumnNullMapping="false" SourceVersion="Current" />
@@ -540,5 +568,5 @@
                 <SelectCommand>
                   <DbCommand CommandType="Text" ModifiedByUser="true">
-                    <CommandText>SELECT * FROM dbo.Job WHERE ProjectId = @ProjectId</CommandText>
+                    <CommandText>SELECT CoresNeeded, DateCalculated, DateCreated, JobId, JobState, MemoryNeeded, ParentJobId, Percentage, Priority, ProjectId, ResourceId, SerializedJob, UserId FROM Job WHERE (ProjectId = @ProjectId)</CommandText>
                     <Parameters>
                       <Parameter AllowDbNull="true" AutogeneratedName="ProjectId" ColumnName="ProjectId" DataSourceName="[HeuristicLab.Hive_DBTesting].dbo.Job" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@ProjectId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="ProjectId" SourceColumnNullMapping="false" SourceVersion="Current" />
@@ -1012,9 +1040,9 @@
           <xs:complexType>
             <xs:sequence>
-              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" />
-              <xs:element name="CPUSpeed" msprop:Generator_UserColumnName="CPUSpeed" msprop:Generator_ColumnPropNameInRow="CPUSpeed" msprop:Generator_ColumnVarNameInTable="columnCPUSpeed" msprop:Generator_ColumnPropNameInTable="CPUSpeedColumn" type="xs:int" minOccurs="0" />
-              <xs:element name="Memory" msprop:Generator_UserColumnName="Memory" msprop:Generator_ColumnPropNameInRow="Memory" msprop:Generator_ColumnVarNameInTable="columnMemory" msprop:Generator_ColumnPropNameInTable="MemoryColumn" type="xs:int" minOccurs="0" />
-              <xs:element name="Login" msprop:Generator_UserColumnName="Login" msprop:Generator_ColumnPropNameInRow="Login" msprop:Generator_ColumnVarNameInTable="columnLogin" msprop:Generator_ColumnPropNameInTable="LoginColumn" type="xs:dateTime" minOccurs="0" />
-              <xs:element name="Status" msprop:Generator_UserColumnName="Status" msprop:Generator_ColumnPropNameInRow="Status" msprop:Generator_ColumnVarNameInTable="columnStatus" msprop:Generator_ColumnPropNameInTable="StatusColumn" minOccurs="0">
+              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" />
+              <xs:element name="CPUSpeed" msprop:Generator_UserColumnName="CPUSpeed" msprop:Generator_ColumnVarNameInTable="columnCPUSpeed" msprop:Generator_ColumnPropNameInRow="CPUSpeed" msprop:Generator_ColumnPropNameInTable="CPUSpeedColumn" type="xs:int" minOccurs="0" />
+              <xs:element name="Memory" msprop:Generator_UserColumnName="Memory" msprop:Generator_ColumnVarNameInTable="columnMemory" msprop:Generator_ColumnPropNameInRow="Memory" msprop:Generator_ColumnPropNameInTable="MemoryColumn" type="xs:int" minOccurs="0" />
+              <xs:element name="Login" msprop:Generator_UserColumnName="Login" msprop:Generator_ColumnVarNameInTable="columnLogin" msprop:Generator_ColumnPropNameInRow="Login" msprop:Generator_ColumnPropNameInTable="LoginColumn" type="xs:dateTime" minOccurs="0" />
+              <xs:element name="Status" msprop:Generator_UserColumnName="Status" msprop:Generator_ColumnVarNameInTable="columnStatus" msprop:Generator_ColumnPropNameInRow="Status" msprop:Generator_ColumnPropNameInTable="StatusColumn" minOccurs="0">
                 <xs:simpleType>
                   <xs:restriction base="xs:string">
@@ -1023,8 +1051,8 @@
                 </xs:simpleType>
               </xs:element>
-              <xs:element name="ClientConfigId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ClientConfigId" msprop:Generator_ColumnPropNameInRow="ClientConfigId" msprop:Generator_ColumnVarNameInTable="columnClientConfigId" msprop:Generator_ColumnPropNameInTable="ClientConfigIdColumn" type="xs:string" minOccurs="0" />
-              <xs:element name="NumberOfCores" msprop:Generator_UserColumnName="NumberOfCores" msprop:Generator_ColumnPropNameInRow="NumberOfCores" msprop:Generator_ColumnVarNameInTable="columnNumberOfCores" msprop:Generator_ColumnPropNameInTable="NumberOfCoresColumn" type="xs:int" minOccurs="0" />
-              <xs:element name="NumberOfFreeCores" msprop:Generator_UserColumnName="NumberOfFreeCores" msprop:Generator_ColumnVarNameInTable="columnNumberOfFreeCores" msprop:Generator_ColumnPropNameInRow="NumberOfFreeCores" msprop:Generator_ColumnPropNameInTable="NumberOfFreeCoresColumn" type="xs:int" minOccurs="0" />
-              <xs:element name="FreeMemory" msprop:Generator_UserColumnName="FreeMemory" msprop:Generator_ColumnVarNameInTable="columnFreeMemory" msprop:Generator_ColumnPropNameInRow="FreeMemory" msprop:Generator_ColumnPropNameInTable="FreeMemoryColumn" type="xs:int" minOccurs="0" />
+              <xs:element name="ClientConfigId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ClientConfigId" msprop:Generator_ColumnVarNameInTable="columnClientConfigId" msprop:Generator_ColumnPropNameInRow="ClientConfigId" msprop:Generator_ColumnPropNameInTable="ClientConfigIdColumn" type="xs:string" minOccurs="0" />
+              <xs:element name="NumberOfCores" msprop:Generator_UserColumnName="NumberOfCores" msprop:Generator_ColumnVarNameInTable="columnNumberOfCores" msprop:Generator_ColumnPropNameInRow="NumberOfCores" msprop:Generator_ColumnPropNameInTable="NumberOfCoresColumn" type="xs:int" minOccurs="0" />
+              <xs:element name="NumberOfFreeCores" msprop:Generator_UserColumnName="NumberOfFreeCores" msprop:Generator_ColumnPropNameInRow="NumberOfFreeCores" msprop:Generator_ColumnVarNameInTable="columnNumberOfFreeCores" msprop:Generator_ColumnPropNameInTable="NumberOfFreeCoresColumn" type="xs:int" minOccurs="0" />
+              <xs:element name="FreeMemory" msprop:Generator_UserColumnName="FreeMemory" msprop:Generator_ColumnPropNameInRow="FreeMemory" msprop:Generator_ColumnVarNameInTable="columnFreeMemory" msprop:Generator_ColumnPropNameInTable="FreeMemoryColumn" type="xs:int" minOccurs="0" />
             </xs:sequence>
           </xs:complexType>
@@ -1033,6 +1061,6 @@
           <xs:complexType>
             <xs:sequence>
-              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" />
-              <xs:element name="Name" msprop:Generator_UserColumnName="Name" msprop:Generator_ColumnPropNameInRow="Name" msprop:Generator_ColumnVarNameInTable="columnName" msprop:Generator_ColumnPropNameInTable="NameColumn" minOccurs="0">
+              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" />
+              <xs:element name="Name" msprop:Generator_UserColumnName="Name" msprop:Generator_ColumnVarNameInTable="columnName" msprop:Generator_ColumnPropNameInRow="Name" msprop:Generator_ColumnPropNameInTable="NameColumn" minOccurs="0">
                 <xs:simpleType>
                   <xs:restriction base="xs:string">
@@ -1047,5 +1075,5 @@
           <xs:complexType>
             <xs:sequence>
-              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" />
+              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" />
             </xs:sequence>
           </xs:complexType>
@@ -1054,6 +1082,6 @@
           <xs:complexType>
             <xs:sequence>
-              <xs:element name="ClientGroupId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ClientGroupId" msprop:Generator_ColumnVarNameInTable="columnClientGroupId" msprop:Generator_ColumnPropNameInRow="ClientGroupId" msprop:Generator_ColumnPropNameInTable="ClientGroupIdColumn" type="xs:string" />
-              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" />
+              <xs:element name="ClientGroupId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ClientGroupId" msprop:Generator_ColumnPropNameInRow="ClientGroupId" msprop:Generator_ColumnVarNameInTable="columnClientGroupId" msprop:Generator_ColumnPropNameInTable="ClientGroupIdColumn" type="xs:string" />
+              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" />
             </xs:sequence>
           </xs:complexType>
@@ -1062,7 +1090,7 @@
           <xs:complexType>
             <xs:sequence>
-              <xs:element name="JobId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="JobId" msprop:Generator_ColumnVarNameInTable="columnJobId" msprop:Generator_ColumnPropNameInRow="JobId" msprop:Generator_ColumnPropNameInTable="JobIdColumn" type="xs:string" />
-              <xs:element name="ParentJobId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ParentJobId" msprop:Generator_ColumnVarNameInTable="columnParentJobId" msprop:Generator_ColumnPropNameInRow="ParentJobId" msprop:Generator_ColumnPropNameInTable="ParentJobIdColumn" type="xs:string" minOccurs="0" />
-              <xs:element name="JobState" msprop:Generator_UserColumnName="JobState" msprop:Generator_ColumnVarNameInTable="columnJobState" msprop:Generator_ColumnPropNameInRow="JobState" msprop:Generator_ColumnPropNameInTable="JobStateColumn" minOccurs="0">
+              <xs:element name="JobId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="JobId" msprop:Generator_ColumnPropNameInRow="JobId" msprop:Generator_ColumnVarNameInTable="columnJobId" msprop:Generator_ColumnPropNameInTable="JobIdColumn" type="xs:string" />
+              <xs:element name="ParentJobId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ParentJobId" msprop:Generator_ColumnPropNameInRow="ParentJobId" msprop:Generator_ColumnVarNameInTable="columnParentJobId" msprop:Generator_ColumnPropNameInTable="ParentJobIdColumn" type="xs:string" minOccurs="0" />
+              <xs:element name="JobState" msprop:Generator_UserColumnName="JobState" msprop:Generator_ColumnPropNameInRow="JobState" msprop:Generator_ColumnVarNameInTable="columnJobState" msprop:Generator_ColumnPropNameInTable="JobStateColumn" minOccurs="0">
                 <xs:simpleType>
                   <xs:restriction base="xs:string">
@@ -1071,14 +1099,14 @@
                 </xs:simpleType>
               </xs:element>
-              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" minOccurs="0" />
-              <xs:element name="Percentage" msprop:Generator_UserColumnName="Percentage" msprop:Generator_ColumnVarNameInTable="columnPercentage" msprop:Generator_ColumnPropNameInRow="Percentage" msprop:Generator_ColumnPropNameInTable="PercentageColumn" type="xs:double" minOccurs="0" />
-              <xs:element name="SerializedJob" msprop:Generator_UserColumnName="SerializedJob" msprop:Generator_ColumnVarNameInTable="columnSerializedJob" msprop:Generator_ColumnPropNameInRow="SerializedJob" msprop:Generator_ColumnPropNameInTable="SerializedJobColumn" type="xs:base64Binary" minOccurs="0" />
-              <xs:element name="DateCreated" msprop:Generator_UserColumnName="DateCreated" msprop:Generator_ColumnVarNameInTable="columnDateCreated" msprop:Generator_ColumnPropNameInRow="DateCreated" msprop:Generator_ColumnPropNameInTable="DateCreatedColumn" type="xs:dateTime" minOccurs="0" />
-              <xs:element name="DateCalculated" msprop:Generator_UserColumnName="DateCalculated" msprop:Generator_ColumnVarNameInTable="columnDateCalculated" msprop:Generator_ColumnPropNameInRow="DateCalculated" msprop:Generator_ColumnPropNameInTable="DateCalculatedColumn" type="xs:dateTime" minOccurs="0" />
-              <xs:element name="Priority" msprop:Generator_UserColumnName="Priority" msprop:Generator_ColumnVarNameInTable="columnPriority" msprop:Generator_ColumnPropNameInRow="Priority" msprop:Generator_ColumnPropNameInTable="PriorityColumn" type="xs:int" minOccurs="0" />
-              <xs:element name="ProjectId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ProjectId" msprop:Generator_ColumnVarNameInTable="columnProjectId" msprop:Generator_ColumnPropNameInRow="ProjectId" msprop:Generator_ColumnPropNameInTable="ProjectIdColumn" type="xs:string" minOccurs="0" />
-              <xs:element name="UserId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="UserId" msprop:Generator_ColumnVarNameInTable="columnUserId" msprop:Generator_ColumnPropNameInRow="UserId" msprop:Generator_ColumnPropNameInTable="UserIdColumn" type="xs:string" minOccurs="0" />
-              <xs:element name="CoresNeeded" msprop:Generator_UserColumnName="CoresNeeded" msprop:Generator_ColumnVarNameInTable="columnCoresNeeded" msprop:Generator_ColumnPropNameInRow="CoresNeeded" msprop:Generator_ColumnPropNameInTable="CoresNeededColumn" type="xs:int" minOccurs="0" />
-              <xs:element name="MemoryNeeded" msprop:Generator_UserColumnName="MemoryNeeded" msprop:Generator_ColumnVarNameInTable="columnMemoryNeeded" msprop:Generator_ColumnPropNameInRow="MemoryNeeded" msprop:Generator_ColumnPropNameInTable="MemoryNeededColumn" type="xs:int" minOccurs="0" />
+              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" minOccurs="0" />
+              <xs:element name="Percentage" msprop:Generator_UserColumnName="Percentage" msprop:Generator_ColumnPropNameInRow="Percentage" msprop:Generator_ColumnVarNameInTable="columnPercentage" msprop:Generator_ColumnPropNameInTable="PercentageColumn" type="xs:double" minOccurs="0" />
+              <xs:element name="SerializedJob" msprop:Generator_UserColumnName="SerializedJob" msprop:Generator_ColumnPropNameInRow="SerializedJob" msprop:Generator_ColumnVarNameInTable="columnSerializedJob" msprop:Generator_ColumnPropNameInTable="SerializedJobColumn" type="xs:base64Binary" minOccurs="0" />
+              <xs:element name="DateCreated" msprop:Generator_UserColumnName="DateCreated" msprop:Generator_ColumnPropNameInRow="DateCreated" msprop:Generator_ColumnVarNameInTable="columnDateCreated" msprop:Generator_ColumnPropNameInTable="DateCreatedColumn" type="xs:dateTime" minOccurs="0" />
+              <xs:element name="DateCalculated" msprop:Generator_UserColumnName="DateCalculated" msprop:Generator_ColumnPropNameInRow="DateCalculated" msprop:Generator_ColumnVarNameInTable="columnDateCalculated" msprop:Generator_ColumnPropNameInTable="DateCalculatedColumn" type="xs:dateTime" minOccurs="0" />
+              <xs:element name="Priority" msprop:Generator_UserColumnName="Priority" msprop:Generator_ColumnPropNameInRow="Priority" msprop:Generator_ColumnVarNameInTable="columnPriority" msprop:Generator_ColumnPropNameInTable="PriorityColumn" type="xs:int" minOccurs="0" />
+              <xs:element name="ProjectId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ProjectId" msprop:Generator_ColumnPropNameInRow="ProjectId" msprop:Generator_ColumnVarNameInTable="columnProjectId" msprop:Generator_ColumnPropNameInTable="ProjectIdColumn" type="xs:string" minOccurs="0" />
+              <xs:element name="UserId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="UserId" msprop:Generator_ColumnPropNameInRow="UserId" msprop:Generator_ColumnVarNameInTable="columnUserId" msprop:Generator_ColumnPropNameInTable="UserIdColumn" type="xs:string" minOccurs="0" />
+              <xs:element name="CoresNeeded" msprop:Generator_UserColumnName="CoresNeeded" msprop:Generator_ColumnPropNameInRow="CoresNeeded" msprop:Generator_ColumnVarNameInTable="columnCoresNeeded" msprop:Generator_ColumnPropNameInTable="CoresNeededColumn" type="xs:int" minOccurs="0" />
+              <xs:element name="MemoryNeeded" msprop:Generator_UserColumnName="MemoryNeeded" msprop:Generator_ColumnPropNameInRow="MemoryNeeded" msprop:Generator_ColumnVarNameInTable="columnMemoryNeeded" msprop:Generator_ColumnPropNameInTable="MemoryNeededColumn" type="xs:int" minOccurs="0" />
             </xs:sequence>
           </xs:complexType>
@@ -1087,8 +1115,8 @@
           <xs:complexType>
             <xs:sequence>
-              <xs:element name="JobResultId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="JobResultId" msprop:Generator_ColumnVarNameInTable="columnJobResultId" msprop:Generator_ColumnPropNameInRow="JobResultId" msprop:Generator_ColumnPropNameInTable="JobResultIdColumn" type="xs:string" />
-              <xs:element name="JobId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="JobId" msprop:Generator_ColumnVarNameInTable="columnJobId" msprop:Generator_ColumnPropNameInRow="JobId" msprop:Generator_ColumnPropNameInTable="JobIdColumn" type="xs:string" minOccurs="0" />
-              <xs:element name="JobResult" msprop:Generator_UserColumnName="JobResult" msprop:Generator_ColumnVarNameInTable="columnJobResult" msprop:Generator_ColumnPropNameInRow="JobResult" msprop:Generator_ColumnPropNameInTable="JobResultColumn" type="xs:base64Binary" minOccurs="0" />
-              <xs:element name="Message" msprop:Generator_UserColumnName="Message" msprop:Generator_ColumnVarNameInTable="columnMessage" msprop:Generator_ColumnPropNameInRow="Message" msprop:Generator_ColumnPropNameInTable="MessageColumn" minOccurs="0">
+              <xs:element name="JobResultId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="JobResultId" msprop:Generator_ColumnPropNameInRow="JobResultId" msprop:Generator_ColumnVarNameInTable="columnJobResultId" msprop:Generator_ColumnPropNameInTable="JobResultIdColumn" type="xs:string" />
+              <xs:element name="JobId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="JobId" msprop:Generator_ColumnPropNameInRow="JobId" msprop:Generator_ColumnVarNameInTable="columnJobId" msprop:Generator_ColumnPropNameInTable="JobIdColumn" type="xs:string" minOccurs="0" />
+              <xs:element name="JobResult" msprop:Generator_UserColumnName="JobResult" msprop:Generator_ColumnPropNameInRow="JobResult" msprop:Generator_ColumnVarNameInTable="columnJobResult" msprop:Generator_ColumnPropNameInTable="JobResultColumn" type="xs:base64Binary" minOccurs="0" />
+              <xs:element name="Message" msprop:Generator_UserColumnName="Message" msprop:Generator_ColumnPropNameInRow="Message" msprop:Generator_ColumnVarNameInTable="columnMessage" msprop:Generator_ColumnPropNameInTable="MessageColumn" minOccurs="0">
                 <xs:simpleType>
                   <xs:restriction base="xs:string">
@@ -1097,7 +1125,7 @@
                 </xs:simpleType>
               </xs:element>
-              <xs:element name="Percentage" msprop:Generator_UserColumnName="Percentage" msprop:Generator_ColumnVarNameInTable="columnPercentage" msprop:Generator_ColumnPropNameInRow="Percentage" msprop:Generator_ColumnPropNameInTable="PercentageColumn" type="xs:double" minOccurs="0" />
-              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" minOccurs="0" />
-              <xs:element name="DateFinished" msprop:Generator_UserColumnName="DateFinished" msprop:Generator_ColumnVarNameInTable="columnDateFinished" msprop:Generator_ColumnPropNameInRow="DateFinished" msprop:Generator_ColumnPropNameInTable="DateFinishedColumn" type="xs:dateTime" minOccurs="0" />
+              <xs:element name="Percentage" msprop:Generator_UserColumnName="Percentage" msprop:Generator_ColumnPropNameInRow="Percentage" msprop:Generator_ColumnVarNameInTable="columnPercentage" msprop:Generator_ColumnPropNameInTable="PercentageColumn" type="xs:double" minOccurs="0" />
+              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" minOccurs="0" />
+              <xs:element name="DateFinished" msprop:Generator_UserColumnName="DateFinished" msprop:Generator_ColumnPropNameInRow="DateFinished" msprop:Generator_ColumnVarNameInTable="columnDateFinished" msprop:Generator_ColumnPropNameInTable="DateFinishedColumn" type="xs:dateTime" minOccurs="0" />
             </xs:sequence>
           </xs:complexType>
@@ -1106,6 +1134,6 @@
           <xs:complexType>
             <xs:sequence>
-              <xs:element name="JobId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="JobId" msprop:Generator_ColumnVarNameInTable="columnJobId" msprop:Generator_ColumnPropNameInRow="JobId" msprop:Generator_ColumnPropNameInTable="JobIdColumn" type="xs:string" />
-              <xs:element name="PluginId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="PluginId" msprop:Generator_ColumnVarNameInTable="columnPluginId" msprop:Generator_ColumnPropNameInRow="PluginId" msprop:Generator_ColumnPropNameInTable="PluginIdColumn" type="xs:string" />
+              <xs:element name="JobId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="JobId" msprop:Generator_ColumnPropNameInRow="JobId" msprop:Generator_ColumnVarNameInTable="columnJobId" msprop:Generator_ColumnPropNameInTable="JobIdColumn" type="xs:string" />
+              <xs:element name="PluginId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="PluginId" msprop:Generator_ColumnPropNameInRow="PluginId" msprop:Generator_ColumnVarNameInTable="columnPluginId" msprop:Generator_ColumnPropNameInTable="PluginIdColumn" type="xs:string" />
             </xs:sequence>
           </xs:complexType>
@@ -1114,6 +1142,6 @@
           <xs:complexType>
             <xs:sequence>
-              <xs:element name="PluginId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="PluginId" msprop:Generator_ColumnPropNameInRow="PluginId" msprop:Generator_ColumnVarNameInTable="columnPluginId" msprop:Generator_ColumnPropNameInTable="PluginIdColumn" type="xs:string" />
-              <xs:element name="Name" msprop:Generator_UserColumnName="Name" msprop:Generator_ColumnPropNameInRow="Name" msprop:Generator_ColumnVarNameInTable="columnName" msprop:Generator_ColumnPropNameInTable="NameColumn" minOccurs="0">
+              <xs:element name="PluginId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="PluginId" msprop:Generator_ColumnVarNameInTable="columnPluginId" msprop:Generator_ColumnPropNameInRow="PluginId" msprop:Generator_ColumnPropNameInTable="PluginIdColumn" type="xs:string" />
+              <xs:element name="Name" msprop:Generator_UserColumnName="Name" msprop:Generator_ColumnVarNameInTable="columnName" msprop:Generator_ColumnPropNameInRow="Name" msprop:Generator_ColumnPropNameInTable="NameColumn" minOccurs="0">
                 <xs:simpleType>
                   <xs:restriction base="xs:string">
@@ -1122,5 +1150,5 @@
                 </xs:simpleType>
               </xs:element>
-              <xs:element name="Version" msprop:Generator_UserColumnName="Version" msprop:Generator_ColumnPropNameInRow="Version" msprop:Generator_ColumnVarNameInTable="columnVersion" msprop:Generator_ColumnPropNameInTable="VersionColumn" minOccurs="0">
+              <xs:element name="Version" msprop:Generator_UserColumnName="Version" msprop:Generator_ColumnVarNameInTable="columnVersion" msprop:Generator_ColumnPropNameInRow="Version" msprop:Generator_ColumnPropNameInTable="VersionColumn" minOccurs="0">
                 <xs:simpleType>
                   <xs:restriction base="xs:string">
@@ -1129,5 +1157,5 @@
                 </xs:simpleType>
               </xs:element>
-              <xs:element name="BuildDate" msprop:Generator_UserColumnName="BuildDate" msprop:Generator_ColumnPropNameInRow="BuildDate" msprop:Generator_ColumnVarNameInTable="columnBuildDate" msprop:Generator_ColumnPropNameInTable="BuildDateColumn" type="xs:dateTime" minOccurs="0" />
+              <xs:element name="BuildDate" msprop:Generator_UserColumnName="BuildDate" msprop:Generator_ColumnVarNameInTable="columnBuildDate" msprop:Generator_ColumnPropNameInRow="BuildDate" msprop:Generator_ColumnPropNameInTable="BuildDateColumn" type="xs:dateTime" minOccurs="0" />
             </xs:sequence>
           </xs:complexType>
@@ -1136,6 +1164,6 @@
           <xs:complexType>
             <xs:sequence>
-              <xs:element name="ProjectId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ProjectId" msprop:Generator_ColumnVarNameInTable="columnProjectId" msprop:Generator_ColumnPropNameInRow="ProjectId" msprop:Generator_ColumnPropNameInTable="ProjectIdColumn" type="xs:string" />
-              <xs:element name="Name" msprop:Generator_UserColumnName="Name" msprop:Generator_ColumnVarNameInTable="columnName" msprop:Generator_ColumnPropNameInRow="Name" msprop:Generator_ColumnPropNameInTable="NameColumn" minOccurs="0">
+              <xs:element name="ProjectId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ProjectId" msprop:Generator_ColumnPropNameInRow="ProjectId" msprop:Generator_ColumnVarNameInTable="columnProjectId" msprop:Generator_ColumnPropNameInTable="ProjectIdColumn" type="xs:string" />
+              <xs:element name="Name" msprop:Generator_UserColumnName="Name" msprop:Generator_ColumnPropNameInRow="Name" msprop:Generator_ColumnVarNameInTable="columnName" msprop:Generator_ColumnPropNameInTable="NameColumn" minOccurs="0">
                 <xs:simpleType>
                   <xs:restriction base="xs:string">
@@ -1150,6 +1178,6 @@
           <xs:complexType>
             <xs:sequence>
-              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" />
-              <xs:element name="JobId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="JobId" msprop:Generator_ColumnPropNameInRow="JobId" msprop:Generator_ColumnVarNameInTable="columnJobId" msprop:Generator_ColumnPropNameInTable="JobIdColumn" type="xs:string" />
+              <xs:element name="ResourceId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ResourceId" msprop:Generator_ColumnVarNameInTable="columnResourceId" msprop:Generator_ColumnPropNameInRow="ResourceId" msprop:Generator_ColumnPropNameInTable="ResourceIdColumn" type="xs:string" />
+              <xs:element name="JobId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="JobId" msprop:Generator_ColumnVarNameInTable="columnJobId" msprop:Generator_ColumnPropNameInRow="JobId" msprop:Generator_ColumnPropNameInTable="JobIdColumn" type="xs:string" />
             </xs:sequence>
           </xs:complexType>
@@ -1158,6 +1186,6 @@
           <xs:complexType>
             <xs:sequence>
-              <xs:element name="ClientConfigId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ClientConfigId" msprop:Generator_ColumnVarNameInTable="columnClientConfigId" msprop:Generator_ColumnPropNameInRow="ClientConfigId" msprop:Generator_ColumnPropNameInTable="ClientConfigIdColumn" type="xs:string" />
-              <xs:element name="UpDownTimeCalendar" msprop:Generator_UserColumnName="UpDownTimeCalendar" msprop:Generator_ColumnVarNameInTable="columnUpDownTimeCalendar" msprop:Generator_ColumnPropNameInRow="UpDownTimeCalendar" msprop:Generator_ColumnPropNameInTable="UpDownTimeCalendarColumn" minOccurs="0">
+              <xs:element name="ClientConfigId" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msprop:Generator_UserColumnName="ClientConfigId" msprop:Generator_ColumnPropNameInRow="ClientConfigId" msprop:Generator_ColumnVarNameInTable="columnClientConfigId" msprop:Generator_ColumnPropNameInTable="ClientConfigIdColumn" type="xs:string" />
+              <xs:element name="UpDownTimeCalendar" msprop:Generator_UserColumnName="UpDownTimeCalendar" msprop:Generator_ColumnPropNameInRow="UpDownTimeCalendar" msprop:Generator_ColumnVarNameInTable="columnUpDownTimeCalendar" msprop:Generator_ColumnPropNameInTable="UpDownTimeCalendarColumn" minOccurs="0">
                 <xs:simpleType>
                   <xs:restriction base="xs:string">
@@ -1166,5 +1194,5 @@
                 </xs:simpleType>
               </xs:element>
-              <xs:element name="HeartBeatIntervall" msprop:Generator_UserColumnName="HeartBeatIntervall" msprop:Generator_ColumnVarNameInTable="columnHeartBeatIntervall" msprop:Generator_ColumnPropNameInRow="HeartBeatIntervall" msprop:Generator_ColumnPropNameInTable="HeartBeatIntervallColumn" type="xs:int" minOccurs="0" />
+              <xs:element name="HeartBeatIntervall" msprop:Generator_UserColumnName="HeartBeatIntervall" msprop:Generator_ColumnPropNameInRow="HeartBeatIntervall" msprop:Generator_ColumnVarNameInTable="columnHeartBeatIntervall" msprop:Generator_ColumnPropNameInTable="HeartBeatIntervallColumn" type="xs:int" minOccurs="0" />
             </xs:sequence>
           </xs:complexType>
@@ -1236,4 +1264,5 @@
       <msdata:Relationship name="R_56" msdata:parent="Job" msdata:child="AssignedResources" msdata:parentkey="JobId" msdata:childkey="JobId" msprop:Generator_UserRelationName="R_56" msprop:Generator_RelationVarName="relationR_56" msprop:Generator_UserChildTable="AssignedResources" msprop:Generator_UserParentTable="Job" msprop:Generator_ParentPropName="JobRow" msprop:Generator_ChildPropName="GetAssignedResourcesRows" />
       <msdata:Relationship name="R_37" msdata:parent="ClientConfig" msdata:child="Client" msdata:parentkey="ClientConfigId" msdata:childkey="ClientConfigId" msprop:Generator_UserRelationName="R_37" msprop:Generator_RelationVarName="relationR_37" msprop:Generator_UserChildTable="Client" msprop:Generator_UserParentTable="ClientConfig" msprop:Generator_ParentPropName="ClientConfigRow" msprop:Generator_ChildPropName="GetClientRows" />
+      <msdata:Relationship name="R_44" msdata:parent="Job" msdata:child="Job" msdata:parentkey="JobId" msdata:childkey="ParentJobId" msprop:Generator_UserRelationName="R_44" msprop:Generator_RelationVarName="relationR_44" msprop:Generator_UserChildTable="Job" msprop:Generator_UserParentTable="Job" msprop:Generator_ParentPropName="JobRowParent" msprop:Generator_ChildPropName="GetJobRows" />
     </xs:appinfo>
   </xs:annotation>
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/dsHiveServer.xss
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/dsHiveServer.xss	(revision 2065)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/dsHiveServer.xss	(revision 2066)
@@ -5,20 +5,20 @@
      the code is regenerated.
 </autogenerated>-->
-<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="-699" ViewPortY="352" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
+<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="-600" ViewPortY="367" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
   <Shapes>
-    <Shape ID="DesignTable:Client" ZOrder="23" X="-36" Y="593" Height="275" Width="229" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="177" />
-    <Shape ID="DesignTable:Resource" ZOrder="18" X="215" Y="348" Height="156" Width="210" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="22" SplitterPosition="58" />
-    <Shape ID="DesignTable:ClientGroup" ZOrder="17" X="346" Y="589" Height="123" Width="298" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="42" />
-    <Shape ID="DesignTable:ClientGroup_Resource" ZOrder="22" X="197" Y="766" Height="156" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" />
+    <Shape ID="DesignTable:Client" ZOrder="24" X="-36" Y="593" Height="275" Width="229" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="177" />
+    <Shape ID="DesignTable:Resource" ZOrder="19" X="215" Y="348" Height="156" Width="210" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="22" SplitterPosition="58" />
+    <Shape ID="DesignTable:ClientGroup" ZOrder="18" X="346" Y="589" Height="123" Width="298" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="42" />
+    <Shape ID="DesignTable:ClientGroup_Resource" ZOrder="23" X="197" Y="766" Height="156" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" />
     <Shape ID="DesignTable:Job" ZOrder="1" X="-466" Y="444" Height="343" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="22" OldDataTableHeight="0" SplitterPosition="228" />
-    <Shape ID="DesignTable:JobResult" ZOrder="21" X="108" Y="76" Height="224" Width="197" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="143" />
-    <Shape ID="DesignTable:RequiredPlugins" ZOrder="7" X="-699" Y="259" Height="122" Width="243" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" />
-    <Shape ID="DesignTable:PluginInfo" ZOrder="15" X="-454" Y="797" Height="190" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="22" OldDataTableHeight="0" SplitterPosition="92" />
-    <Shape ID="DesignTable:Project" ZOrder="2" X="-100" Y="418" Height="122" Width="182" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" />
-    <Shape ID="DesignTable:AssignedResources" ZOrder="10" X="-522" Y="9" Height="105" Width="251" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" />
-    <Shape ID="DesignTable:ClientConfig" ZOrder="4" X="-5" Y="947" Height="139" Width="211" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="75" />
+    <Shape ID="DesignTable:JobResult" ZOrder="22" X="108" Y="76" Height="224" Width="197" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="143" />
+    <Shape ID="DesignTable:RequiredPlugins" ZOrder="8" X="-699" Y="259" Height="122" Width="243" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" />
+    <Shape ID="DesignTable:PluginInfo" ZOrder="16" X="-454" Y="797" Height="190" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="22" OldDataTableHeight="0" SplitterPosition="92" />
+    <Shape ID="DesignTable:Project" ZOrder="3" X="-100" Y="418" Height="122" Width="182" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" />
+    <Shape ID="DesignTable:AssignedResources" ZOrder="11" X="-522" Y="9" Height="105" Width="251" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" />
+    <Shape ID="DesignTable:ClientConfig" ZOrder="5" X="-5" Y="947" Height="139" Width="211" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="75" />
   </Shapes>
   <Connectors>
-    <Connector ID="DesignRelation:Client_is_a_Resource" ZOrder="25" LineWidth="11">
+    <Connector ID="DesignRelation:Client_is_a_Resource" ZOrder="26" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -36,5 +36,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:ClientGroup_is_a_Resource" ZOrder="24" LineWidth="11">
+    <Connector ID="DesignRelation:ClientGroup_is_a_Resource" ZOrder="25" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -48,5 +48,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:R_21" ZOrder="20" LineWidth="11">
+    <Connector ID="DesignRelation:R_21" ZOrder="21" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -64,5 +64,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:R_14" ZOrder="5" LineWidth="11">
+    <Connector ID="DesignRelation:R_14" ZOrder="6" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -80,5 +80,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:R_51" ZOrder="6" LineWidth="11">
+    <Connector ID="DesignRelation:R_51" ZOrder="7" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -92,5 +92,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:R_54" ZOrder="19" LineWidth="11">
+    <Connector ID="DesignRelation:R_54" ZOrder="20" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -108,5 +108,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:R_52" ZOrder="16" LineWidth="11">
+    <Connector ID="DesignRelation:R_52" ZOrder="17" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -120,5 +120,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:R_59" ZOrder="14" LineWidth="11">
+    <Connector ID="DesignRelation:R_59" ZOrder="15" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -132,5 +132,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:R_47" ZOrder="13" LineWidth="11">
+    <Connector ID="DesignRelation:R_47" ZOrder="14" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -144,5 +144,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:R_521" ZOrder="12" LineWidth="11">
+    <Connector ID="DesignRelation:R_521" ZOrder="13" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -156,5 +156,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:R_49" ZOrder="11" LineWidth="11">
+    <Connector ID="DesignRelation:R_49" ZOrder="12" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -172,5 +172,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:R_55" ZOrder="8" LineWidth="11">
+    <Connector ID="DesignRelation:R_55" ZOrder="9" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -188,5 +188,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:R_56" ZOrder="9" LineWidth="11">
+    <Connector ID="DesignRelation:R_56" ZOrder="10" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -200,5 +200,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:R_37" ZOrder="3" LineWidth="11">
+    <Connector ID="DesignRelation:R_37" ZOrder="4" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -212,4 +212,28 @@
       </RoutePoints>
     </Connector>
+    <Connector ID="DesignRelation:R_44" ZOrder="2" LineWidth="11">
+      <RoutePoints>
+        <Point>
+          <X>-466</X>
+          <Y>461</Y>
+        </Point>
+        <Point>
+          <X>-496</X>
+          <Y>461</Y>
+        </Point>
+        <Point>
+          <X>-496</X>
+          <Y>414</Y>
+        </Point>
+        <Point>
+          <X>-449</X>
+          <Y>414</Y>
+        </Point>
+        <Point>
+          <X>-449</X>
+          <Y>444</Y>
+        </Point>
+      </RoutePoints>
+    </Connector>
   </Connectors>
 </DiagramLayout>
Index: /trunk/sources/HeuristicLab.Hive.Server.DataAccess/3.2/IJobAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.DataAccess/3.2/IJobAdapter.cs	(revision 2065)
+++ /trunk/sources/HeuristicLab.Hive.Server.DataAccess/3.2/IJobAdapter.cs	(revision 2066)
@@ -46,6 +46,10 @@
     /// <param name="cores">all jobs which require less or equal cores</param>
     /// <param name="memory">all jobs which require less or equal memory</param>
+    /// <param name="resourceId">all jobs that can be calculated by that resource</param>
     /// <returns></returns>
-    ICollection<Job> FindJobs(State state, int cores, int memory);
+    ICollection<Job> FindJobs(State state, 
+      int cores, 
+      int memory, 
+      Guid resourceId);
 
     /// <summary>
Index: /trunk/sources/HeuristicLab.Hive.Server.Scheduler/3.2/DefaultScheduler.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.Scheduler/3.2/DefaultScheduler.cs	(revision 2065)
+++ /trunk/sources/HeuristicLab.Hive.Server.Scheduler/3.2/DefaultScheduler.cs	(revision 2066)
@@ -30,5 +30,9 @@
           session.GetDataAdapter<Job, IJobAdapter>();
 
-        List<Job> allOfflineJobsForClient = new List<Job>(jobAdapter.FindJobs(State.offline, hbData.FreeCores, hbData.FreeMemory));
+        List<Job> allOfflineJobsForClient = new List<Job>(
+          jobAdapter.FindJobs(State.offline, 
+          hbData.FreeCores,
+          hbData.FreeMemory, 
+          hbData.ClientId));
         return (allOfflineJobsForClient != null && allOfflineJobsForClient.Count > 0);
       }
@@ -53,5 +57,9 @@
 
         ClientInfo client = clientAdapter.GetById(clientId);
-        LinkedList<Job> allOfflineJobsForClient = new LinkedList<Job>(jobAdapter.FindJobs(State.offline, client.NrOfFreeCores, client.FreeMemory ));
+        LinkedList<Job> allOfflineJobsForClient = new LinkedList<Job>(
+          jobAdapter.FindJobs(State.offline, 
+          client.NrOfFreeCores, 
+          client.FreeMemory, 
+          client.Id));
 
         Job jobToCalculate = null;
