You can’t. The AttributeConverter doesn’t know anything about the use-site. You could create a converter for each length though, or you go the more complicated route and implement a custom UserType and also extend the org.hibernate.usertype.DynamicParameterizedType interface.