These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Mit Hibernate Daten entsprechend Vorgabe holen?
PostPosted: Wed Jan 17, 2007 10:13 am 
Newbie

Joined: Thu Nov 23, 2006 11:08 am
Posts: 14
hallo, ich habe eine tabelle mit 25 spalten. ich moechte jetzt daten aus dieser tabelle holen und zwar anhand von 3 werten dieser tabelle, die ich uebergebe an eine methode. wie mach ich das aber dann mit hibernate? ich habs jetzt so.

Code:
public List getMotor(String type, String marke, String beschreibung) throws BaatkatalogenException{
   
   Session session = HibernateUtil.getSessionFactory().getCurrentSession();
   session.beginTransaction();
   Criteria criteria = session.createCriteria(MotorData.class);
   //?????????????
   
   return criteria.list();

    }


ich moechte also eine liste mit motoren, die eben die 3 attribute haben. sone art AND?

vielen dank fuer die hilfe :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 18, 2007 10:03 am 
Beginner
Beginner

Joined: Thu Jun 30, 2005 4:20 am
Posts: 40
Location: Vienna
Hallo,
bin nicht sicher ob ich dich richtig verstehe, aber meinst du das:
criteria.add(Restrictions.eq("marke", marke));
etc...

--> Details siehe Hibernate Reference oder Java Persistence with Hibernate

lg
Stefan


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.