Hi everybody
How can i select the objects where a property is null? I have a Category table:
* Id, int
* Name, varchar
* Parent, int
The parent field makes the relation between the present category and its parent, if it has one. If the category is a root category that value should be null. So how can i select all categories that have not parent, i.e. those rows where parent is null?
thanks in advance.
Code:
@Entity()
@Table(name = "Categories")
public class Category implements Serializable {
@Id
@Column(name = "id")
private String id;
@Column(name = "name")
private String name;
@OneToMany(mappedBy="parent")
private List<Category> children;
@ManyToOne
@JoinColumn(name="parent")
@NotFound(action=NotFoundAction.IGNORE)
private Category parent;
}
Hibernate version: 3.2
Name and version of the database you are using: HSQLDB, 1.8.0.7