Possible bug retrieving single Boolean column [message #635151] |
Mon, 25 October 2010 14:53  |
Eclipse User |
|
|
|
Hi, this is a funny one, when the value of the testBoolean
column for row "testuser" is false this named query
works ok, when it's true I get NoResultException. A bug?
@NamedQuery(name = "User.Test", query = "SELECT u.testBoolean FROM User u WHERE u.userName = ?1"),
...
@Column(name = "testBoolean")
private Boolean testBoolean = false;
Query query = em.createNamedQuery("User.Test");
query.setParameter(1, "testuser");
try {
result = (Boolean) query.getSingleResult();
} catch (NoResultException e) {
result = null;
}
EclipseLink, version: Eclipse Persistence Services - 2.0.1.v20100213-r6600
MySql 5.1.50-community
Regards,
Brendan.
|
|
|
|
|
Re: Possible bug retrieving single Boolean column [message #1461084 is a reply to message #635151] |
Tue, 04 November 2014 02:21  |
Eclipse User |
|
|
|
Good morning together,
so here is a 5 year old thread which fits very good to my own problem, maybe we could restart the conversation about it.
in my oracle database i have a column with the datatype Number(1,0) and its not nullable.
In the code the field is declared like this:
@Column(name = "VO_RELEVANTFLAG", nullable = false)
private boolean voRelevantflag;
My query:
query = entityManager.createQuery("SELECT x.voRelevantflag" //
+ "FROM " + AuBE.class.getSimpleName() );
final Object resultObject = query.getResultList();
Like the creator of this thread i got FALSE if the column is 0 but i got an empty list if the column is 1.
I have updated the columns (switched between 1 and 0) via the oracle sql developer so the value is definitely set and if i execute the sql statement in the sql developer i can see the correct values.
I have tested it with EclipseLink 3.2.0 (which we are currently using) and newer versions like 3.4.0 and 2.6.0-M3 but nothing has changed.
How is this possible? Is this an old bug and noone else cares?
Thank you for you help.
kind regards
Manuel
|
|
|
Powered by
FUDForum. Page generated in 0.08727 seconds