This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Struts2 + JDBC: Good or Bad?

 
Ranch Hand
Posts: 62
Eclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For a school project, my group is planning to use Struts2 with plain JDBC/SQL for database. The database is expected to have around 1000 records (or less).
The Struts2 is pretty much set. However, is it a good choice to use plain JDBC/SQL or go with Hibernate instead?
 
Ranch Hand
Posts: 10192
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this is a school project, provided if you are already familiar with JDBC, ResultSet handling and so on, I'd invest in learning a new technology. If you have not worked with Hibernate, this should be the right time to do so.
 
Kat Rollo
Ranch Hand
Posts: 62
Eclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your response. Is plain JDBC/SQL no longer used in the outside world?
 
Joe Harry
Ranch Hand
Posts: 10192
3
Mac PPC Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as my experience goes, I see one or the other object relational mapping framework used instead of JDBC.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kat Rollo wrote: Is plain JDBC/SQL no longer used in the outside world?



It's still used in a lot of applications. However, the JDBC logic is usually wrapped by a layer on top of it, to reduce the connection, query and result set management. That layer could be something that's simple and developed specific for that application or it could be as big and complex as ORM frameworks. Either way, JDBC is still used and having a sound knowledge about those APIs and their usage, especially if you haven't used it before, is definitely going to help you improve your basics.
 
Kat Rollo
Ranch Hand
Posts: 62
Eclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Honestly, I'm a bit scared to touch Hibernate. There seems to be a lot going on under the hood and it might be too powerful for someone just beginning JavaEE and frameworks.
I personally like managing my own SQL statements and closing my own resources.
But it seems there are a lot of job offers with Hibernate.
 
Joe Harry
Ranch Hand
Posts: 10192
3
Mac PPC Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You still have to close your Hibernate sessions just like how you close your JDBC connections. It is just not that. With Hibernate or rather with any ORM framework, you work with your domain objects rather than populating your domain object from the ResultSet.

There is nothing to scare. If you are able to understand JDBC, Hibernate should be easy for you to pick up!
 
Kat Rollo
Ranch Hand
Posts: 62
Eclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey thanks, I do agree it's a good investment.
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Off late I have been working with iBatis and Struts. The good thing I found about iBatis was that I could define my queries, provide them an identifier and then I can also provide a custom result mapper or just use HashMap. So you can check that out as well.

I have also worked with Spring JdbcTemplate which is also good, so you can do connection pooling, write your queries, provide result set mappers to iterate through the result set and populate your objects. This way you have more control over the interaction with DB.

My experience has been that learning a technology/framework on the job is quite easy. If you are a skilled developer then it shouldn't be a problem to pick any technology.

ORM mappers build this complete object graph if I am not wrong i.e populating the composite object data by using the relationships between the tables. Is it not that ORM mappers are very helpful while your are doing CRUD on your domain objects and while you are writing a very complex query there are chances of getting lost while using ORM Query Language?
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic