java - Correct way of using CRUD in JSF -


i need advice on few design principles regarding crud operations in jsf project.

a simple example:

i have basic screen form submitted. in bean declare database connection in method , string object populate script. modify string data have been submitted in form. way taught it, i'm suspecting it's not based on solid principles.

so decided start using prepared statements. seems bit better, still not perfect in mind.

my question is: instead of writing new script each crud method, better perhaps create stored procedures instead, in mind looks neater code , perhaps has better readability.

or there entirely different way of doing things? concerns have fragile oltp database.

your jsf,s should redirect servlet calls service method, write business logic , call data access object execute required sql query. u should never use bean database connection... should use datasource data base connection. , yes simple preparedstatement enough do. should convert strings in servlet , pass next layer of bean has setters , getters form fields.. , dao contains crud operations.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -