|
Generated by JDiff |
||||||||
PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES |
This file contains all the changes in documentation in the packagecom.google.inject.persist
as colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.
Apply this filter to enable the HTTP Request unit of work and tohavehave guice-persist managethethe lifecycle of active units of work.The filter automatically starts and stops the relevant PersistServiceupon javax.servlet.Filter.init(javax.servlet.FilterConfig)andand javax.servlet.Filter.destroy() respectively.
To be able to use the open session-in-view pattern (i.e. work per request),registerthisthis filter once in your Guice {@code ServletModule}. Itisis important that you registerthisthis filter before any other filter.For multiple providers, you should register this filter once per provider,
insideinside aprivateprivate module for each persist module installed (this must be the sameprivateprivate module where thespecificspecific persist module is itself installed).
Example configuration:{@codepublic class MyModule extends ServletModule {public void configureServlets() {filter("/*").through(PersistFilter.class);serve("/index.html").with(MyHtmlServlet.class);// Etc.}} }
This filter is thread safe and allows you to create injectorsconcurrentlyconcurrently and deploymultiplemultiple guice-persist modules within the same injector, oreveneven multiple injectors with persistmodulesmodules withing the same JVM or web app.
This filter requires the Guice Servlet extension. @author Dhanji R. Prasanna (dhanji@gmail.com)
Install this module to add guice-persist library support for JPApersistencepersistence providers. @author dhanji@gmail.com (Dhanji R. Prasanna)
Persistence provider service. Use this to manage theClass PersistService, void start()overalloverall startup and stop of thepersistencepersistence module(s).TODO(dhanji): Integrate with Service API when appropriate. @author dhanji@gmail.com (Dhanji R. Prasanna)
Starts the underlying persistence engine and makes guice-persist readyClass PersistService, void stop()forfor use. For instance, with JPA, it creates an EntityManagerFactory andmaymay open connection pools. This method mustbebe called by your code priortoto using any guice-persist or JPA artifacts. If already started, calling this method does nothing, if already stopped, it alsodoesdoes nothing.
Stops the underlying persistence engine. For instance, with JPA,itit closes the {@codecode EntityManagerFactory}. If already stopped, callingthisthis method does nothing. If notyetyet started, it also does nothing.
Any method or class marked with this annotation will be considered for transactionality.ConsultConsult the documentation on https://github.com/google/guice/wiki/GuicePersist fordetaileddetailed semantics. Marking a method {@code @Transactional} will start a new transaction before themethod executesmethod executes and commit it after the method returns.
If the method throws an exception, the transaction will be rolled back unlessyouyou have specifically requested not to in the .ignore() clause.
Similarly, the set of exceptions that will trigger a rollback can be definedinin the .rollbackOn() clause. By default, only unchecked exceptions triggeraa rollback. @author Dhanji R. Prasanna (dhanji@gmail.com)
This interface is used to gain manual control over the unit of work. This is mostly toClass UnitOfWork, void begin()dodo workinin non-request, non-transactional threads. Or where more fine-grained control over theunitunit ofworkwork is required. Starting and ending a unit of work directly corresponds to openingandand closingaa {@code Session}, {@code EntityManager} or {@code ObjectContainer} respectively.The
TheUnit of Work referred to by UnitOfWork will always be local to the calling thread.BeBe carefultoto end() in a finally block. Neither JPA, nor Hibernate supports threadsafesessionssessions (reasoningreasoning behind thread-locality of Unit of Work semantics).@author Dhanji R. Prasanna (dhanji@gmail com)
- Using UnitOfWork with the PersistFilter inside a request is not recommended.
- Using UnitOfWork with session-per-txn strategy is not terribly clever either.
- Using UnitOfWork with session-per-request strategy but *outside* a request (i.e. in a
background or bootstrap thread) is probably a good use case.
Starts a Unit Of Work. Underneath, causes a session to the data layer to be opened. IfClass UnitOfWork, void end()there isthere is already one open, the invocation will do nothing. In this way, you can define arbitrary units-of-work that nest within one another safely.Transaction semantics are not affected.
Declares an end to the current Unit of Work. Underneath, causes any open session to the data layer to close. If there is no Unit of work open, then the call returns silently. You can safely invoke end() repeatedly.
Transaction semantics are not affected.