November 10, 2008 at 7:07 AM
Hi friend,
package net.roseindia;
import java.util.Iterator;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.criterion.ProjectionList;
import org.hibernate.criterion.Projections;
public class projectionExample {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Session sess = null;
try{
SessionFactory sfact = new Configuration().configure().buildSessionFactory();
sess = sfact.openSession();
Criteria crit = sess.createCriteria(Product.class);
ProjectionList proList = Projections.projectionList();
proList.add(Projections.property("name"));
proList.add(Projections.property("price"));
crit.setProjection(proList);
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();
}
}
}
sess.close();
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
}
---------------------------------------
Visit for more information.
http://www.roseindia.net/hibernate/projections/hibernate-projections.shtmlThanks
Related Tutorials/Questions & Answers:
Persist a List Object in Hibernate - HibernatePersist 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...(Projections.property("price"));
crit.setProjection(proList);
List list = crit.list
Hibernate persist MethodHibernate persist Method
In this tutorial you will learn about how to use
persist method in
hibernate.
Hibernate's
persist() method is used to insert... (primary key)
value that is generated by the
hibernate but the
persist() method
Advertisements
object chaining? - Hibernateobject 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? - Hibernatewhat is
object chaining? daoobject.getsession().begainTransaction;
can any one explain the code, i am understanding this line when iam working with swt and
hibernate how to iterate hibernate objecthow 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
hibernate object states and life cyclehibernate 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
Hibernate dialects listHibernate dialects list Can anyone share me the
list of dialects of
Hibernate?
Thanks
Hi,
Hibernate supports many databases with the help of Dialects.
You can check the
list of
Hibernate dialects at the tutorial
Hibernate Criteria Unique List Example Hibernate Criteria Unique
List Example How to write
Hibernate Criteria Unique
List Example?
I want example of
Hibernate Criteria Unique
List in Java.
Thanks
Example of
Hibernate Criteria Unique
List.
Check
Hibernate Criteria Unique List Example Hibernate Criteria Unique
List Example Hello,
I have just started to learn the
Hibernate. I want example of
Hibernate Criteria Unique
List.
Thanks
Example:
Hibernate Criteria Unique
List.
Check the tutorial
Hibernate 4 Supported Databases ListHibernate 4 Supported Databases
List
In this tutorial you will learn that how many databases are supported by
Hibernate.
You must be looking for the
list... gives
you the
list of
Hibernate supported databases with the name of Dialect
save list of objects in Spring and hibernatesave
list of objects in Spring and hibernate I use a javascript which add dynamic rows with values in jsp.
Now i want to save these multiple values using spring and
hibernate.
Thanks for help
Hibernate Criteria Unique ListHibernate Criteria Unique
List
An example of
hibernate criteria unique
list is given below, which returns the unique
value in
list from a table... it will display message as shown below:
Hibernate: select this_.roll
objectobject is it possible to create
object in the same class..?.
Yes, you can.
class CreateObject
{
CreateObject(){
System.out.println("I have an
object.");
}
public static void main(String[] args
Hibernate Training engine.
How to
persist different types of objects using the
Hibernate...;
Annotations for
object/relational mapping with
Hibernate
Java...
Hibernate Training
Hibernate O/R Mapping maps an
object to the
relational database table.
Hibernate is also an O/RM...
Hibernate O/R Mapping
In this tutorial you will learn about the
Hibernate O/RM (
Object/Relational Mapping).
O/RM itself can be defined as a software
Video Tutorial: Hibernate 4 Supported Databases ListHibernate 4 Supported Databases
List
Hibernate being an
object relational... database.
Hibernate also takes the initiative to solve the problems of
object... databases.
Here, the
list of
Hibernate 4 was compiled which supports the MySQL
ModuleNotFoundError: No module named 'persist'ModuleNotFoundError: No module named '
persist' Hi,
My Python... '
persist'
How to remove the ModuleNotFoundError: No module named '
persist... to install padas library.
You can install
persist python with following command
Insert an object with the add(Object) method
Insert an
object with the add(
Object) method
In this section you will learn to
insert an
object at the end of a
list
using the add(
Object) method. Here is an example that
provides
Hibernate Tutorials
Hibernate Tutorials
Deepak Kumar
Deepak... is a tutorial written by him on
hibernate.
Abstract:
Hibernate is popular open source
object relational mapping tool for Java platform. It provides powerful, ultra
hibernatewhy
hibernate? why
hibernate?
Hibernate: -
Hibernate is an Open Source persistence technology.
It provides
Object/Relational mapping library.
It solves
object-relational impedance mismatch problems.
Hibernate Complete Hibernate 4.0 Tutorial.
Complete
Hibernate 4.0 Tutorial
Hibernate is a
Object-relational mapping... tutorials:
Hibernate 4
Annotations Tutorial
Given below the complete
list...
Hibernate
Supported Databases
List
Hibernate
<generator> Element
ListList i do have one
list object, i want to compare this
list from database table and if match found i want to update the
list Hibernate TutorialsHibernate Tutorials
Hibernate is popular open source
object relational mapping....
Hibernate is among the favourite
object/relational persistence (ORM) tool... an
object-oriented domain model to a conventional relational database. In addition
Hibernate 4
Hibernate 4 Example With Eclipse
Hibernate Supported Databases
List... 4 Annotation Example
Hibernate update Method
Hibernate persist Method...
Hibernate 4
Hibernate 4 is the latest version of
Hibernate which was released
Hibernate 3.1.2 Released Hibernate 3.1.2 Released
Back to
Hibernate Tutorials Page
Hibernate is a powerful, high performance
object/relational persistence and query service.
Hibernate lets you develop
persistent classes following
object-oriented
hibernatehibernate Is there any other way to call procedure in
hibernate other than named query????? if we are using session
object to get the connection then why
hibernate we can directly call by using a simple java class??????? please