More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. A dirty read occurs when a transaction is allowed to read data from a row that has been modified by another running transaction but not yet committed.
Help us improve. Please let us know the company, where you were asked this question :
Ans. JDBC is a standard Java Api for Database communication whereas Hibernate is an ORM framework that uses JDBC to connect with Database.
Hibernate is another layer of object table mapping over JDBC that provide a database independent, object oriented and an efficient way of database communication.
Help us improve. Please let us know the company, where you were asked this question :
Which of the following is not true for Prepared Statements ?
Prepared Statements provides better performance
Prepared Statements prevent SQL Injection attacks
Prepared Statements provide ORM capabilities
Prepared Statement provides DB side caching
Q55. What are the benefits of using prepared statements ? Does that benefit extend only if similar prepared statements are used within a application or it extends even with multiple applications having similar prepared statement ?
Ans. Prepared Statements helps in reuse of database execution plan which can be cached at Database level and hence helps achieving faster execution and performance. As cached ps objects are creating at Database level and not application level, the use and benefit extends across multiple applications.
Help us improve. Please let us know the company, where you were asked this question :
Null value means that the value is yet to be assigned or need not be assigned whereas empty value means that the blank value has already been assigned once. Null is the default for the null able columns that hasn't be assigned any value.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Application is unable to insert a record as it violates a unique constraint.
The exception states the constraint and Table can be located by the Entity mapping. So I will go to the DB and will first check to which all columns the unique constraint applies. And then I will go and check the code and logs to see how come the duplicate column values were attempted to be inserted when they were not supposed to be.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Unique constraint ensures that a columns or combination or columns are always unique in a table and hence doesn't allow null or duplicates to be entered for the column or combination of columns.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Primary Key constraint means that the column(s) should be unique and doesn't allow null. So Primary key constraint implies unique and not null constraint too.
Unique constraint implies not null constraint too as allowing null would violate uniqueness on those columns.
Help us improve. Please let us know the company, where you were asked this question :
Ans. It's the way for synchronization wherein we can store version information in the table , so that if the same entity is updated by two transactions, the last to commit changes is informed of the conflict, and does not override the other transaction's work.
Help us improve. Please let us know the company, where you were asked this question :
Ans. There is no specific order in which database fires the triggers if they are for the same operation. If we need to have a specific order for their execution, we should have them all in a stored procedure and the procedure should get executed upon the event.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Ternary operator , also called conditional operator is used to decide which value to assign to a variable based on a Boolean value evaluation. It is used as
condition ? value1 : value2
For example
int y = (x > 0) ? x:0; // assign x if it's greater than 0, else assign 0
Help us improve. Please let us know the company, where you were asked this question :