JDeveloper, JPA named query String parameter with length of 1
810946Nov 8 2010 — edited Nov 10 2010Hi,
I use JDeveloper 11.1.1.2.0. and have the following table:
CREATE SEQUENCE COUNTRY_SEQ;
CREATE TABLE COUNTRY (
COUNTRY_ID NUMBER NOT NULL,
COUNTRY_NAME VARCHAR2(40),
COUNTRY_CODE CHAR(2) NOT NULL,
CONSTRAINT COUNTRY_ID_PK PRIMARY KEY (COUNTRY_ID)
);
INSERT INTO COUNTRY VALUES (COUNTRY_SEQ.NEXTVAL, 'Belgium', 'B');
INSERT INTO COUNTRY VALUES (COUNTRY_SEQ.NEXTVAL, 'Netherlands', 'NL');
COMMIT;
I made a JPA Entity with two queries:
@NamedQueries({
@NamedQuery(name = "Country.findAll", query = "select o from Country o"),
@NamedQuery(name = "Country.findByCountryCode", query = "select o from Country o where o.countryCode = 'B' or o.countryCode ='NL'")
})
The first works fine, gives back both B and NL. But the second gives back only NL. I have no clue why.
If I change 'B' to 'BE' both in the DB and the code, it works. If I change to 'b', it doesn't. So it seems that the problem comes with 1 char long Strings.
Is it an EclipseLink bug?
I use Oracle Database 11g Enterprise Edition Release 11.1.0.7.0. But
SELECT COUNTRY_ID, COUNTRY_NAME, COUNTRY_CODE FROM COUNTRY WHERE COUNTRY_CODE = 'B' OR COUNTRY_CODE = 'NL';
works in SQL*Plus.
Thx, Donat