-->
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: Iteratoring same row in table while retrieving
PostPosted: Tue Jan 22, 2008 6:02 am 
Newbie

Joined: Tue Dec 18, 2007 1:27 am
Posts: 3
I have a table Sub_Fact_Profile in that three columns User_Id,Name and Profile.

[code]User_Id[/code] [code]Name[/code] [code] Profile [/code]

[code]sat[/code] [code]ramu[/code] [code]<?.xml data.?>[/code]
[code]sat[/code] [code]venu[/code] [code]<?.xml data.?>[/code]
[code]sat[/code] [code]mam[/code] [code]<?.xml data.?>[/code]
[code]sat[/code] [code]jasui[/code] [code]<?.xml data.?>[/code]

I am trying to retrieving data from this table using the code shown below

Criteria crit=session.createCriteria(Sub_Fact_Profile.class);
crit.add(Restrictions.like("User_Id",userid));
List ll=crit.list();
for(Iterator it=ll.iterator();it.hasNext();)
{
Sub_Fact_Profile sfp =(Sub_Fact_Profile)it.next();
System.out.println("Name Profile Maneger--"+sfp.getUser_Id());
System.out.println("Name Profile Maneger--"+sfp.getName());
}
session.close();

I am expecting for the same User_Id different Names present in the table but the result i am getting is only first row Name for 4 times while i iterated.

answer i get when i iterated shown below

[code]sat[/code] [code]ramu[/code]

[code]sat[/code] [code]ramu[/code]

[code]sat[/code] [code]ramu[/code]

[code]sat[/code] [code]ramu[/code]

but i want answer like


[code]sat[/code] [code]ramu[/code]

[code]sat[/code] [code]venu[/code]

[code]sat[/code] [code] mam[/code]

[code]sat[/code] [code]jasui [/code]


Can anybody help me whats the wrong i am doing..

thanks in advance
JC


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.