0% found this document useful (0 votes)
28 views2 pages

Explain J2EE Architectures

J2EE provides many architectural choices like servlets, EJBs, JSP pages, and filters, as well as services from application servers, but this flexibility also poses dangers if not implemented properly. Hibernate objects exist as persistent, detached, or transient depending on their association with an Hibernate session - persistent objects are associated with a session and synchronize with the database, detached objects were associated but now can be used as DTOs, and transient objects were never associated with a session.

Uploaded by

srinivassrinu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

Explain J2EE Architectures

J2EE provides many architectural choices like servlets, EJBs, JSP pages, and filters, as well as services from application servers, but this flexibility also poses dangers if not implemented properly. Hibernate objects exist as persistent, detached, or transient depending on their association with an Hibernate session - persistent objects are associated with a session and synchronize with the database, detached objects were associated but now can be used as DTOs, and transient objects were never associated with a session.

Uploaded by

srinivassrinu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Explain J2EE Architectures?

Java Stuff No comments J2EE provides many architectural choices. J2EE also offers many component types (such as servlets, EJBs, JSP pages, and servlet filters), and J2EE application servers provide many additional services. While this array of options enables us to design the best solution for each problem, it also poses dangers.

Hibernate objects life cycle


Java Stuff No comments Persistent objects and collections are short lived single threaded objects, which store the persistent state. These objects synchronize their state with the database depending on your flush strategy (i.e. auto-flush where as soon as setXXX() method is called or an item is removed from a Set, List etc or define your own synchronization points with session.flush(), transaction.commit() calls). If you remove an item from a persistent collection like a Set, it will be removed from the database either immediately or when flush() or commit() is called depending on your flush strategy. They are Plain Old Java Objects (POJOs) and are currently associated with a session. As soon as the associated session is closed, persistent objects become detached objects and are free to use directly as data transfer objects in any application layers like business layer, presentation layer etc. Detached objects and collections are instances of persistent objects that were associated with a session but currently not associated with a session. These objects can be freely used as Data Transfer Objects without having any impact on your database. Detached objects can be later on attached to

another session by calling methods like session.update(), session.saveOrUpdate() etc. and become persistent objects. Transient objects and collections are instances of persistent objects that were never associated with a session. These objects can be freely used as Data Transfer Objects without having any impact on your database. Transient objects become persistent objects when associated to a session by calling methods like session.save( ), session.persist( ) etc.

You might also like