-->
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: org.hibernate.Query list()
PostPosted: Fri Jul 28, 2006 11:47 am 
Newbie

Joined: Fri Jul 28, 2006 11:22 am
Posts: 4
Hallo!

Hätte eine Frage zu der list() Funktion welche ich auf ein org.hibernate.Query Objekt anwenden will.


Code:
public List getTranslationStringFor(MyObject object) throws InfrastructureException {
        List queryResult = null;
        try {
            org.hibernate.Session sess = HibernateUtil.getSession();
            String statement = getStatement("MyStatement",
                                            new Object[] {
                                                object.getType(), object.getUniqueId()}
                                            );
            org.hibernate.Query query = sess.createQuery(statement);

            queryResult = query.list();

            }
} catch (HibernateException e) {
            throw new InfrastructureException(e);
        }
        return queryResult;

public String getStatement(String which, Object[] arguments) {
        return MessageFormat.format(getStatement(which), arguments);
    }



object.getType() und object.getUniqueId() liefern jeweils einen String zurück.

Nachdem query.list(); angestossen wird, werden verschiedene get() Methoden von anderen Klassen ausgeführt was ich mir nicht erklären kann, da diese Klassen in diesem Codesegment nicht erwähnt werden.

--> Woher bezieht Hibernate die Information, dass die Methoden von diesen Klassen abzufragen sind??

Vielen Dank schon mal!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 08, 2006 3:55 pm 
Newbie

Joined: Thu Jun 22, 2006 2:00 am
Posts: 4
Hmm, ich weiß nicht, auf welche Objekte sich Deine
Frage bezieht. Ansonsten zieht hibernate aus den jeweiligen
Mapping-Files die nötigen Informationen. Der Rest geht über Reflection.


MfG,
rp


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.