• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to keep a variable in Model class that you dont want to save in DB? Spring-Hibernate example

 
sachin pachpute
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In my model class (Article.java as given below), I have got a field (fileData) which contains uploaded image information. I dont want to save it in database (instead on file system) and thus i dont have corresponding column in the table. I am getting hibernate error which is quite correct.

My query is how can i handle this situation. I want to have a column in my @Entity persistent class which i dont want to save in database but only use in the controller.



[See UseCodeTags]
 
Manuel Petermann
Ranch Hand
Posts: 177
Hibernate Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may either use the @transient annotation for methods or use the transient keyword if you are using field access.
 
sachin pachpute
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much. This issue is resolved for me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic