• 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

How to update table with autoincrement column in JSF application

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Sorry for crossposting, but I didn't know how to remove this topic from JSF forum.

In my JSF application I add some data to the table:


as long as the table doesn't contain AutoIncrement column it works fine.

As soon as I add an ID autoincrement column the code stops working and e.getMessage() returns null. I discovered that there is an exception concerning update of the ID column. I tryied to insert row such as: myTableDataProvider.setValue("MYTABLE.ID", null); but it didn't work.

Using simple SQL INSERT query works fine: I just omit ID field and after commiting new row is inserted with automatically generated ID value.

But I don't know how to modify my first code.

Regards,
Wojtek


 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are using some ORM mapping like hibernate right? What do the mapping files look like? You usually have to identify "generated" fields and define what ID generator strategy you are using.
 
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

Wojtek Thomas wrote:Sorry for crossposting, but I didn't know how to remove this topic from JSF forum.


I deleted it for you. For future reference, just post in your thread you'd like it moved and a moderator can do that for you.
 
Wojtek Thomas
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Friend od mine adviced me to create second DataProvider binded to the table with ID column omited.

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