What does hibernate uses reflection API for?
- Hibernate uses reflection extensively under the hood to map Java objects to Database tables And vice versa.
In hibernate, how can we get data from the database?
- We can get using session object.
- The methods are get and load.
- We have a query and criteria interfaces Based on which we can get the object.
What methods are available to get data from database in hibernate?
- We have system object via which we can get data from database.
- Methods are get and load.
- We have query and criteria interfaces to get an object.
- Load method with a specifier returns, a proxy object of that entity.
- When we perform a method, it goes to database and get the actual data.
What is the difference between get and load?
- When we use the load method with any specifier, it will not give you actual object, but proxy object.
- When we use get method, it will go to database and Fire native query To get actual data.
What are the three states of hibernate entity?
- New or transient, attached, rested or detached state.
- When an object is not attached With any Session, it is just created. It is in New or transient state.
- Not yet attached with session.
- If an object is associated with Session, then it is said to be in attached state.
- Once we perform any operations and commit, it is again not held by any session. It is in detached state.
No comments:
Post a Comment