Help coderanch get a
new server
by contributing to the fundraiser
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

ejb query language ...

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Where is the SELECT ?
 
Salah Lejmi
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author
Posts: 580
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this problem is listed in the unconfirmed errata. (171)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic