• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to restrict a field to get mapped to the database column

 
vikas sharmaa
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Hibernate with Spring 3.0.

I have 2 Entity classes, namely, Question and Answer, as shown below:

Question Entity class:



Answer Entity class:




now, i have 2 queries here:

1. private ArrayList<Answer> answers; variable in the Question entity class has no corresponding column in the database. so, is there any annotation that will restrict this ArrayList field to get mapped to the database column?

2. Is any better database design approach then the one I did above? for reference: I have a section class; each section has multiple questions; and each question has multiple answers.

Thank you.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would simply marking the field as being @Transient work?
 
vikas sharmaa
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Cameron, @Transient works for my purpose.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic