Reputation: 1539
I am developing Order Management application and there are different pages to complete the order. Should I store the full order object in Http Session or on every page, I should retreive the object from database using some cart number or order number?
I know it depends on the design decisions. I am just looking for the best practices that ppl uses.
Thanks in advance for the help.
Upvotes: 0
Views: 80
Reputation: 5033
Yes and No. No do not use Session (most of the time) for storing request objects. That will eat your server's RAM and depending on how much heap memory you have left it will start to page to I/O. I don't know what framework you are using for your Web tier, but you should be using backing objects which gets/sets in the controller. From there you can have a service tier for processing the business logic.
And finally, to answer your question, you will map the data you received into Hibernate Entities and if you prefer to use Detached Criteria have a look at -
http://docs.jboss.org/hibernate/orm/3.5/javadocs/org/hibernate/criterion/DetachedCriteria.html
and
https://gist.github.com/jeffsheets/5292986
Yes because cart is something that can go in the session, as there is no need for persistence until a user really decides to do so and you need to maintain that throughout his browser session.
Upvotes: 1