voyent
Should I use DataProvider, CachedRowset etc for EJB/ICEFaces application  XML
Forum Index -> General Help
Author Message
kwedeer

Joined: 01/Jan/2009 00:00:00
Messages: 5
Offline


Hi,

I am trying to design the architecture and also - to develop code for business application (for accounting and stock inventory etc. - so - there will be a lot of business logic) that will use EJB3 (or simply - Java 5 EE persistent entities) and ICEFaces, and I am trying to do this in Netbeans 6.5, there is no legacy code to take into account.

So - my impression is - that I can put my entities into the EAR (EJB application) and JSF/ICEFaces pages in WAR (web application). Every query will be defined as JPQL query in entities and there will be EJB session beans that will have methods to issue thoses queries (e.g. like findAllInvoicesByStartDateEndDateCustomer) and also - to do other complex business operations (like shipping the invoice or invoice order etc.) (e.g. methods like shipInvoice).

So - my backing beans (from WAR application) will call into the session beans from EAR part of Enterprise application. E.g. - my backing bean for page ListInvoices.iface will have method getAllInvoices whose result will be List<Invoice>. Well - and there is the question: I have tried to consume the getAllInvoices method directly into the ICEFaces table and it worked as expected, I see that I can write some additional code (e.g. make my backing bean a child from special base class) that makes the sorting possible (as it is described in ICEFaces tutorial about tables). So - the big question is - at the present I don't see any necessity for DataProvider or CachedSets. So - does my architecture is normal without use of those DataProviders, CachedSets etc.?

I have read ICEFaces tutorial about CollaborativeCRUD application and DataProviders are used here, but I guess - this was only because the authors made direct access to database in their web application and it is not certainly the good design. E.g. my design (with entities in separate module) can be handy if I am developing desktop Java application further or when I decide to expose my business logic as web services. Am I right?

Well - I have started to investigate how to handle the editable data tables (e.g. - each row uses many InputText componentes) and there is such class as DataModel and maybe I will have to use it, but as I understand - there is not need for DataProvider or CachedSet in this use case as well. Am I righ in this case as well?

Thanks for any advice and estimation of my design - in advance!
kwedeer

Joined: 01/Jan/2009 00:00:00
Messages: 5
Offline


OK - I have found at least partial answer myself - as it is advised in O'Reilly book about JavaServer Faces - then one should use javax.faces.model.DataModel descendants with JSF DataTable or ice:DataTable, as I found - there is com.icesoft.faces.model.SetDataModel (inhertied from DataModel). I guess - that nothing more sophisticated is not needed even for enterprise grade applications, am I right?
mgroeneweg

Joined: 26/Dec/2008 00:00:00
Messages: 238
Offline


I only have a more general answer for you:

This is also a bit of a principle, so most definitely not the one way.

In our company, we regard a web application as a presentation layer only.
It calls ejb methods to present and manipulate data but does not access the database directly.

Business logic is in the ejb layer and can be used from a web app, a gui an interface with another system, or whatever else one can think up.

This also adds some security, as the web app does not access the database directly, SQL injection attacks will be a lot more difficult, if possible at all.
Of course your web app users should not be able to logon to the database server.

Hope this helps...
ramachay

Joined: 10/Jun/2009 00:00:00
Messages: 2
Offline


Hi kwedeer,

Would it be possible to please let know the procedure on how to save the selected records into database without using CachedRowSet, dataprovider.

My scenario is more or less similar to yours, where I am using ice:dataTable, spring, hibernate dao + entry. I am kind of lost in figuring out how to save (persist) the selected editable record shown in the dataTable to database. I have with me java.util.List of entity records from DAO through spring bean.

Any thoughts on how to proceed here would be really helpful. Apologies to barge in the middle of your thread discussions.

Thanks
Ram
 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team