Difference
between Get() and load() ?
ses.get(-,-)
performs early/eager loading of the record
that means it loads record from database table to object irrespective of
whether that object is used in further part of the application or not
ses.load(-,-)
method performs lazy loading of the records
that means Hibernate framework retrives the record from table to object only
where the utilization of the object is started
till that it gives proxy object to application.
ses.get(-,-)
|
ses.load(-,-)
|
1. Performs eager loading of object
2. Does not generate proxy object
3. Involves total one object of domain class in the loading of
record.
4. Suitable to check whether record is available of not
5. Returns null value when record is not available
6. Useful for immediate and granted utilization of record once
the record loaded.
7. Useful in single layer
environment
|
1. Performs lazy loading of object
2. Generates proxy objects
3. Involves total two objects of domain class (one real one proxy
object) in the loading of record.
4. We should use this method by assuming record is available
5. Throws ObjectNotFoundException when record is not available.
6. Useful for delayed of non-granted utilization of the record
once the record is marked.
7. Useful in multilayer environment where the record marked in
one layer will be utilized in another layer.
|
Diffrence
between update() merge() and saveorupdate() ?
ses.update(-)
|
ses.saveOrUpdate(-)
|
ses.merge(-)
|
1. Perform object updating/record updating
2. Updating record without checking the availability of the
record.
3. Generates only update query
4. Generates update query even through object data is matching
that is available in the table.
5. Does not return any object representing the records that has
to be updated.
|
1.
Perform save/insert of
update operations on record
2.
Update insert of updated the record by checking the
availability of record.
3.
Generates select query and insert/update query.
4.
Does not generate update query.
5.
Does not return any object representing the
records that has to be updated.
|
1. Perform
save/insert of update operations on record.
2. Update
insert of updated the record by checking the availability of record
3. Generates
select query and insert/update query.
4. Does not
generate update query.
5. Returns object
representing the record that has to be updated of inserted
|