Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibername @OneToOne mapping and static data

 
David Glossop
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I' just starting out along the Hibernate path and I have a question/problem with unsderstanding the best or correct way to map data and objects. At a simple level, assume I have a user and userType object as below;





the code spippet for adding a user whould be;




Which I want represented in the Database as below;



The problem is I have is; I want the userTypes table to be static data only, that is I don't want hibernate to perform any CRUD operations on it. Where as in the above example I really only want hibernate to return user with a correctly populated userType object when queried and nothing else.

Am I approaching the problem the wrong way on trying to user hibernate incorrectly?
 
Manuel Petermann
Ranch Hand
Posts: 177
Hibernate Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would use enums for static data.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic