Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

new to Hibernate DAO

 
hari ann
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am learning Hibernate DAO. I am reading one tutorial. I am having the following question please help on this

public interface Dao<T>

{

int create(T obj);
void deleteById(int id);
T getById(int id);

}


What T means? for what purpose we can use T
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It represents a generic type. Read on about generics. It was introduced along with Java 1.5 some years ago. Here's a nice tutorial about that: http://java.sun.com/docs/books/tutorial/java/generics/index.html

That said, this has in fact nothing to do with Hibernate, nor with the DAO pattern. Hibernate is just an ORM framework and the DAO pattern just makes data access abstract and modular.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!