Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

persistence issue!  RSS feed

 
Kirtipur Itagol
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All!
Finally I'm able to show my selected datas in a datatable. But now I want these populated datas to be persistent in my database so that I can manipulate the stored values regardless of time. FYI I'm using hibernate. I'm in thiking that java ranch ideas are a big time saver than going through pages in a book. Any suggestions or steps are greatly appreciated!
 
ansar basha
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used datatable and hibernate in one of my project, in ur case
bind the datatable to UIData and upon calling action update the values
u get from uidata using hibernate.

Thanks
Ansar
 
Kirtipur Itagol
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks basar, but here's my datatable binder: <code>binding="#{SomeController.uiSomeNameDataTable}"</code>
So, after this, I call the action button called " save", and you mean after this I have to update it in the hibernate??
Is it possible to guide me through few lines of codes??
Appreciate it!
Kirtipur
 
ansar basha
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Use some thing like this
<h:datatable value=#{somebean.collectData} var=#{somevar}
binding="#{somebean.bindingtoUIData}"> in ur datatable defination.


This is the backing bean.
somebean{
Vector collectData;// this could be vector or arraylist of ur wish
UIData bindingtoUIData;// have get set methods
save(){ // this action is called upon save button click
// in this method get the value stored in bindingtoUIData
List myDataCollected = bindingtoUIData.getValues();
// now iterate through the changed values and update db using hibernate
}
}

Hope this works fine.
I have manually edited this any syntax mistakes highly regretted

Thanks
Ansar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!