Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Query problem with IS NULL (when asked whether an item is null and also asked his name, the query returns only the values that have the name, null values are omitted, but I also want null values.)
Query problem with IS NULL [message #976921] Thu, 08 November 2012 18:39 Go to previous message
a juan is currently offline a juan
Messages: 2
Registered: November 2012
Junior Member
I have a problem JPQL querying.

when asked whether an item is null and also asked his name, the query returns only the values that have the name, null values are omitted, but I also want null values.

my entities are similar to these.

public class Activity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;

private String info;

@Temporal(javax.persistence.TemporalType.TIMESTAMP)
private Date dateOfEvent;

@OneToOne
private User user;

... getters and setters...

public class User implements Serializable {

private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String username;
private String name;

...getters and setters...

My query is...

SELECT a FROM Activity a WHERE a.user IS NULL OR a.user LIKE :name

For example. If i have

|Activity|
|id,info,user,...|
|1,act1,user1,...|
|2,act2,user1,...|
|3,act3,NULL,...|
|4,act4,user1,...|
|5,act5,NULL,...|

only 1,2 and 4 are return, but i want 3,4 also
 
Read Message
Read Message
Read Message icon10.gif
Previous Topic:JPQL Bug? BigInteger 22 digits (precision=22, scale=0)
Next Topic:Cache Coordination with WebSphere (WAS) v.8
Goto Forum:
  


Current Time: Tue May 21 10:59:50 EDT 2013

Powered by FUDForum. Page generated in 0.01840 seconds