what is the adventage using system.gc() method ?
what is the adventage f annotation in java ?
how can we loads the spring context file ?
what is advantage of spring framework?
what is the bean definatin in spring?
what is earger loading and lazy loading in hibernate ?
Advantage of system.gc():
System.gc() runs the Garbage Collector.The JVM performs this recycling of all discarded obj's even if gc is not invoked explicitly.System.gc() is a static method so it is more convenient to use.
Advantages of Annotations:
1)It has made Enterprise Application Development easy.
2)Annotations are generally used to embed in a program data that would otherwise be furnished in a side file. With annotations, you put the specification information right in your code next to the program element that it affects. This is a more intuitive and convenient approach.
3)Annotations typically contain several optional elements to allow detailed customization of an application.
4)One immediate benefit of annotations for web services is that many formerly required markers, such as the extends java.rmi.Remote and throws java.rmi.RemoteException that were borrowed from remote method invocation (RMI), are no longer necessary.
Java EE 5 platform provides annotations for the following tasks:
Defining and using web services
Developing EJB software applications
Mapping Java technology classes to XML
Mapping Java technology classes to databases
Mapping methods to operations
Specifying external dependencies
Specifying deployment information, including security attributes.
Advantage of Spring Framework:
1)Spring is Lightweight container.
2)No App Server Dependent ? like EJB JNDI Calls.
3)Objects are created Lazily , Singleton - configuration
4)Components can added Declaratively.
5)Initialization of properties is easy ? no need to read from properties file.
6)Declarative transaction, security and logging service - AOP
7)application code is much easier to unit test.
8)With a Dependency Injection approach, dependencies are explicit, and evident in constructor or JavaBean properties.
9)Spring's configuration management services can be used in any architectural layer, in whatever runtime environment.
10)Spring can effectively organize your middle tier objects.
11)Not required special deployment steps.
Eager and Lazy loading:
lazy loading means that any foreign key references that you have in you table will be loaded only when referred to by the application. Eager loading means everything will be loaded at once.
Hibernate adopts the mechanism of lazy loading to load objects from databases. Lazy loading contributes a lot to improve the performance of an application by limiting the amount of objects that will be needed.
Eager loading loads the full objects tree once. Because eager loads multiple related objects with a single SELECT statement instead of using multiple SELECT statements, therefore in some situations, eager loads can also improve the performance of the application by reducing the times of accessing the database.