Hi everybody,
This may be the easy question for many of you but not for me :)
I have some POJO class with an id attribute. For example
public class Continent {
private String continentName;
private Long id;
public Continent() {
}
public String getContinentName() {
return continentName;
}
public void setContinentName(String val) {
this.continentName = val;
}
public Long getId() {
return id;
}
private void setId(Long val) {
this.id = val;
}
}
Before I save this object into database, I want to check if object is already in database (saved). Is there any easy way of getting this information?
It depends on that information if object is to be saved or not, because I want to obtain an UNIQUE constraint in my database.
Please help me
Regards
|