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

mapping multiple title to teacher

 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as of now, I have the following class:




As you know, some titles are written before name like Dr. or Prof. or Constable ,etc and some after the name like Msc. Bsc. BA MA. Now I will have 3 tables : Teacher, Title and TeacherTitle. the columns in Teacher and Title will be just the sameas the class properties. the problem is TeacherTitle. In there, I have teacher_id, title_id and title_type (this field i for before or after name title). How should I annotate frontTitles and backTitles in Teacher (or should the annotations be put in Title instead?) class so that hibernate will know to write "after" or "before in title_type (those two are the only permissible values in title_type). can this be done?
thanks
 
Paul Clapham
Sheriff
Posts: 21581
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could I suggest instead this:





Because surely the "before/after" attribute applies to the Title, rather than the TeacherTitle?
 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the suggestion, but in certain countries (non english speaking) usually they prefer to have occupational title after the name to follow their grammatical structure. western countries grammar put adjective before the noun (blue book) but in some language, it's book blue. something like that. that's why to support this, I need to put the before and after must be in the teacher class. is this possible?
thanks
 
Paul Clapham
Sheriff
Posts: 21581
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know about adjectives in different languages, but are you suggesting that some languages put "Dr" after the person's name, or something like that?

Even if that's the case, are you expecting to have titles in different languages in your database? If you were going to do that I would have expected a "language" attribute on the title.
 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it's something like that. so educational title is in front and occupational is put after the name. although Dr. is ambiguous in certain countries. for example, in Indonesia, Dr. may refer to local translation "dokter" which is a doctor that heals people using medical skills or "doktor" which refers to some graduate-level educational title. And if it's the latter, then it should be put in front and if it's the former, it's put behind the names separated with a comma, like this:
Prof. Abcdef, Dr. --> this indicates that he's a professor who works as a doctor.
I know it's weird, but that's how they want it. Clients, you know how they are.
thanks
 
Paul Clapham
Sheriff
Posts: 21581
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems to me you're asking the database to do too much there. That one looks like a "business rule" which should be handled in Java code. At least in my rather uninformed opinion...
 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so, hibernate doesn't have anything in its arsenal to achieve this? thanks
 
Paul Clapham
Sheriff
Posts: 21581
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not saying that. There's a lot of strange stuff towards the end of the Hibernate tutorial which I never got to. I'm just saying how it looks to me.

The other thing is, products almost never have documentation about what they can't do. I've spent a lot of time searching documentation for various products looking for nonexistent features, and that's what you may be doing here.
 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
haha, you got a point there. well, thanks anyway. if you or anybody else know something about this, please let me know. thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic