| Author |
ejb query language ...
|
Salah Lejmi
Greenhorn
Joined: Jul 25, 2008
Posts: 22
|
|
hi, i have an entity session bean (service bean) with following method: The Cabin class is defined as follows: I am getting following console output Anyone knows why the query with ejb-syntax does not work? [ October 31, 2008: Message edited by: Salah Lejmi ]
|
SCJP 5.0 (95%), SCWCD 5.0 (98%)<br />Salah Lejmi
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
Where is the SELECT ?
|
[My Blog]
All roads lead to JavaRanch
|
 |
Salah Lejmi
Greenhorn
Joined: Jul 25, 2008
Posts: 22
|
|
Originally posted by Christophe Verre: Where is the SELECT ?
i read this syntax in the oreilly book. i tried also with "select from ..." and "select * from ..." but still getting error message. how would you write the query in the ejb-syntax ? [ October 31, 2008: Message edited by: Salah Lejmi ]
|
 |
Reza Rahman
author
Ranch Hand
Joined: Feb 01, 2005
Posts: 559
|
|
Salah, Are you using EJB 3 remoting by accident or on purpose? The problem you are having indicates an RMI connectivity issue, possibly because of a firewall, but it could also be some kind of weird network misconfiguration. The "from" syntax definitely won't work unless you are using Hibernate. Even then, it's not a good idea...I am shocked the Bill Burke book would include such code. I certainly did not catch that when I read it myself. The code you have posted is fine otherwise. The problem is elsewhere. Thanks, Reza P.S.: What you are using is called JPQL, not "EJB query language". That refers to EJBQL in EJB 2.x Entity Beans. [ October 31, 2008: Message edited by: Reza Rahman ]
|
Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8147
|
|
Originally posted by Reza Rahman: I am shocked the Bill Burke book would include such code. I certainly did not catch that when I read it myself.
This example seems to be specifically for demonstrating how to use native queries, so looks valid :
|
[My Blog] [JavaRanch Journal]
|
 |
Salah Lejmi
Greenhorn
Joined: Jul 25, 2008
Posts: 22
|
|
Originally posted by Reza Rahman: Salah, Are you using EJB 3 remoting by accident or on purpose? The problem you are having indicates an RMI connectivity issue, possibly because of a firewall, but it could also be some kind of weird network misconfiguration. The "from" syntax definitely won't work unless you are using Hibernate. Even then, it's not a good idea...I am shocked the Bill Burke book would include such code. I certainly did not catch that when I read it myself. The code you have posted is fine otherwise. The problem is elsewhere. Thanks, Reza P.S.: What you are using is called JPQL, not "EJB query language". That refers to EJBQL in EJB 2.x Entity Beans. [ October 31, 2008: Message edited by: Reza Rahman ]
First of all, thank you much for the reply. Second, it was in fact in the oreilly book in many sections: - 9.1. Query API: - 25.1.6. FlushModeType Behavior - I saw it also elsewhere in the book but it is as you said not a valid syntax for JPQL (thank you for the explanation) and because it was a bit strange to me, i looked in the unconfirmed errata of this book. And in fact it was inside as a mistake. (because of this mistake so much trouble and testings but anyway, i am learning ). The unconfirmed errata text contains the right answer: I tested this syntax and it worked fine. Thank you all for your help. [ October 31, 2008: Message edited by: Salah Lejmi ]
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
|
I think this problem is listed in the unconfirmed errata. (171)
|
 |
 |
|
|
subject: ejb query language ...
|
|
|