• Post Reply Bookmark Topic Watch Topic
  • New Topic

My first Java Web project and database patterns questions.  RSS feed

 
M Kisiel
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!