-->
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: Grundlage Einfach Tabelle ausgeben / auslesen
PostPosted: Sun Nov 07, 2010 11:39 pm 
Newbie

Joined: Sun Nov 07, 2010 11:28 pm
Posts: 1
Hallo,
bin Anfänger und habe folgendes Problem. Habe Daten eingelesen und in einer DB (H2) gespeichert. Versuche jetzt mit einer Methode die Daten auszulesen. DB heisst SystemEntry, ,Atrribute sind die Ipadresse (String) und timestamp (Timestamp) die gemappte Klasse heisst SystemEntry. Habe Annotations benutzt.

Versuche es mit :

import org.hibernate.Session;
import org.hibernate.*;
import org.hibernate.cfg.*;

import java.util.*;


public class HQLExample {

public static void main(String[] args) {
Session session = null;

try{

SessionFactory sessionFactory = new
AnnotationConfiguration().configure().buildSessionFactory();
session =sessionFactory.openSession();

String SQL_QUERY ="from SystemEntry";
Query query = session.createQuery(SQL_QUERY);
for(Iterator it=query.iterate();it.hasNext();){
SystemEntry entry=(SystemEntry)it.next();
System.out.println("IP: " +
entry.getIp());
System.out.println("Time: " + entry.getTimestamp());
}

session.close();
}catch(Exception e){
System.out.println(e.getMessage());
}finally{
}

}
}

Bitte helft mir. Bin für jede Rat oder Alternative dankbar.


Top
 Profile  
 
 Post subject: Re: Grundlage Einfach Tabelle ausgeben / auslesen
PostPosted: Tue Nov 16, 2010 10:24 am 
Beginner
Beginner

Joined: Fri Aug 24, 2007 4:46 am
Posts: 36
Location: Bielefeld / Germany
Hi!

Mir ist nicht ganz klar, was genau dein Problem ist. Kannst Du das etwas genauer beschreiben? Evtl. auch mal die Klassen samt Annotationen posten sowie die Config-Files. Dann sieht man meistens schneller, wo das Problem liegt.

Grüße, Maik

_________________
jease.org - Java with Ease


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.