This content has been marked as final.
Show 4 replies
-
1. Re: hibernate , check database before inserting
shravanou May 21, 2010 3:46 PM (in response to abybaby1313)Before persist check for the value if exists in the DB; you can do that by writing a
NativeQuery
. Something like this -'
SELECT COUNT(*) FROM <TABLE-NAME> WHERE <CONDITION--ALL KEYS WHICH DISTINGUISH THE PARTICULAR RECORD SHOULD BE COMING IN HERE>'and check for the count variable if it is more than 1 then there is a value already present in the DB.
Hope this helps
-
2. Re: hibernate , check database before inserting
josdaniel May 25, 2010 6:03 AM (in response to abybaby1313)if you are looking to enforce unique constraints, mark the field as unique to solve this problem
-
3. Re: hibernate , check database before inserting
abybaby1313 May 28, 2010 11:36 AM (in response to abybaby1313)thanks for the reply, i had done this with the help of validator Attribute associated with input field.
-
4. Re: hibernate , check database before inserting
abybaby1313 May 28, 2010 11:38 AM (in response to abybaby1313)sorry for reporting late