I don't know this is already asked or not. But I don't find anyone. (Anyway this is not required for my project. But when I was working with database and Hibernate I had a doubt and now got time to ask here. So I have not tried so far about what I am going to ask here)
Suppose I have table in my database. I want to insert data into the table, but only Unique rows.
How it can be possible?
From, this SO Qestion, i think, we can insert unique rows into databse.
So in Java, Using PreparedStatement
, can we be able to pass the same query so that it will insert rows only if that row is unique in the table?
If it is possible, what ERROR/EXCEPTION, Java will throw?
If not possible, what will be the best way to do so?
And also how about if we are using hibernate? How can we do the same?
If I am passing the bean class object to save the fields, how can I check for Unique rows?
Also how to perform the same with List of Objects?
Hope everyone Understood the situation.