• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

My first Java Web project and database patterns questions.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I need to do web project in school.

I am learning Servlet/JSP and I like this (comparing to my years of PHP).

My question is about database access of web application.

I heard I should use Hibernate for this. IMO Hibernate is overkill to my project and I don't sure that this is efficient solution.

For example:

I want to create listing of users projects, I want to display:

- username
- project name
etc

user and project are different entities, so with Hiberante I need to load all data about users which have projects and projects that they have.

In Hibernate it means loading a lof of unnecessary data. Am I right?

For me simple join for user name and projects data will be fine, so how in this case my models should look?

Which patterns should I use?

Another problem I am thinking of what about tables that I am using for caching data (MyISAM table) from tables that needs a lot of joins.

How models should look in this case?

I hope my question is clear.

Could somebody give me any advice?

Regards
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hibernate is an ORM tool. It basically allows you to store objects in a relational database. In some cases this could be a bit overkill. You can't say that it loads unnecessary data without defining in the situation. Also hibernate caches so it might even save some calls to the database. You could just use a JDBC connection.

Databases are extremely good in joins. I would not go and cache things as this makes stuff a whole lot more complex. Build, perform performance analysis and only then if there are performance issues optimize.

Edit: and welcome to the JavaRanch!
 
M Kisiel
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Wouter Oet Thanks for your response. So you suggest me to get Hibernate to this work?

In my project user can have many "projects".

On homepage I need to show ex 20 last projects.

So can I load projects objects (Hibernate) and get those projects authors (users) via Hibernate from those projects object?

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic