-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Enumeration Tables, User Types, and Entity Types
PostPosted: Mon Jan 24, 2005 2:56 am 
Newbie

Joined: Sun Jan 23, 2005 1:39 am
Posts: 2
I think it's often common to find database enumeration tables which translate the meanings of column codes. For example, you might have a status field in a User table

Code:

CREATE TABLE User (
  id INTEGER,
  status TINYINT,
  name VARCHAR
  email VARCHAR
  ....
)



Which is translated by another table UserStatus

Code:

CREATE TABLE UserStatus (
  id TINYINT,
  name CHAR(10) ,
  created DATETIME
)



I have read the section in Hibernate in Action on enumerated types, which suggests that a Serializable class in our domain model, say com.acme.model.UserStatus and also an accompanying implementation of UserType could be used to model this sort of enumeration. I take it that this would mean that the domain class would not really know about the UserStatus table per se. If we added a new status to our system, we would have to update our UserStatus class accordingly.

This is all well and good except what should I do if i want to furthermore treat the UserStatus table in the physical as an (immutable) entity type which I can query with greater complexity? (E.g. finding all the status fields that were created before a certain date?) Would I create an entirely different domain class and create another hbm.xml file?

Or is there a more elegant solution?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.