• 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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!