Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Hibernate how to iterate hibernate object

Have Programming Question? Ask it here!
 
 
 


Ravi
how to iterate hibernate object
2 Answer(s)      3 years and 8 months ago
Posted in : Hibernate


am just learning hibernate .by the hibernate am getting one list to display a grid(grid has 5 column). now i want to iterate one only column value to calculate total of that particular column. how to do this....


Advertisement
View Answers

December 2, 2010 at 7:53 PM


Hi,

You can use the iterator class to iterate the data.

Here is example code:

Iterator it = list.iterator(); while(it.hasNext()){ Object[] row = (Object[])it.next(); for(int i = 0; i < row.length;i++){ System.out.print(row[i]); System.out.println(); } }

Read at Hibernate Projections.

Thanks



December 2, 2010 at 7:54 PM


Hi,

Here is the code:

   List list = crit.list();
      Iterator it = list.iterator();
      if(!it.hasNext()){
        System.out.println("No any data!");
      }
      else{
        while(it.hasNext()){
          Object[] row = (Object[])it.next();
          for(int i = 0; i < row.length;i++){
            System.out.print(row[i]);
            System.out.println();
          }
        }
      }

Thanks



Related Tutorials/Questions & Answers:
how to iterate hibernate object
how to iterate hibernate object  am just learning hibernate .by the hibernate am getting one list to display a grid(grid has 5 column). now i want to iterate one only column value to calculate total of that particular column. how
How to iterate over a checkbox group
How to iterate over a checkbox group  Hi. I am new to using JQuery and would much appreciate your help. I have a form on which I've created 5..." groups. My plan of attack was to iterate over the MASTER checkbox group
Advertisements
Hibernate criteria - how to use criteria to return only one element of an object instead the entire object.
Hibernate criteria - how to use criteria to return only one element of an object instead the entire object.  How to use criteria to return only one element of an object instead the entire object?   You can use
Persist a List Object in Hibernate - Hibernate
Persist a List Object in Hibernate   Hi All, I have a query on hibernate. How to persist a List object in Hibernate ? Can you give me...()){ Object[] row = (Object[])it.next(); for(int i = 0; i <
object chaining? - Hibernate
object chaining?  daoobject.getsession().begainTransaction; can any one explain the code, i am not understanding this line when iam working with swt and hibernate
what is object chaining? - Hibernate
what is object chaining?   daoobject.getsession().begainTransaction; can any one explain the code, i am understanding this line when iam working with swt and hibernate
hibernate object states and life cycle
hibernate object states and life cycle  I am bit confused in between the hibernate states and it's life cycle. Can you please explain this also? also explain the persistent, detached and transient object states.Thanks
Logic Iterate.
Logic Iterate.  I have one doubt about logic:iterate. I use text feild inside of logic:iterate , there is possible will generate N no of rows (text feild) inside of iterate. my doubt is how to get the Paritcular rows text
How to handle the list dynamically in struts inside logic:iterate tag
How to handle the list dynamically in struts inside logic:iterate tag  I am having following code in JSP <table> <tr> <logic:iterate name="loginForm" id="inutParams" property="inutParams" indexId="i"> <
Logic Iterate.
Logic Iterate.  logic iterate Struts I have one doubt about logic:iterate. I use text field inside of logic:iterate , there is possible will generate N no of rows (text field) inside of iterate. my doubt is how to get
Iterate a List in Java
Iterate a List in Java In this tutorial I will show you how you can iterate... to iterate a List in Java In java a list object can be iterated in following... to iterate a list object: import java.util.Iterator; import java.util.List
Iterate Tag used with a Map.
Iterate Tag used with a Map.  How Iterate Tag used with a Map
How to disable an HTML object?
How to disable an HTML object?  How to disable an HTML object
How to sort json object?
How to sort json object?  I've been looking for a while and want a way to sort a JSON object like this: {"results": [ { "layerId": 5, "layerName": "Pharmaceutical Entities", "attributes": { "OBJECTID": "35
how to configure the hibernate in netbean
how to configure the hibernate in netbean  how to configure the hibernate in netbean 6.5
logic-iterate
logic-iterate  in my code i am using for-each loop for displaying data i want use tag to display data how to use plase help me <%@ page import="java.sql.*" %> <%String[] id = (String[])session.getAttribute("ids
Collection Iterate Example
Collection Iterate Example       In this section, you will get the detailed explanation about the hasNext() method of interface Iterator. We are going to use hasNext() method
logic iterate tag - Struts
logic iterate tag  Hey I am displaying the values in a jsp called categoryView.jsp using logic iterate tag as Now properties... CategoryForm.java to ViewCategoryForm.java. How do I separate both of the form beans
How to revert back ServletInputStream object after reading once. - JSP-Servlet
. My Q is how can I iterate request object twice? How we can revert back...How to revert back ServletInputStream object after reading once.  Hi.... To read data from request object using ServletInputStream. Now I want to iterate same
How will you configure Hibernate?
How will you configure Hibernate?  Hi, How will you configure Hibernate? Thanks
How to run? - Hibernate
friends are told hibernate is a new entry to Java. so plz try to tell how to use Hibernate code in my application?  Hi friend, Hinernate : Hibernate...How to run?  Hiiiiiiiiiiiii friend.. i am Magesh
Struts logic iterate
with iterate name= "listM". Another table also opens. So please tell me how can i... iterate <%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>...; <body> <h1> Search </h1> <logic:iterate name
how to Integrate MULE and HIBERNATE - Hibernate
how to Integrate MULE and HIBERNATE  hi, i am having a simple JSP... as webservice. Hibernate is used to talk with DB. I have used Spring framework to generate beans for all my java classes. but i am not able to integrate MULE with Hibernate
How to make focus on an object, make focus on an object, focus on an object
How to make focus on an object       This example will teach you to make focus on the object so follow...: Choose Polygonal lasso tool (L key) to make selection of the object. Blur
how to edit a record in hibernate?
how to edit a record in hibernate?  how to edit a record in hibernate?   Hi Friend, Please visit the following link: Hibernate Tutorials Thanks   Hi Friend, Please visit the following link: Hibernate
How to find a servlet object by name?
How to find a servlet object by name?  How can we locate a servlet object in the code by it's object name?   A. In web.xml you map servlet... by calling getServletNames on the ServletContext object. ServletContext is available
How to calculate the average in Hibernate?
How to calculate the average in Hibernate?  Hi, I have to calculate the average in Hibernate. How to calculate the average in Hibernate? Thanks   Hi, You can use the project in Hibernate. Here is the example code
How to update table in Hibernate
How to update table in Hibernate  Hi, I have a table in database that has two fields in it. Student Name and ID, can anyone explain me how to update these tables in Hibernate. Thanks.   Update table query in Hibernate
How to use Hibernate get sessionfactory?
How to use Hibernate get sessionfactory?  Hi, How to use hibernate get sessionfactory? Thanks
How to solve the Hibernate Common Exceptions?
How to solve the Hibernate Common Exceptions?  How to solve the Hibernate Common Exceptions
how to debug parameters in the hibernate query
how to debug parameters in the hibernate query  how to debug parameters in the hibernate query
Hibernate How To
Hibernate How To Adding the ordering ability in your Hibernate Application while using hibernateTemplate In this section you will learn how... this tutorial you will learn how to find unique result using hibernate criteria
how many ways are there to invoke a servlet object?
how many ways are there to invoke a servlet object?  how many ways are there to invoke a servlet object
In Java how to get size of class and object?
In Java how to get size of class and object?  In Java how to get size of class and object
In Java how to get size of class and object?
In Java how to get size of class and object?  In Java how to get size of class and object
How to deploy hibernate in linux server - Hibernate
How to deploy hibernate in linux server  can anyone tell me how can i deploy my project hibernate project in linux server which is currently running on eclipse (on my local desktop)? thanks in advance
How to deploy hibernate in linux server - Hibernate
How to deploy hibernate in linux server  can anyone tell me how can i deploy my project hibernate project in linux server which is currently running on eclipse (on my local desktop)? thanks in advance
How to create sessionfactory in Hibernate 4.1?
How to create sessionfactory in Hibernate 4.1?  hi, I have worked on earlier versions of Hibernate but I am finding it difficult to work... Session Factory How to create SessionFactory in Hibernate 4.3.1 Hibernate
How to create sessionfactory in Hibernate 4.1.1?
How to create sessionfactory in Hibernate 4.1.1?  HI, I need to create Sessionfactory in Hibernate 4.1.1. How can i do it? Thanks.   ... in hibernate 4.1.1: Hibernate 4 create Session Factory How to create SessionFactory
struts logic:iterate tag
struts logic:iterate tag  Hi All, I am writing a look up jsp which is using logc:iterate every thing is fine except this the problem here is unable to go inside the tag. Here is the stack trace I am getting. [#|2010-10-27T00
How to create wildcard query in Hibernate?
How to create wildcard query in Hibernate?  Hi, I am new in Hibernate and I have to create a query using wildcard. How to create wildcard query in Hibernate? Thanks   Hi, For creating wildcard query you can use
How to change object item to integer item
How to change object item to integer item  How to change objectitem to integer item?thankyou
How to integrate core java with Hibernate
How to integrate core java with Hibernate  How to integrate core java with Hibernate How to integrate core java with Hibernate   xxxxxxxxx   Please visit the following link: Java with Hibernate The above
how to make an unreachable object as reachable - Java Beginners
how to make an unreachable object as reachable  i know that an object is garbagecollected when it is unreachable to the programmer but my question is how that unreachable object which was garbage collected will become
Iterate list of objects on jsp page
Iterate list of objects on jsp page  Hi, I want to iterate the list of objects on jsp page using custom tags. Can you please give me one link or example? Thanks
How to learn hibernate in 24 hours?
How to learn hibernate in 24 hours?  Hi, I am assigned a new project... will spend 24 hours from 48 hours. I want to learn Hibernate in just 24 hours. Is it possible to learn Hibernate in 24 hours? I don't want to be master
How to use an object properties in jsp page
How to use an object properties in jsp page  I have a arraylist of objects 'User' populated using struts 2 action class while loading that jsp page... of hardcoded value 'AMIT' I want to use value of User object. How can I do it? Please
<logic:iterate> - Struts
and adding HashMap object in itAs you can see the code in my quesI want to use only
How to get max date in Hibernate?
How to get max date in Hibernate?  Hi, Tell the code to get the max date in Hibernate? Thanks   Hi, You can use the projection in Hibernate for getting the max date. Here is example code: Projections.max("addmision
how to get session object in simple java class??
how to get session object in simple java class??  i am fallowing... into session. so, please tell me, how to get the session object (GroupPojo) in a simple... the value to GroupPojo.java and set this pojo object into session. sending control
 

 

 

DMCA.com