This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
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


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » 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
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17228
    
    1

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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: What ORM Frameworks Support Constructor Injection?
 
Similar Threads
Latest Java Technologies
Differences between iBatis implementations...
What technology next
Sql in xml files
DI - Constructor injection / Setter Injection ?