dissenting:
Res judicata is a drastic device which precludes a party from litigating an essential issue and it should be applied with caution. McNellis v. First Fed. Sav. & Loan Ass’n, 364 F.2d 251, 257 (2d Cir. 1966). Our case law up to now has struck a fair balance between the rights of the plaintiff and defendant. When the second suit is on the same cause of action, the former judgment on the merits is a bar not only as to all matters that have actually been tried but also as to all matters that might have been tried.
*397Where however the second suit is on a different cause of action, the former judgment on the merits is a bar only as to those matters which were actually tried and determined against the plaintiff. Metcalf v. Gilmore, 63 N.H. 174 (1884); Lovejoy v. Ashworth, 94 N.H. 8, 45 A.2d 218 (1946); Ainsworth v. Claremont, 108 N.H. 55, 226 A.2d 867 (1967); McGrath v. McGrath, 109 N.H. 312, 251 A.2d 336 (1969). This is a fair rule. A plaintiff ought to be required to fully try his cause of action at one hearing and he ought to be barred in a second and different cause of action only by determinations of issues which he has already litigated. Pie ought not be prevented, however, from litigating issues which are not necessarily included as part of his first action and which have not in fact been litigated.
Here it is agreed that plaintiff had certain contractual rights with respect to the hydrants. The prior action could not therefore have been dismissed on the basis that there was no such contract. The prior action was not decided on the merits but the trial judge, according to the agreed statement of facts, dismissed the action “for failure to state a cause of action in contract. RSA 491:8.”
RSA 491:8 is the statute by which the State has waived its sovereign immunity as to actions “founded upon any express or implied contract with the state.” Obviously the action was dismissed because of a failure to allege a contract “with the state” so as to bring it within the waiver of sovereign immunity. This is not a determination on the merits and therefore is no bar to another action even for the same cause under any rule. All reasonable doubt as to what was decided in the prior action should be resolved in favor of the plaintiff. McNellis v. First Fed. Sav. & Loan Ass’n, 364 F.2d 251 (2d Cir. 1966).
But even assuming that the prior decision was on the merits, it would not bar the present action because this is a different cause of action and no issue essential to it has been decided against the plaintiff. The previous action was based on contract but failed because the contract was not “with the state” and sovereign immunity prevented recovery. The present claim is not on the contract but rather *398is for the taking of a property right created by the contract. The contract with the town gave the plaintiff an easement to maintain the hydrants and other fixtures in their original location unless the town paid the expense of moving them. This situation is different from that covered by Opinion of the Justices, 101 N.H. 527, 132 A.2d 613 (1957), where there was no such contract. The plaintiff, therefore, had a right which could not be taken without just compensation. Eaton v. B.C. & M. RR., 51 N.H. 504 (1872); Lynch v. United States, 292 U.S. 571 (1934); see Am. Jur. 2d Eminent Domain § 81 (1966). Sovereign immunity is no bar to this claim because the constitutional right to just compensation is self-executing and not dependent on waiver of sovereign immunity. N.H. Water Resources Bd. v. Pera, 108 N.H. 18, 226 A.2d 774 (1967). This is a claim which is certainly based on a different cause of action from the previous action and it is one which has never been litigated. Trans World Airlines, Inc. v. Hughes, 317 A.2d 114 (Del. Ch. 1974).
In a line of cases in this State the harsh rule of preclusion of issues not litigated and determined has not been applied where the second suit is for a different cause of action even though arising out of the same transaction. In.Lovejoy v. Ashworth, 94 N.H. 8, 45 A.2d 218 (1946), in a suit on a foreign judgment on a note, the court held that a claim of equitable setoff based on deceit was not barred even though it arose out of the same transaction as the judgment sued on because it was a different cause of action and the issue had not in fact been determined in the former suit. In McGrath v. McGrath, 109 N.H. 312, 251 A.2d 336 (1969), a bill in equity to have a contract declared void because of fraud on incompetent parents was considered a different cause of action from a prior action in assumpsit which had been terminated in defendant’s favor even though it arose out of the same transaction. The second action was barred only by collateral estoppel because the issues raised in the bill in equity had in fact been determined in the first action. Other examples of the application of this rule are found in Met-*399calf v. Gilmore, 63 N.H. 174 (1884); Patey v. Peaslee, 101 N.H. 26, 131 A.2d 433 (1957), and Ainsworth v. Claremont, 108 N.H. 55, 226 A.2d 867 (1967).
It seems to me that the rule adopted by the court takes us back to the days when a plaintiff’s rights were determined not on their merits but on technicalities. Thus, no second action can be brought arising out of the same transaction if the plaintiff misconceived his remedy in the first action and lost for that reason. This rule seems unnecessarily harsh to me and I oppose its adoption. It visits hardship upon the party whose lawyer fails to think of “all the aspects of all possible claims” against the defendant. F. James, Jr., Civil Procedure § 11.10, at 555-56 (1965); Cleary, Res Judicata Reexamined, 57 Yale L.J. 339 (1948).
I adhere therefore to the rule laid down in our aforementioned prior cases and to my dissent in Lougee v. Beres, 113 N.H. 712, 313 A.2d 422 (1973), and would hold, as the trial court did, that the plaintiff’s present action is not barred.