package com.criteria.example;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Room {
private int id;
private String name;
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE)
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.criteria.example;
import java.util.Iterator;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.criterion.Expression;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.ProjectionList;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.hibernate.tool.hbm2ddl.SchemaExport;
public class TestClient {
/**
* @param args
*/
public static void main(String[] args) {
AnnotationConfiguration config = new AnnotationConfiguration();
config.addAnnotatedClass(Room.class);
config.configure(); // reads the *.cfg.xml file and understands the what is db and etc..
//new SchemaExport(config).create(true, true);
SessionFactory factory = config.buildSessionFactory();
Session session = factory.getCurrentSession();
/*session.beginTransaction();
Room r = new Room();
//ramesh.setEmpId(8634);
r.setName("RameS");
session.save(r);
session.getTransaction().commit();
*/
session.beginTransaction();
Query q = session.createQuery("from Room");
Iterator<Room> itr = (Iterator<Room>)q.iterate();
for(;itr.hasNext();){
System.out.println(itr.next().getName());
}
session.getTransaction().commit();
}
}
this will return the Iterator object
https://bayanlarsitesi.com/
ReplyDeleteEskişehir
Erzincan
Ardahan
Erzurum
GGM
Adana
ReplyDeleteElazığ
Kayseri
Şırnak
Antep
FM2Z1B
whatsapp görüntülü show
ReplyDeleteücretli.show
0Pİ8V
20BA4
ReplyDeleteÜnye Petek Temizleme
Çerkezköy Motor Ustası
Düzce Şehirler Arası Nakliyat
Çankaya Fayans Ustası
Kayseri Lojistik
Ağrı Şehir İçi Nakliyat
Mardin Şehir İçi Nakliyat
Ünye Oto Boya
Maraş Parça Eşya Taşıma
04DEC
ReplyDeleteadıyaman sesli sohbet mobil
Niğde Ücretsiz Sohbet Odaları
kocaeli mobil sohbet sitesi
canli sohbet chat
çorum telefonda kadınlarla sohbet
ağrı telefonda kızlarla sohbet
burdur ücretsiz görüntülü sohbet uygulamaları
Şırnak Sesli Sohbet Sitesi
Hakkari Telefonda Kızlarla Sohbet
6E83C
ReplyDeleteTwitter Retweet Hilesi
Bee Coin Hangi Borsada
Görüntülü Sohbet Parasız
Bonk Coin Hangi Borsada
Mexc Borsası Kimin
Discord Sunucu Üyesi Hilesi
Binance Referans Kodu
Bitcoin Nasıl Çıkarılır
Kripto Para Kazma Siteleri
40DA0
ReplyDeleteSweat Coin Hangi Borsada
Kripto Para Çıkarma
Sohbet
Threads İzlenme Hilesi
Binance Referans Kodu
Youtube İzlenme Hilesi
Coin Kazanma
Sohbet
Likee App Takipçi Hilesi
77FCE
ReplyDeleteavax
dappradar
metamask
raydium
arculus
chainlist
quickswap
sushi
solflare
3D94A
ReplyDeletephantom wallet
dexview
eigenlayer
shapeshift
uniswap
uwulend finance
thorchain
DefiLlama
pinksale
شركة تنظيف بالاحساء VQZoZ3YnGR
ReplyDeleteB1946CE703
ReplyDeleteinstagram takipci organik