-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate return wrong no. of rows
PostPosted: Fri Feb 10, 2006 7:18 pm 
Newbie

Joined: Fri Jun 24, 2005 6:04 am
Posts: 14
Hibernate version:
Hibernate 3.05

Mapping documents:
<hibernate-mapping package="maxicom.mhbiler.hibernate">

<class name="Product" table="product">
<id name="recordid" column="recordid" type="java.lang.Long">
<generator class="increment"/>
</id>

<property name="headline" column="headline" type="java.lang.String" />
<property name="price" column="price" type="java.lang.String" />
<property name="text" column="text" type="java.lang.String" />
<property name="image" column="image" type="java.lang.String" />
<property name="menurecordid" column="menurecordid" type="java.lang.Long" />
</class>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Session session = (Session) HibernateSessionFactory.currentSession();

Query qry = session.createQuery("from Product");
List product = qry.list();
session.close();
return product;


Full stack trace of any exception that occurs:
There is no exception!

Name and version of the database you are using:
MySQL version 4.0.21
Tomcat v.5


The generated SQL (show_sql=true):
select product0_.recordid as recordid, product0_.headline as headline1_, product0_.price as price1_, product0_.text as text1_, product0_.image as image1_, product0_.menurecordid as menureco6_1_ from product product0_

The problem in plain word:
As you can read in above im trying to get all rows out from Product. And its there where it is going insane, becouse sometimes i only get 2 rows (there is 3!) and sometimes i get all 3. If i restart my Tomcat and refreshing the webpage several times then it 99,9% of the times return all 3 rows, but when i then make a new post then it screw up again and very, very often only show the old amount of data, before the creation of the 4. row - eg. it only show 3 rows.

I have tryed to setup a remote debug with my Tomcat on my server and connect it to Eclipse. And when i debug i see in the List that is returned from the query in Product that the no of items in the List is the same that is printed out.
So my conclusion is that somewhere in the path from my Product to Hibernate and return it goes wrong. But what i cant figure out is why it goes wrong!
The above sql statement is used in the admin part of the website, but its exactly the same problem in the user part of the website.
I have tryed to search the forum, but its difficult for me, since i dont know what word to search after :)
I would *really* preciate some help, i have tryed many things and have read a lot about hibernate by now, but i could not find a solution :(

Greetings from Denmark
Bjarne Pedersen


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 11, 2006 5:36 am 
Newbie

Joined: Fri Feb 10, 2006 5:48 am
Posts: 7
I have the same problem of what u r saying .
Already a thread is opened for this issue.

Plz can u join into the following thread ...

http://forum.hibernate.org/viewtopic.php?t=955385
subject : Data Persistance Issue


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 11, 2006 6:01 am 
Newbie

Joined: Fri Jun 24, 2005 6:04 am
Posts: 14
Thx, for your advise. Ill def. do that!
And sorry for not seing your post, but i have some problem with the right terms in english, so it sometimes difficult for me to search the forum

Bjarne


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