CREATE TABLE classes (
	type int NOT NULL ,
	super_type int ,
	db_name varchar (255)  ,
	table_name varchar (255)  ,
	java_class varchar (255)  ,
	archive varchar (255) ,
	CONSTRAINT PK_classes PRIMARY KEY  
	(
		type
	)
)
GO


CREATE TABLE fields (
	type int NOT NULL ,
	sequence int NOT NULL,
	field varchar (255) NOT NULL ,
	set_method_name varchar (255)  ,
	get_method_name varchar (255)  ,
	set_java_class varchar (255)  ,
	get_java_class varchar (255)  ,
	flags int  ,
	foreign_type int  ,
	set_method_name_foreign varchar (255)  ,
	get_method_name_foreign varchar (255)  ,

	CONSTRAINT PK_fields PRIMARY KEY  
	(
		type,
		field
	),
	CONSTRAINT FK_fields_to_classes FOREIGN KEY
	(
		type
	) REFERENCES classes (
		type
	)
)
GO

CREATE TABLE objects (
	id int NOT NULL ,
	type int NOT NULL ,
	CONSTRAINT PK_objects PRIMARY KEY  
	(
		id
	),
	CONSTRAINT FK_objects_to_classes FOREIGN KEY
	(
		type
	) REFERENCES classes (
		type
	),
	CONSTRAINT CK_objects_id_1 CHECK (id > 0)
)
GO

