Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is Persistance in Hibernate?

 
Harsha Gedala
Ranch Hand
Posts: 41
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this the definition of Persistance!!

"If an information system didn�t preserve data entered by users when the host machine was powered off."

I am a little bit confused with what it really means?
I would be really happy to get a simple gud answer. I am a jr level java programmer, please help me out anybody.

I know it is a silly question but i can't help myself posting.
thanks for the reply in advance.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Harsha"

Please click the My Profile link above and change your display name to meet the JavaRanch Naming Policy of using your real first and real last names.

Thanks

Mark
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Persistence is simply the matter of saving data permanently, so it can be obtained later on. Simply saving data to a database would be the act of persistence. The idea behind Hibernate is that it makes saving, or persisting your data, easier.

Other ways include SQL, straight JDBC, TopLink, EJB Entity Beans, JDO, etc.

-Cameron McKenzie
 
Harsha Gedala
Ranch Hand
Posts: 41
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the simple answer....now i got an idea why we are using hibernate
 
pradeep singh
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Why we cant use simple jdbc for storing data into database instead of Hibernate?What are benefit of using one on other?
 
Maris Orbidans
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's much easier to use ORM tool like Hibernate than SQL and JDBC.
Significantly less code that is also more maintanable.
 
Alaa Nassef
Ranch Hand
Posts: 471
Hibernate Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by pradeep singh:
Hi
Why we cant use simple jdbc for storing data into database instead of Hibernate?What are benefit of using one on other?


Who said that you CAN'T use JDBC? You can do that if you want. Each solution has its own pros and cons. The problems of using core JDBC are several. Take the following for instance:
  • A lot of unneeded legacy code like opening and closing connections that you have to handle yourself
  • Database portability is a problem, since each vendor has his own SQL dialect
  • Developers have to deal with both relational and object oriented data models, and transform from one to the other themselves
  • A lot of bugs and performance issues can arise from forgetting to close connections, statements and result sets.


  • Of course projects like Spring's JDBCTemplate can help solve the first and the last problems mentioned here, but using ORM solves the other two. Of course ORM has its own disadvantages, like having to know how to optimize the generated queries yourself through configurations, and stuff like that. It all depends on what you see useful for your project. For enterprise level projects, I always recommend using ORM together with Spring to make use of their ready made templates.
     
    Harsha Gedala
    Ranch Hand
    Posts: 41
    Eclipse IDE Java Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Benefits of Relational Database Systems:



    searching and sorting is fast
    Work with large amounts of data
    Work with groups of data
    Joining, aggregating
    Sharing across multiple users and multiple locations
    Concurrency (Transactions)
    Support for multiple applications
    Consistent Integrity
    Constraints at different levels
    Transaction isolation
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic