Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ejb query language ...

 
Salah Lejmi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Where is the SELECT ?
 
Salah Lejmi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 580
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :

 
Salah Lejmi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this problem is listed in the unconfirmed errata. (171)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic