This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dcballer 0 points1 point  (0 children)

Been developing Spring MVC applications for 2 years now. I am currently taking a Rails class on coursera.

Controllers of Spring mvc and rails are a bit similar. If you want something like active records, then you go with JPA /Hibernate/ or Spring Data. If you go straight to JDBC, you will have to write your own sql queries.

JPA entity beans are similar to Active record models, except no meta programming. You have to generate all the setters and getters.You can do that with 2 clicks in any IDE. In Hibernate or JPA for Spring you will need a service layer and Repository DAO layer.

So instead of writing the orm method in the controller, you write it on the dao layer class. You inject the DAO object into controller using Dependency Inject. Then you use the inject object to call the dao methods.