• Post Reply Bookmark Topic Watch Topic
  • New Topic

Many to Many relationship Mapping  RSS feed

 
Akanksha Bhatnagar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can sumbuddy tell me my sql query where it is wrong
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Akanksha Bhatnagar wrote:can sumbuddy tell me my sql query where it is wrong

Well, apart from the fact that it has two "from"s in it, not much, because you haven't given us much to work with.

Next time: TellTheDetails (←click).

Also: We don't need all that other code, since the problem is only with your select statement; but we do need the EXACT error message (if any) that you got when you tried to run it.

Asking questions takes a bit of practise. I suggest you look at this page, this one, and also our own HowToAskQuestionsOnJavaRanch (←click), because you're much more likely to get good answers if you ask good questions.

PS: This doesn't appear to have anything to do with "many to many", since your select is a simple join.

HIH

Winston

PPS: Your code lines are far too long, and it makes your thread very difficult to read. You might want to use the 'Edit' button to break them up a bit.
 
Akanksha Bhatnagar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok i got the result...just one thing more i need to ask that this is my arraylist and i need to know the correct syntax for getting the values from resultset of arraylist...
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Akanksha Bhatnagar wrote:ok i got the result...just one thing more i need to ask that
...
this is my arraylist and i need to know the correct syntax for getting the values from resultset of arraylist...

Well, first off, there is no such thing as a "resultset of arraylist". Lists have elements and, while your code is a bit tortuous, I don't see anything essentially wrong with the List calls.

I assume you realise, however, that your code will get SIX objects from your ResultSet. Java indexes are 0-based.
And, since you never advance the ResultSet, they will all be from the same row.

Also: You're making life difficult for yourself by having a ResultSet called 'j' and an index called 'z'. Part of the art of programming is to make things clear; not just for other people that have to read it, but also for you when you come back in a few months time and go: "What the hell was I doing here?"

Winston
 
Akanksha Bhatnagar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry to say but actually you are rude with your words...fine !!
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Akanksha Bhatnagar wrote:sorry to say but actually you are rude with your words...fine !!


Winston was not being rude. There was no personal attack in his words, and everything he said was constructive criticism that included both areas of your code that could be improved and also the reason why he thought those improvements would be useful. Criticism is not rude, it's the only way we can learn and improve.
 
Akanksha Bhatnagar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
k
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!