• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is session Id must for CRUD

 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
without session Id can we do any operations like add,update,edit,delete. I saw Session id is loaded for edit and delete action
not for "Add" operation . so am asking this
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not following what you are asking here. Can you give us some context? CRUD operations using what technology?
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CRUD operations using struts and hibernate.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate does not require an HTTP session to perform CRUD. Struts does not require an HTTP Session to use Hibernate. Whatever is happening is a design descision of you applciaiton itself not either of these products.
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friend, please go through this code .Here why session id used only for edit , not for add ,update actions. How can i send full code , it does not support .txt , .doc formats


 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, so you don't mean an HTTP session id, you mean the id of the object you plan to edit, load or delete. Yes you need this, this is just how databases work. You can't load an entity (which is the first step to editing or deleting it) without its ID. When you add a new entity there is no identifier (assuming you are using surrogate keys) so the id is not needed.

(NB: the roseindia Hibernate tutorials are not very good, I would not try to learn from them)
 
Saifuddin Merchant
Ranch Hand
Posts: 607
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well whether or not you need a session variable depends entirely on the Business that the CURD operation you performs supports.

If you are asking for Rule of thumb then we could say that in general most update/delete operation would require some identifier data to be present in the session (note this is not the session ID - its probably userID or something which is the primary key of the database).

Inserting of a new record (say add a new customer) would usually not require identifier data to be present in the session.

This is a very beginners view - for simple application. Data interaction in real applications could be a lot more complex!!
 
Saifuddin Merchant
Ranch Hand
Posts: 607
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Sturrock wrote:
(NB: the roseindia Hibernate tutorials are not very good, I would not try to learn from them)


Yep I agree!!! Not a place for beginners to be ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic