CREATE TABLE acl_entries (
	acl_entry_id int NOT NULL,
	acl_id int NOT NULL ,
	group_id int NOT NULL ,
	permission_coded varchar (96) NOT NULL ,
	CONSTRAINT PK_acl_entries PRIMARY KEY
	(
		acl_entry_id
	),
	CONSTRAINT FK_acl_entries_to_objects FOREIGN KEY
	(
		acl_entry_id
	) REFERENCES objects (
		id
	),
	CONSTRAINT FK_acl_entries_to_acls FOREIGN KEY
	(
		acl_id
	) REFERENCES acls (
		acl_id
	),
	CONSTRAINT FK_acl_entries_to_groups FOREIGN KEY
	(
		group_id
	) REFERENCES groups (
		group_id
	)
)
GO

INSERT INTO classes (type, db_name, table_name, java_class)
	VALUES(6,	'building2', 'acl_entries', 'org.bodington.server.realm.AclEntry')
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(6, 1, 'acl_entry_id', 'setAclEntryId', 'getAclEntryId', '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(6, 2, 'acl_id', 'setAclId', 'getAclId', 'org.bodington.database.PrimaryKey', 'org.bodington.database.PrimaryKey', 2, 5, 'setAcl', 'getAcl' )
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(6, 3, 'group_id', 'setGroupId', 'getGroupId', 'org.bodington.database.PrimaryKey', 'org.bodington.database.PrimaryKey', 2, 3, 'setGroup', 'getGroup' )
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(6, 4, 'permission_coded', 'setPermissionCoded', 'getPermissionCoded', 'java.lang.String', 'java.lang.String', 0, null, null, null )
GO

