-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate not reading the database
PostPosted: Wed Apr 26, 2006 3:53 pm 
Beginner
Beginner

Joined: Thu Mar 09, 2006 1:45 pm
Posts: 26
I am having trouble with Hibernate reading an Oracle database table.

I have created a sql script to create and populate a table that will be used to configure my software.

While testing to see if Hibernate will get any data from the table, I have noticed that if I input data into the table using hibernate, I can get this data back out using hibernate.

Any data inserted from the sql script will not be read by hibernate.

I have checked the config.hbn.xml file and Config.java class.

Like I said, it works when I have inserted data using hibernate, but not data I put in with a script.

The primary key is a long and the database the key is a number( 38, 0 )

The code I used is something like this -


Session s = factory.openSession();
try {

String SQL_QUERY = "from Config config";
Query query = s.createQuery(SQL_QUERY);
for (Iterator it = query.iterate(); it.hasNext();) {
Config con = (Config ) it.next();
System.out.println(": " + con.toString());
}

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

s.close();



Any ideas would be appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 4:06 pm 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
Are you sure that the SQL script you are using is connecting to the same oracle database, the hibernate application is connecting to?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 4:43 pm 
Beginner
Beginner

Joined: Thu Mar 09, 2006 1:45 pm
Posts: 26
Yes I am pretty sure.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 5:08 pm 
Beginner
Beginner

Joined: Thu Mar 09, 2006 1:45 pm
Posts: 26
This was not a hibernate problem. My scripts were running, but I did not have commit at the end of them so oracle was not done saving the data to the tables.

thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.