• 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 make a crud jsf with ebj without id filed?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys:
I use the option Jsf Pages From Entity class in Netbeans IDE, it works good but I do not want to generate code for id field(primary key) for each table, cause it is AutoIncrement.
but the Netbeans generates input text for all databease's field in the tables.......! even for Id.......!!
I changed the @Id @GeneratedValue(strategy) to be (GenerationType.AUTO) and delete the input text for id field from the page and tried to save a new data but it didn't work.....!!
I got error message in the page(may be not null).....!!
I tried to trace where he use the quiery to save data but I could not find anything....!!
please help me.
this is the code for session bean, entity class and jsf page



session bean


The Jsf page


I delete the value attribute form input text for id field cause I supposed that it should be insert automaticlly inside database not by user.
 
Jamil Shreet
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry guys I forget the controller class

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your Managed bean code, line 65
getFacade().create(current);
If you CTRL+click "create" Netbeans should show you this method code. This will be where your object is saved to database.

But I don't think your data goes there.
Take a look at your JSF code.
<h:inputText></h:inputText>
Your input box is not connected with your managed bean. Managed bean should contain private String teacherFullName; and getName() and setName methods so you can use jsf code:
<h:inputText value="#{teachersInfoController.teacherFullName}"></h:inputText>
Then if you submit form it will be passed to managed bean so you can use it to create new teacher. Think about it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic