What is callable in Java? How different is it from Runnable?
public interface CallableV>
A task that produces a result and has the potential to throw an exception. Call(), a single method with no arguments, is defined by implementers.
Method Detail:
- Transient state
- Persistent state
- Detached state
- Removed state
Transient state
Then that object is called a "transient object. Hibernate does not maintain or manage entities.
The state of that object is called the "transient state," and the object does not contain any primary key or identity.
Persistent State
Persistent entities exist in the database, so hibernate manages the persistent objects.
The state of that object is called the persistence state, and that object contains an identity or primary key.
Any modification made to the persistence object will be reflected in the database.
Detached State
Detached objects exist in the database but are not maintained by Hibernate.
The state of that object is called the detached state, and the object contains an identity or primary key.
A detached entity can be created by closing the session associated with it or by calling the evict() method.
Removed State
When the persistence class object is removed from the database that is being managed by Hibernate, those objects are called "removed objects.
And we have to pass the remove() method to the session, and the state of that object is called the removed state.
Interview Questions:
- There are many ways to create a thread, and which is the best option to create a thread and explain it with a scenario?
- When we trigger the Java command, how many threads are going to be created? explain it?
- How do I change the main thread priority? What are min, norm, and max priority?
- Explain wait(), notify(), and notifyAll()?
- How does multithreading work? What is the purpose of multithreading?