Thanks for your response. I realized my mistake. I was injecting and entityManagerFactory and then calling getEntityManager() instead of injecting the entitymanager provider.
It works now. Regards. Josh. On Thu, Jul 22, 2010 at 12:34 AM, Dhanji R. Prasanna <[email protected]>wrote: > Are you marking methods @Transactional and can you verify that the > transaction interceptor is running? > > Dhanji. > > On Wed, Jul 21, 2010 at 6:17 PM, Josh Kamau <[email protected]> wrote: > >> Hello; >> >> I am using guice and warp persist for transactions with JPA hibernate >> implementation. I noticed that the transactions are not committing . If i >> call the entitymanager.getTransaction().begin() and .commit(), it works. >> What am i doing wrong with warp-persist? Below my warp persist code samples >> >> 1. web.xml configuration >> >> <filter> >> <filter-name>warpFilter</filter-name> >> >> <filter-class>com.wideplay.warp.persist.PersistenceFilter</filter-class> >> </filter> >> >> <filter-mapping> >> <filter-name>warpFilter</filter-name> >> <url-pattern>/*</url-pattern> >> </filter-mapping> >> >> 2. guice binding >> bindConstant().annotatedWith(JpaUnit.class).to("myPU"); >> >> 3. Module creation >> Module warpModule = >> PersistenceService.usingJpa().across(UnitOfWork.REQUEST).buildModule(); >> >> 4. Persistence.xml >> >> <persistence version="2.0" >> xmlns="http://java.sun.com/xml/ns/persistence" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence >> http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> >> >> <persistence-unit name="myPU" transaction-type="RESOURCE_LOCAL"> >> >> <class>com.josh.myapp.model.Project</class> >> >> <properties> >> <property name="javax.persistence.jdbc.driver" >> value="org.postgresql.Driver"/> >> <property name="javax.persistence.jdbc.user" value="postgres"/> >> <property name="javax.persistence.jdbc.password" >> value="postgres"/> >> <property name="javax.persistence.jdbc.url" >> value="jdbc:postgresql://localhost:5432/myapp"/> >> <property name="hibernate.dialect" >> value="org.hibernate.dialect.PostgreSQLDialect"/> >> <property name="hibernate.max_fetch_depth" value="3"/> >> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> >> </properties> >> </persistence-unit> >> >> </persistence> >> >> I am using guice 2.0 and warp-persist 2.0 >> >> regards. >> >> Josh. >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "google-guice" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<google-guice%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/google-guice?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-guice%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-guice?hl=en. > -- You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.
