
    Deanna Leon et al., Respondents, v Donato Montano et al., Defendants, and Newport Hotel, Inc., Appellant.
   — In a negligence action to recover damages for personal injuries, etc., the defendant Newport Hotel, Inc., appeals from an order of the Supreme Court, Kings County (Jones, J.), dated November 27, 1984, which denied its motion for summary judgment or, in the alternative, for leave to amend its answer so as to assert the affirmative defense of lack of in personam jurisdiction.

Order affirmed, with costs.

It has been consistently held that to obtain summary judgment it is necessary that the movant establish its cause of action or defense sufficiently to warrant the court to direct judgment in its favor as a matter of law (CPLR 3212 [b]; Spearmon v Times Sq. Stores Corp., 96 AD2d 552). The record here reveals unresolved questions of fact with respect to, for example, whether or not the defendant Newport Hotel, Inc. breached any duty owed to the plaintiffs, who were its guests, and whether or not the breach, if any, was the proximate cause of their injuries. Consequently, Special Term properly denied summary judgment.

Additionally, we find that the branch of the appellant’s motion which sought, in the alternative, to amend its answer so as to include the affirmative defense of lack of in personam jurisdiction was also properly denied. The appellant knew or should have known of the existence of the defense from the outset of the action, yet neglected to include the defense either in its original answer or in the answer amended as of right, but waited until discovery had been completed and the case was ready for trial. The general rule is that an affirmative defense is waived if not raised in the pleadings, and that whether to grant or deny leave to amend is a matter of judicial discretion, to be determined on a case-by-case basis, but should not be granted where the opposing party will be prejudiced thereby (see, Fulford v Baker Perkins, Inc., 100 AD2d 861; Surlak v Surlak, 95 AD2d 371, 383; Mayers v D’Agostino, 58 NY2d 696, 698). Under the circumstances of the instant case, Special Term did not abuse its discretion in denying leave to amend. Mollen, P. J., Rubin, Eiber and Hooper, JJ., concur.  