Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

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.
 
Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic