• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Eliminates Duplicates in List  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Geeks,

Im developing an application using core java MySQL 5.0 & Hibernate 3.2.1. I'm expecting a solution for the following problem

I'm having 2 tables,
1. job, which is master table
2. jobSequence which is detail table

relationship is one-2-many (job to jobSequence)

table data :

JOB
+--------+----------+
| job_id | sequence |
+--------+----------+
| 1 | 152 |
| 2 | 256 |
| 3 | 306 |
+--------+----------+

jobSequence

+-----------+--------+
| JOBSEQ_ID | JOB_ID |
+-----------+--------+
| 1 | 1 |
| 2 | 1 |
| 3 | 2 |
| 4 | 2 |
+-----------+--------+


when i use the following query,

List jobs =
ses.createQuery(" from ImJobs as job " +
"left join fetch job.imJobSequence as imJobSequence where job.jobId = imJobSequence.imJobs.jobId ").list();

I get

+--------+-----------+
| JOB_ID | JOBSEQ_ID |
+--------+-----------+
| 1 | 1 |
| 1 | 2 |
| 2 | 3 |
| 2 | 4 |
+--------+-----------+

My Problem

How can i get the corresponding job sequences from job?

Your assistance is highly appreciated...

Is this infomation sufficient?

Thanks in advance.
 
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Have you tried using



or the
 
author and iconoclast
Posts: 24203
43
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't a Java question, it's a SQL question. I'm moving this to our JDBC forum.

Note that an opener like "Hi Geeks" generally won't win you many friends.
 
Bartender
Posts: 2653
18
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

would give you

Regards, Jan
 
And then we all jump out and yell "surprise! we got you this tiny ad!"
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!