• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Questionsss...

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. The Spec says "EJB QL only permit like type values to be compared" (P.235)

what does it mean?

2. the spec also says it does not support fixed decimal comparsion, does it mean it cannot do

where ?1 > 1.444?
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ernest,

1. The Spec says "EJB QL only permit like type values to be compared" (P.235)

what does it mean?



It becomes a little clearer when you read the whole paragraph:

Specs, section 11.2.10, pg 235:
EJB QL only permits like type values to be compared. There is one exception to this rule: it is valid to
compare exact numeric values and approximate numeric values (the rules of Java numeric promotion
define the required type conversion). Conditional expressions attempting to compare non-like type values
are disallowed except for this numeric case.



I think it means that strings can only be compared to strings, dates to dates, etc..., with the exception about exact vs approximate numeric values which can be compared.

2. the spec also says it does not support fixed decimal comparsion, does it mean it cannot do

where ?1 > 1.444?



I don't think so.

Specs, section 11.2.11, pg 235:
Although SQL supports fixed decimal comparison in arithmetic expressions, EJB QL does not. For this
reason EJB QL restricts exact numeric literals to those without a decimal point (and numerics with a
decimal point as an alternate representation for approximate numeric values).



1.444 simply cannot be considered by EJB-QL - whatevee the underlying SQL type in the database - as an exact numeric literal. So it will be taken as an approximate numeric value and handled as such (see section 11.2.10 described above).

Regards,

Phil.
 
reply
    Bookmark Topic Watch Topic
  • New Topic