GeeCON Prague 2014*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Inner Join Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Inner Join" Watch "Inner Join" New topic
Author

Inner Join

Deepika Joshi
Ranch Hand

Joined: Feb 24, 2009
Posts: 268
EJB 3 in Action, page 377

Category & User entities have many-to-one association. To retrieve all user that match a specific criterion we could try this query:




I think its correct in book.... there is no way to delete the post... so please ignore this doubt....
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
Deepika,

It is a poorly constructed inner join example. The inner join in this case really serves no function. This is in my list to fix for the second edition.

Thanks,
Reza


Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936

Just want to make it clear. Should "u.Category c" be "Category c"?
Or "u.Category c" is correct syntax?

But why don't you use "u.category c"? (I guess category is a property of User entity).


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Deepika Joshi
Ranch Hand

Joined: Feb 24, 2009
Posts: 268
Just want to make it clear. Should "u.Category c" be "Category c"?
Or "u.Category c" is correct syntax?

But why don't you use "u.category c"? (I guess category is a property of User entity).

I had the same doubt & finally imagined that Category is property of User.... (as in description it says Many-to-One relationship in Entities)
(for author) No offense, but JPQL examples could b easy to understand if corresponding (native) SQL is also given in the book....
I have completed the chapter (JPQL) but I do not have confidence, is there any link for JPQL for some other source.....


thanks...
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
Deepika,

There is no offense taken. I don't think the JPQL chapter is particularly strong either. You could try the Mike Keith book centered on JPA only.

Regards,
Reza
 
GeeCON Prague 2014
 
subject: Inner Join