java - No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here -
What about this error? "There is no session to be hibernate for the thread, and the configuration does not allow the creation of non-transactions here ". My Spring Config File Looks Like This
& lt; Bean id = "jndiDataSource" class = "org.springframework.jndi.JndiObjectFactoryBean" & gt; & Lt; Property Name = "jndiName" & gt; & Lt; Price & gt; Java: / devDS & lt; / Pricing & gt; & Lt; / Property & gt; & Lt; / Bean & gt; & Lt; Bean id = "stsaDBFactory" class = "org.springframework.orm.hibernate3.annotation.nnationationSessionFactoryBean" & gt; & Lt; Property Name = "Data Source" ref = "JandetAdSource" /> & Lt; Property Name = "Annotated Classes" & gt; & Lt; List & gt; & Lt; Price & gt; Xx.yy.zz.User & lt; / Pricing & gt; & Lt; Price & gt; Xx.yy.UserResponse & lt; / Pricing & gt; & Lt; / List & gt; & Lt; / Property & gt; & Lt; Property Name = "Hibernate Properties" & gt; & Lt; Theater Content & gt; & Lt; Prop key = "hibernate.show_sql" & gt; True & lt; / Prop & gt; & Lt; Prop key = "hibernate.hbmddl.auto" & gt; Creating & lt; / Prop & gt; & Lt; / Theater & gt; & Lt; / Property & gt; & Lt; / Bean & gt; & Lt ;! - ################################### Facets ############# #################################### - & gt; & Lt; Bean id = "txManager" class = "org.springframework.orm.hibernate3.HibernateTransactionManager" & gt; & Lt; Property Name = "sessionFactory" & gt; & Lt; Ref local = "stsaDBFactory" /> & Lt; / Property & gt; & Lt; / Bean & gt; All DAO tests pass when I test them using a junit outside the container. When I place it in jboss as a portal app, I get this exception. Apart from this, it works fine if I remove the portal specific configuration and make it a simple web app and keep it on jboss. Any ideas?
You defined a TransactionManager in your Spring Config, but you executed a hibernate query in that method Trying to do is not transactional, try adding to your method or transaction in class.
Comments
Post a Comment