Added generics to EntityTemplate to get rid of casting and Class.forName lookup