-->
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.  [ 1 post ] 
Author Message
 Post subject: bei select anweisung erhalte ich update-anweisungen
PostPosted: Sat May 28, 2011 2:47 pm 
Newbie

Joined: Sat May 28, 2011 2:33 pm
Posts: 1
Hallo Zusammen

Bin mein erstes Java-Projekt am realisieren. Somit meine erste Erfahrung mit OOP und gleichzeitig ORM.
Mein Prblem ist, dass ich nun bei einer SELECT-Anweisung gleichzeitig 3 UPDATE-Anweisungen (im Output) erhalte. Dies irritiert mich, kann es mir jedoch nicht erklären. Auch google (sofern ich richtig gesucht habe) konnte mir nicht helfen. Daher wende ich mich an Euch Profis, ob beim coden einen Fehler oder sonst wo einen Überlegungsfehler mache!

Rahmenbedingung:
- Native Hibernate APIs mit hbm.xml Mappings
- Tomcat mit JSP (JSTL) als Webanwendung
- hibernate.cfg.xml ist vorhanden und korretk (in die DB kann ich schreiben)
- *.hbm.xml-Mapping ist vorhanden und korrekt (in die DB kann ich schreiben)
- pro Tabelle habe ich eine Klasse

Um die Übersicht zu behalten poste ich nur den kritischen Code:
Code:
    public List getUsers(){
        Session session = null;
        Transaction trx = null;
        try{
            this.setUp();
            session = sessionFactory.openSession();
            trx = session.beginTransaction();
            List result=session.createQuery("from UserDataBean").list();
            trx.commit();
            return result;
        } catch (HibernateException ex) {
            if (trx != null) try {
                trx.rollback();
                return null;
            } catch (HibernateException exRb) {}
            throw new RuntimeException(ex.getMessage());
          } finally {
              try {
                  session.close();
              } catch (Exception exCl) {
              }
          }
    }


Entsprechender Output im "Tomcat 6.0 Localhost":
Code:
28.05.2011 20:21:36 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
Hibernate: select userdatabe0_.userid as userid2_, userdatabe0_.email as email2_, userdatabe0_.firma as firma2_, userdatabe0_.password as password2_, userdatabe0_.name as name2_, userdatabe0_.vorname as vorname2_, userdatabe0_.adresse as adresse2_, userdatabe0_.plz as plz2_, userdatabe0_.ort as ort2_, userdatabe0_.activationkey as activat10_2_, userdatabe0_.status as status2_ from userdata userdatabe0_
Hibernate: update userdata set email=?, firma=?, password=?, name=?, vorname=?, adresse=?, plz=?, ort=?, activationkey=?, status=? where userid=?
Hibernate: update userdata set email=?, firma=?, password=?, name=?, vorname=?, adresse=?, plz=?, ort=?, activationkey=?, status=? where userid=?
Hibernate: update userdata set email=?, firma=?, password=?, name=?, vorname=?, adresse=?, plz=?, ort=?, activationkey=?, status=? where userid=?
28.05.2011 20:21:36 org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
28.05.2011 20:21:36 org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured


Danke für Eure Hilfe & Rückmeldung.
Gruss, Quatsch


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

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.