Hello all,
Sorry, I'm a noob.
I've set up my first app, mostly copying from booking-mvc (I'll add the config files at the end of this post). Everything's working fine, except the model isn't being saved. No exceptions or anything indicating that anything's amiss. The flow:
From the logs, Hibernate appears to be configured properly:Code:<persistence-context/> <on-start> <evaluate expression="projectService.createProject()" result="flowScope.project"/> </on-start> <view-state id="new" model="project"> <transition on="save" to="done"> <evaluate expression="projectService.deleteProject(project)"/> (NOTE: all this does is log the project name, for debugging) <render fragments="newProjectForm"/> </transition> </view-state> <end-state id="done" commit="true" view="externalRedirect:servletRelative:/admin/intro"/>
and it seems like the commit tries to happen:Code:INFO 2009-10-07 14:38:34,103 hibernate.ejb.Ejb3Configuration - found EJB3 Entity bean: com.elided.photogallery.domain.project.Project DEBUG 2009-10-07 14:38:34,759 ejb.util.NamingHelper - No JNDI name configured for binding Ejb3Configuration
but nothing shows up in the DB. I'd also expect to see some indication in the logs that there was an attempt made to persist 'project', but there's nothing. It's entirely possibly that I don't have the Entities annotated correctly, but wouldn't there be error messages rather than silent failure? And BTW I set org.hibernate and most of org.springframework to debug for logging.Code:transaction.support.TransactionSynchronizationManager - Retrieved value [org.springframework.orm.jpa.EntityManagerHolder@fb765a] for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@1a17727] bound to thread [http-80-1] orm.jpa.JpaTransactionManager - Found thread-bound EntityManager [org.hibernate.ejb.EntityManagerImpl@ea58e3] for JPA transaction orm.jpa.JpaTransactionManager - Creating new transaction with name [null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT orm.jpa.JpaTransactionManager - Exposing JPA transaction as JDBC transaction [SimpleConnectionHandle: com.elided.dbpool.ConnectionWrapper@179c0a7] transaction.support.TransactionSynchronizationManager - Bound value [org.springframework.jdbc.datasource.ConnectionHolder@5739a0] for key [com.elided.dbpool.AwiDataSource@10c986] to thread [http-80-1] transaction.support.TransactionSynchronizationManager - Initializing transaction synchronization orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler - Joined local transaction orm.jpa.JpaTransactionManager - Triggering beforeCommit synchronization orm.jpa.JpaTransactionManager - Triggering beforeCompletion synchronization orm.jpa.JpaTransactionManager - Initiating transaction commit orm.jpa.JpaTransactionManager - Committing JPA transaction on EntityManager [org.hibernate.ejb.EntityManagerImpl@ea58e3] orm.jpa.JpaTransactionManager - Triggering afterCommit synchronization orm.jpa.JpaTransactionManager - Triggering afterCompletion synchronization transaction.support.TransactionSynchronizationManager - Clearing transaction synchronization transaction.support.TransactionSynchronizationManager - Removed value [org.springframework.jdbc.datasource.ConnectionHolder@5739a0] for key [com.elided.dbpool.AwiDataSource@10c986] from thread [http-80-1] orm.jpa.JpaTransactionManager - Not closing pre-bound JPA EntityManager after transaction transaction.support.TransactionSynchronizationManager - Removed value [org.springframework.orm.jpa.EntityManagerHolder@fb765a] for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@1a17727] from thread [http-80-1]
I've been reading the source and stepping through with the debugger, but I don't have enough of a grasp yet to really know what to look for. And of course I've also tried searching here and on the web. Where do I start to try to track this down? How can I determine if the EntityManager, etc. (I haven't figured out how it all works yet) has any awareness of 'project'? All advice is, of course, welcome.
The config files:
data-access-config.xml
webmvc-config.xmlCode:<tx:annotation-driven /> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="hibernateProperties"> <value> hibernate.dialect=org.hibernate.dialect.Oracle10gDialect </value> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /> </property> </bean> <bean id="dataSource" class="com.elided.dbpool.AwiDataSource"/>
webflow-config.xmlCode:<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"> <property name="order" value="0" /> <property name="flowRegistry" ref="flowRegistry" /> </bean> <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"> <property name="order" value="1" /> <property name="defaultHandler"> <!-- If no @Controller match, map path to a view to render; e.g. the "/intro" path would map to the view named "intro" --> <bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" /> </property> </bean> <bean id="tilesViewResolver" class="org.springframework.js.ajax.AjaxUrlBasedViewResolver"> <property name="viewClass" value="org.springframework.webflow.mvc.view.FlowAjaxTilesView"/> </bean> <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"> <property name="definitions"> <list> <value>/WEB-INF/layouts/layouts.xml</value> <value>/WEB-INF/views.xml</value> <value>/WEB-INF/flows/new/new-views.xml</value> </list> </property> </bean> <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" /> <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter"> <property name="flowExecutor" ref="flowExecutor"/> </bean>
persistence.xml FWIWCode:<webflow:flow-executor id="flowExecutor"> <webflow:flow-execution-listeners> <webflow:listener ref="jpaFlowExecutionListener" /> </webflow:flow-execution-listeners> </webflow:flow-executor> <webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF/flows"> <webflow:flow-location-pattern value="/**/*-flow.xml" /> </webflow:flow-registry> <webflow:flow-builder-services id="flowBuilderServices" view-factory-creator="mvcViewFactoryCreator" development="true" /> <bean id="mvcViewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator"> <property name="viewResolvers" ref="tilesViewResolver"/> <property name="useSpringBeanBinding" value="true" /> </bean> <bean id="jpaFlowExecutionListener" class="org.springframework.webflow.persistence.JpaFlowExecutionListener"> <constructor-arg ref="entityManagerFactory" /> <constructor-arg ref="transactionManager" /> </bean>
Code:<persistence-unit name="photogallery-admin"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>com.elided.photogallery.domain.project.Project</class> <class>com.elided.photogallery.domain.project.ProjectKey</class> <class>com.elided.photogallery.domain.RowControl</class> <class>com.elided.photogallery.domain.Flag</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/> <property name="hibernate.show_sql" value="true"/> </properties> </persistence-unit>
Thanks!
Steve


Reply With Quote
