Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Issue with DAO using Spring - Write operations not allowed in read-only mode

 
Greenhorn
Posts: 11
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTTP Status 500 - Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.
these are my files

LoginController.java


RegisterDao.java



RegisterDaoImpl.java



spring-servlet.xml


web.xml



pom.xml

 
Sheriff
Posts: 9671
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you add more details like which request gives you this error. Few lines of the stack trace might also be helpful. One possible issue is that you've marked your DAO as a @Service, but DAOs are supposed to be @Repository...
 
Nagaraju Boddu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for your replay.... i am getting this error while submitting values to database to store..... when i try to call dao.adduser() method in dao class am getting that error...
 
Nagaraju Boddu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you @Ankit Garg... i tried by @Repository annotation but it is also showing same error
 
Ankit Garg
Sheriff
Posts: 9671
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've included <tx:annotation-driven transaction-manager="transactionManager" /> but I don't see the transactionManager bean declared. Can you declare a transaction manager bean and try...
 
Nagaraju Boddu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried but getting error as

> > java.lang.IllegalStateException: Already value [org.springframework.orm.hibernate5.SessionHolder@19037196] for key [org.hibernate.internal.SessionFactoryImpl@1a513405] bound to thread [http-bio-2016-exec-5]
> java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@1a513405] bound to thread [http-bio-2016-exec-5]
 
Ankit Garg
Sheriff
Posts: 9671
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This other thread you created seems very similar to the problem you are facing here (apart from the database everything else seems to be the same). I'm getting a bit confused, are you facing the same issue in both projects? If yes it would be better to focus on one of them so that it is easier to resolve the issue...
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic