how to use  transient and static factory method