A polyesteramide resin containing ester groups and at least one amide group in the backbone characterized in that the resin has a Tg < 0 oC and at least one hydroxyalkylamide endgroup having the structure I wherein the free bond extends to the polymer backbone; A is an, optionally substituted, (C 6 -C 24) aryldiradical or an, optionally substituted (C 2 -C 24) (cyclo)alkyl aliphatic diradical; H or (C 1 -C 20) (cyclo) alkyl, or (C 6 -C 10) aryl; X 1 is H or a group -CO-R 7, -CO-A-CO-N(R 8,R 9), -CO-A-CO-OR 10, or -NHet; R 1 to R 6 are, independently of each other, H, (C 1 -C 20) alkyl, (C 3 -C 7) cycloalkyl or (C 6 -C 10) aryl; R 7 is (C 1 -C 20) alkyl, (C 3 -C 7) cycloalkyl, (C 6 -C 10) aryl, or a radical of a polymer or an oligomer; R 8 and R 9 are, independently of each other, (C 1 -C 20) alkyl or (C 6 -C 10) aryl groups; or (C 1 -C 20) alkyl or (C 6 -C 10) aryl groups substituted by a group containing at least one hetero atom or R 8 and R 9 together with the nitrogen atom to which they are attached form a 5 or 6 membered ring wherein optionally one or several C-atoms are replaced by - NH, -N-(C 1 -C 20) alkyl, -N-aryl, -O- or -S-; R 10 is (C 1 -C 20) alkyl, (C 3 -C 7) cycloalkyl or (C 6 -C 10) aryl, or a radical of a polymer or an oligomer; -NHet is a mono-, bi- or multicyclic nitrogen containing heterocyclyl group attached via a nitrogen atom to the polymer which may be aromatic or partly or completely hydrogenated and may contain additional heteroatoms such as nitrogen, oxygen or sulfur and which may optionally be substituted; n is an integer of 1 to 4, preferably n = 1; wherein that no more than one of X 1 and X 2 is H, (C 1 -C 20) alkyl, (C 3 -C 7) cycloalkyl or (C 6 -C 10) aryl; and wherein nitrogen containing groups may be quaternized or protonated. A is an, optionally substituted, (C 6 -C 24) aryldiradical or an, optionally substituted (C 2 -C 24) (cyclo)alkyl aliphatic diradical; H or (C 1 -C 20) (cyclo) alkyl, or (C 6 -C 10) aryl; X 1 is H or a group -CO-R 7, -CO-A-CO-N(R 8,R 9), -CO-A-CO-OR 10, or -NHet; R 1 to R 6 are, independently of each other, H, (C 1 -C 20) alkyl, (C 3 -C 7) cycloalkyl or (C 6 -C 10) aryl; R 7 is (C 1 -C 20) alkyl, (C 3 -C 7) cycloalkyl, (C 6 -C 10) aryl, or a radical of a polymer or an oligomer; R 8 and R 9 are, independently of each other, (C 1 -C 20) alkyl or (C 6 -C 10) aryl groups; or (C 1 -C 20) alkyl or (C 6 -C 10) aryl groups substituted by a group containing at least one hetero atom or R 8 and R 9 together with the nitrogen atom to which they are attached form a 5 or 6 membered ring wherein optionally one or several C-atoms are replaced by - NH, -N-(C 1 -C 20) alkyl, -N-aryl, -O- or -S-; R 10 is (C 1 -C 20) alkyl, (C 3 -C 7) cycloalkyl or (C 6 -C 10) aryl, or a radical of a polymer or an oligomer; -NHet is a mono-, bi- or multicyclic nitrogen containing heterocyclyl group attached via a nitrogen atom to the polymer which may be aromatic or partly or completely hydrogenated and may contain additional heteroatoms such as nitrogen, oxygen or sulfur and which may optionally be substituted; n is an integer of 1 to 4, preferably n = 1; wherein that no more than one of X 1 and X 2 is H, (C 1 -C 20) alkyl, (C 3 -C 7) cycloalkyl or (C 6 -C 10) aryl; and wherein nitrogen containing groups may be quaternized or protonated.