• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What ORM Frameworks Support Constructor Injection?

 
David Sledge
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
David Sledge
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answer: iBATIS 3 for Java (beta). Released a couple of weeks ago.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic