Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-05-2008, 05:27 PM
Member
 
Join Date: Nov 2007
Posts: 45
sireesha is on a distinguished road
Hibernate Use
Hi Every one,
I am learning Hibernate.For this i am following tutorials form different websites.In every tutorial they gave examples for saving data or to update data.I couldn't find any examples for retrieving data(like retrieving a row depending on some condition ) .Now my doubt is,Can't we use hibernate for retrieving data form a table? If we can,how to do that ? what are different operations that we can perform with hibernate ? Can any one please tell me.
Thank q very much,
sireesha.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-08-2008, 03:44 AM
Member
 
Join Date: May 2008
Posts: 3
ibjava is on a distinguished road
Quote:
Originally Posted by sireesha View Post
Hi Every one,
Now my doubt is,Can't we use hibernate for retrieving data form a table? If we can,how to do that ?
we can actually, this example is taken from my application:
Code:
public List<Deposito> getDepositosPaging(int start, int length) { Session session = getSession(); List<Deposito> depositos = (List<Deposito>) session.createQuery("from Deposito where statExist=true order by id ") .setFirstResult(start) .setMaxResults(length).list(); return depositos; }
it retrieve list of Depositos where statExist is true from id=start until id=start+length, ordered by id
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-21-2008, 04:05 AM
Member
 
Join Date: Apr 2007
Location: Indiana
Posts: 84
pegitha is on a distinguished road
Send a message via Skype™ to pegitha
To get one object by primary key:
getHibernateTemplate().load(MyObject.class, primaryKey);
for a list using HQL:
getHibernateTemplate().find("from MyObject obj where obj.recordStatus='A' ");
or use the Criteria API which personally I think is awesome
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hibernate, help me Nick15 Database 2 06-05-2008 04:39 PM
Hibernate DAO sundarjothi Eclipse 0 04-26-2008 09:29 AM
hibernate vipinpvijayan Web Frameworks 1 04-21-2008 06:41 PM
org.hibernate.ejb.Version <clinit> INFO: Hibernate EntityManager 3.2.0.CR1 Heather Database 2 06-30-2007 04:01 PM
Hibernate Alan Database 2 05-11-2007 02:19 AM


All times are GMT +3. The time now is 01:07 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org