The moose likes Object Relational Mapping and the fly likes What ORM Frameworks Support Constructor Injection? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "What ORM Frameworks Support Constructor Injection?" Watch "What ORM Frameworks Support Constructor Injection?" New topic
Author

What ORM Frameworks Support Constructor Injection?

David Sledge
Greenhorn

Joined: Jun 29, 2009
Posts: 3
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.)

Thanks,

D

This message was edited 1 time. Last update was at by David Sledge

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 16356

Explain what you mean by constructor injection? And also why you would need such a feature in relation to ORMs and domain objects?

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
David Sledge
Greenhorn

Joined: Jun 29, 2009
Posts: 3
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.
David Sledge
Greenhorn

Joined: Jun 29, 2009
Posts: 3
Answer: iBATIS 3 for Java (beta). Released a couple of weeks ago.

This message was edited 1 time. Last update was at by David Sledge

 
 
subject: What ORM Frameworks Support Constructor Injection?
 
Two Laptop Bag