• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Hibernate: getting same value 3 times

 
Anirban D Jumy
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am developing a small project using Hibernate where I think there was an issue with the mapping. I am using the following tools:
1. Mysql 5.x
2. Eclipse Indigo
3. JRE 7
4. Tomcat 7

Here are my files:

1. hibernate.cfg.xml



2. PojoTestTable.java




3. PojoTestTable.hbm.xml



4. DisplayData.java (Individual Servlet)





5.. in MySQL , table name is: TestTable

fields are: id int (11), fld1 varchar(10), fld2 varchar (10).


When I am running this DisplayData.java servlet, it is fetching first column value 3 times(3 rows are there in the table)...

Please look into it and give me a solution...

Thanks in advance..

Regards,
Anirban
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you edit your post and wrap each code with the code tag? It will be easier to read.

Welcome to Javaranch.
 
Anirban D Jumy
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hebert Coelho,
As per your request, I have edited the post.. Please help me in resolving this issue..

Thank you

Regards,
Anirban
 
Vijitha Kumara
Bartender
Posts: 3909
9
Chrome Fedora Hibernate
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I am running this DisplayData.java servlet, it is fetching first column value 3 times(3 rows are there in the table)...

Can you elaborate this more? Do you get 3 objects returned to the list corresponds to the rows of the table? Or you expected something else?
 
Anirban D Jumy
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vijitha,
Thanks for replying me.

I want the rows to be fetched from the database, not the objects.

Suppose three columns are there id, fld1, fld2
Values are there 123, aaaa, ssss//123, wwww, ddddd// 123, zzzz, rrrrr

Now when runing the program I am getting aaaa, aaaa, aaaa instead of aaaa, wwww, zzzz

Please let me know if you want to know more..

Thanks
Anirban



Vijitha Kumara wrote:
When I am running this DisplayData.java servlet, it is fetching first column value 3 times(3 rows are there in the table)...

Can you elaborate this more? Do you get 3 objects returned to the list corresponds to the rows of the table? Or you expected something else?
 
Ankit Nagpal
Ranch Hand
Posts: 47
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anirban D Jumy wrote:
Suppose three columns are there id, fld1, fld2
Values are there 123, aaaa, ssss//123, wwww, ddddd// 123, zzzz, rrrrr

Now when runing the program I am getting aaaa, aaaa, aaaa instead of aaaa, wwww, zzzz


How can the identifier have same values for 3 different records? Did you check your DB if it has the correct data in the first place?

Ankit
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic