• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Questionsss...

 
Ernest Lee
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • 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?
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic