Forums Register Login

why use hibernate mapping when we can fetch from second table by using HQL

+Pie Number of slices to send: Send
Suppose I have to fetch categories from products. We can do by forming an HQL without any hibernate mapping. Then what is the advantage of instead doing a hibernate mapping.


In hibernate we can fetch from the second table using a HQL select query. Such a query does not require hibernate mapping.Then what is the advantage of using mapping.


thanks
+Pie Number of slices to send: Send
Hello,
If I understand your question right then could you tell me why would you use Hibernate to retrieve data from database ? why not plain JDBC and ResultSet/SQL ?

Regards,
Amit
+Pie Number of slices to send: Send
Thanks Amit. It is used so that later if database changes same code can be used.
+Pie Number of slices to send: Send
Hello,
IMO, using hibernate to only address changing database problem is overkill. I would use some other lightweight framework like Spring JDBC Template and iBatis ( not sure if its being updated anymore).

Unless you are building a product I do not think we have to be concerned about backend database changing too often.

Regards,
Amit
+Pie Number of slices to send: Send
 

IMO, using hibernate to only address changing database problem is overkill. I would use some other lightweight framework like Spring JDBC Template and iBatis ( not sure if its being updated anymore).



I read on the internet that this is the primary advantage of using hibernate. If you say that this should not be the primary reason then what else can be the primary reason for using hibernate?

thanks
+Pie Number of slices to send: Send
 

Monica. Shiralkar wrote:

IMO, using hibernate to only address changing database problem is overkill. I would use some other lightweight framework like Spring JDBC Template and iBatis ( not sure if its being updated anymore).



I read on the internet that this is the primary advantage of using hibernate. If you say that this should not be the primary reason then what else can be the primary reason for using hibernate?

thanks



It's an ORM tool, so that's the primary reason for using it.
The "no worries about changing databases" was only ever a distant secondary.
+Pie Number of slices to send: Send
Thank you.
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 662 times.
Similar Threads
Hibernate generated query for a inheritance mapping
Hibernate - Query language independency
When Command Object/POJO is not sufficient
is hibernate solved these problem?
OneToOne composite key
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 06:59:37.