CREATE TABLE job_results (
	job_result_id int NOT NULL ,
	job_id int NOT NULL ,
        big_string_id int NOT NULL ,
	result_code int NOT NULL,
	execution_time TIMESTAMP NOT NULL ,
	CONSTRAINT PK_job_results PRIMARY KEY
	(
		job_result_id
	),
	CONSTRAINT FK_job_results_to_jobs FOREIGN KEY
	(
		job_id
	) REFERENCES jobs (
		job_id
	),
	CONSTRAINT FK_job_results_to_bstr FOREIGN KEY
	(
		big_string_id
	) REFERENCES big_strings (
		big_string_id
	),
	CONSTRAINT FK_jobresults_to_objects FOREIGN KEY
	(
		job_result_id
	) REFERENCES objects (
		id
	)
)
GO


INSERT INTO classes (type, db_name, table_name, java_class)
	VALUES(55, null, 'job_results', 'org.bodington.server.JobResult')
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(55, 1, 'job_result_id', 'setJobResultId', 'getJobResultId', 'org.bodington.database.PrimaryKey', 'org.bodington.database.PrimaryKey', 1, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(55, 2, 'job_id', 'setJobId', 'getJobId', 'org.bodington.database.PrimaryKey', 'org.bodington.database.PrimaryKey', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(55, 2, 'big_string_id', 'setBigStringId', 'getBigStringId', 'org.bodington.database.PrimaryKey', 'org.bodington.database.PrimaryKey', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(55, 3, 'result_code', 'setResultCode', 'getResultCode', 'int', 'int', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(55, 4, 'execution_time', 'setExecutionTime', 'getExecutionTime', 'java.sql.Timestamp', 'java.sql.Timestamp', 0, null, null, null )
GO

