Check your pointcut ... is com.myapp.dao... correct? If that's correct, then I don't see anything amiss; it looks really good. Are you even able to setup a test where it works? Or are you doing it from a test?
Oh, and check the use of pm.close(). That should be taken care of by Spring I think. I don't do it in my app anyway. If those don't work, then I'll looks again. On Mar 30, 3:04 pm, Carl Ballantyne <carlballant...@gmail.com> wrote: > Hi objectuser, > > Thanks for the links - very helpful. I have had a look and studied > them. I am trying to get your example to work but am getting the > error. > > org.springframework.transaction.CannotCreateTransactionException: > Could not open JDO PersistenceManager for transaction; nested > exception is java.lang.IllegalStateException: No JDO > PersistenceManager bound to thread, and configuration does not allow > creation of non-transactional one here > at > org.springframework.orm.jdo.JdoTransactionManager.doBegin(JdoTransactionManager.java: > 359) > > As far as I can see I have set up everything as should be but am > missing something obvious because it just will not work. It might be > something to do with the aop config but I cannot be sure. I have read > the Spring documentation and your example which are very similar. > Below is my revised spring xml and I have included example dao code as > well. If anyone can see what I am doing wrong please correct me. > Thanks. > > SPRING XML > ------------- > > <bean id="projectDao" class="com.myapp.dao.ProjectDaoJdoImpl"> > <property name="pmf" ref="persistenceManagerFactoryProxy" /> > </bean> > > <bean id="persistenceManagerFactory" > class="org.springframework.orm.jdo.LocalPersistenceManagerFactoryBean"> > <property name="persistenceManagerFactoryName" value="transactions- > optional" /> > </bean> > > <bean id="persistenceManagerFactoryProxy" > class="org.springframework.orm.jdo.TransactionAwarePersistenceManagerFactoryProxy"> > <property name="targetPersistenceManagerFactory" > ref="persistenceManagerFactory" /> > <property name="allowCreate" value="false" /> > </bean> > > <bean id="txManager" > class="org.springframework.orm.jdo.JdoTransactionManager"> > <property name="persistenceManagerFactory" > ref="persistenceManagerFactoryProxy" /> > </bean> > > <tx:advice id="txAdvice" transaction-manager="txManager"> > <tx:attributes> > <tx:method name="clearAndCreate" propagation="REQUIRED" > rollback-for="Throwable" /> > <tx:method name="create" propagation="REQUIRED" rollback- > for="Throwable"/> > <tx:method name="update" propagation="REQUIRED" rollback- > for="Throwable" /> > <tx:method name="delete" propagation="REQUIRED" rollback- > for="Throwable" /> > <tx:method name="*" read-only="true"/> > </tx:attributes> > </tx:advice> > > <aop:config> > <aop:pointcut id="daoMethods" expression="execution(* > com.myapp.dao.*.*(..))"/> > <aop:advisor advice-ref="txAdvice" pointcut-ref="daoMethods"/> > </aop:config> > > DAO > ----- > > public class ProjectDaoJdoImpl implements ProjectDao { > > private PersistenceManagerFactory pmf; > > public void setPmf(final PersistenceManagerFactory pmf) { > this.pmf = pmf; > } > private PersistenceManager getPersistenceManager() { > return pmf.getPersistenceManager(); > } > > public Project read(Long id) { > PersistenceManager pm = getPersistenceManager(); > > try { > Project project = pm.getObjectById(Project.class,id); > return project; > } finally { > pm.close(); > } > > } > > } -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.