JEE

Two options for fetching data are possible: FetchType.EAGER and FetchType.LAZY. Collections are loaded EAGER when they are fetched fully at the time their parent is fetched. That is, with nested classes the whole class hierarchy is fetched, even if all the subentities (children) are not needed.

With the LAZY option, data is loaded on-demand, e.g. when a certain entity is requested explicitly. Thus, when the parent entity is loaded with the lazy option, the children entities are not loaded per default. Only in case they are really needed (e.g. a certain method was called via GUI).
Here is an example how entities are marked to be loaded lazily:

@Entity
public class Parent {

@Id
private String id;

private String name;

@OneToMany(fetch = FetchType.LAZY)
private List children;

// etc.
}

Technology:

Bad performance with nested classes and large amount of data when using Hibernate

In my JEE application, I am using the Hibernate framework as the ORM mapper. Initially, the performance was very good. However, as more and more data is gathered during the lifetime of the application, the performance is getting worse and worse. The data model is rather complicated, and the entities are nested. Are there configuration options, that could help to improve the performance?

Configuration of a database connection in a JEE application

I intend to create a JEE application with tomcat as the webcontainer. I will use postgresql as a database, and will use Eclipse as IDE. Where can I configure how to access the database?
Subscribe to JEE