What ORM Frameworks Support Constructor Injection?
David Sledge
Greenhorn
Joined: Jun 29, 2009
Posts: 3
posted
0
What ORM frameworks support constructor injection? I've looked at Hibernate and iBatis, and I don't see where either (currently) support constructor injection. (It looks like iBatis will support down the road, but I'm looking for something in the here and now.)
Constructor injection: Using a class's constructor to set one or more of its dependencies instead of using a setter method.
It's useful when mapped objects are immutable, when you want to require that a specific member always be set (i.e. not null) right from the object's instantiation, or are using classes that lack a no-argument one.
My specific issue is in line with the last reason. I have a stored procedure, and I want to map the results to a list of data objects whose class does not have a no-argument constructor.