logic: database application/2 (constraints check)


this specific chronicle .

i wish check i am inserting register row. should i check programmatically concentration layer:



if (exists(obj))
{
pitch new duplicateobjectexception();
}
hibernatesessionfactory.getsession().save(obj);


or should i locate difference thrown database covering triggered i violate contraint?



try
{
hibernatesessionfactory.getsession().save(obj);
}
catch(constraintviolationexception e)
{
pitch new duplicateobjectexception();
}


edit: words: nonetheless imprisonment there sojourn (it's good database settlement anyway, i can't certain app wholly accessing table) shall i rest imprisonment hoop difference the defilement raise, i'd improved check anyway?



edit2: impetus i check+insert within transaction, locking list pledge slight minute another record meantime



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members