• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Insert In SpringMVC

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I have a Webapp and i want to insert a record in my db
This is my controller


tis is my dao


my daoImpl

When I press on save in my view it doensn't insert a new record in my db

I have no errors, the webpage goes back to my home.jsp...

Someone who knows what im doing wrong ?

Thanks!
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try adding a debug statement/println to ReservationMaken2(). Does it get run?

Also, not that it is Java convention to have method names begin with lowercase. So you'd have reservationMaken2().
 
author
Posts: 63
Mac OS X Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is your JPA configuration? Have you properly set up your transaction manager?

I would turn up the logging in javax.persistence, in org.springframework.orm and see what it tells you. Bottom line if the transaction manager isn't configured right it will not flush and therefore will not cause a push of the data.

I also don't see a @Transactional anywhere. What is your transaction configuration? Are you using the AOP driven one or <tx:annotation-driven/> in your XML?

Ken
 
Arian Zand
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ken Rimple wrote:What is your JPA configuration? Have you properly set up your transaction manager?

I would turn up the logging in javax.persistence, in org.springframework.orm and see what it tells you. Bottom line if the transaction manager isn't configured right it will not flush and therefore will not cause a push of the data.

I also don't see a @Transactional anywhere. What is your transaction configuration? Are you using the AOP driven one or <tx:annotation-driven/> in your XML?

Ken


Hey Ken,

My JPA do you mean my persistence.xml? (I search on the internet what the JPA was standing for i didnt know...)
If my jpa is my persistence.xml I dont know where to find this file...
And where do i need to set the annotation Transactional ?
 
Ken Rimple
author
Posts: 63
Mac OS X Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you don't know those pieces of information, I can't help as much...

You need to find out where your Spring configuration files are, usually called applicationContext.xml or something like that. They'll usually live in the src/main/resources directory of your application somewhere, sometimes in there as META-INF/spring, (I'm assuming Maven here). Did you have SpringSource ToolSuite set it up for you? In that case, that's the directory. If not, did you use Roo? Same place...

The persistence.xml file is where you define your JPA configuration, such as the JPA provider and mapping information. The applicationContext would be using an EntityManagerFactoryBean to create the entity manager, and that's where the JPA config is. Then you'd mount a transaction manager in the same configuration file.

You may need to read up on these things to understand why you're getting the behavior you're seeing - the Spring Framework documentation is quite good, as is Craig Walls' Spring in Action book for example (not a plug, but he goes through these things in great detail).

I suspect you don't have everything wired properly and that's why nothing is being persisted.

If you have Roo build you a JPA-based application, such as running 'script wedding.roo' - you'll see how they organize their configuration, although they use AspectJ for the transaction management, which can make learning from it a tad tricky.

Ken
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic