Adam Ruggles wrote:
Then why don't you simply pass the id of the account you want to
update and the fields you want to update to the action.
Then create an update SQL statement like "update account set
field1='data_from_form', field2='data2_from_form' where
id='id_from_form';"
This is a way, but not what I am looking to do. what about the business
logic layer. If I create an update statement in the Action then no point
in having an Account object. So, I created an update statement in the
business logic (Account) and passed it the new values. The problem is,
how do I get my hand on the object that I need to update. Store it in a
session ? I can not pass it back to the action as it doesn't take any
thing but string.
Why do you need to reload the account to update it? If You don't pass
an id in then you know its a new record and can issue an insert
statement instead.
I don't need to reload the Account every time I do an update, and that's
my problem in the first place.
So you mean, if the action doesn't receive an id then it must be a new
record. Right ? back again to the MVC, I need to put the logic in it's
place. I will do my best not to put any data access code in the action.
The only things you should put into a session are thing that usually
don't change very often and are session specific.
How do I resolve this then ?
Mansour wrote:
I am accessing the DB using JDBC.
Adam Ruggles wrote:
How are you accessing the database? JDBC, Hibernate, Another ORM
solution?
Mansour wrote:
Ok Dave:
you are really helping me a lot. I think I'll have to explain to
you exactly what I am doing, and you give me an advice about how to
do it. Okay?
I 've been trying to learn struts 2 for a week but not doing any
significant progress. I need an program that stores accounts and
services with invoices. All I need is to be able to retrieve an
account view/add invoices , and services to each invoice.
When ever, I retrieve an account I want to perform the operations
of adding or updating invoices.
Now I am able to get an account (from the DB) and to view all the
invoices, but nothing more. How do I go around this?
I have tried retrieving the account again (by its id) form the DB
but this is not what I want as it keeps on openning connection and
get every single from the DB every time I need to update. That's
why I asked if I have to use interceptors or implement Preparable
and sessionAware.
By the way, I really appreciate your help, and in many cases you
may find my post lacks some info. The reason of this is because I
am still LEARNING and I don't know what info you need to be able to
help. So if I miss some thing, just ask.
Dave Newton wrote:
--- Mansour <[EMAIL PROTECTED]> wrote:
I thought there's a way like .net of jsf to store
the
object in the session and retrieve when needed.
Of course you can store an object in the session. You
didn't say you wanted to.
As I said, without any information about what you're
attempting to do or if you're experiencing any
specific issues it's pretty difficult to be helpful.
d.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]