This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

2 questions about EJB-QL

 
Edward Chen
Ranch Hand
Posts: 798
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all. I am confusing the EJB-QL.
1. Function is:
public abstract Collection ejbSelectAllMovies() throws FinderException
QL is:
select OBJECT(m) FROM MovieSchema m WHERE m.genre = ?1
actually, in the method, there is NO any parameter, which one is parameter 1 ?
//-----------
2.
QL is
SELECT DISTINCT OBJECT (m) FROM MovieSchema m
Actually what I am confusing is "DINSTINCT". MovieSchema, a database with primary key, is IMPOSSIBLE to contain a same data in a row because of different primary key value.
so, it is resonable to change to this
SELECT DISTINCT m.title FROM MovieSchema m
if the m.title is not primary key.
Am I right?
//-------
Thanks.
Edward
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the method, there is NO any parameter, which one is parameter 1 ?

There has to be a method parameter... In other words, either add a method parameter or hardcode the value of "genre" into the EJB-QL.
[ January 02, 2004: Message edited by: Lasse Koskela ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2.
QL is
SELECT DISTINCT OBJECT (m) FROM MovieSchema m
Actually what I am confusing is "DINSTINCT". MovieSchema, a database with primary key, is IMPOSSIBLE to contain a same data in a row because of different primary key value.
so, it is resonable to change to this
SELECT DISTINCT m.title FROM MovieSchema m
if the m.title is not primary key.
Am I right?

The two EJB-QLs you posted return a different thing (a Movie object versus a String, most likely) so it's really difficult to say whether the change is reasonable or not.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic