I heard a technical scenario where 2 entities having same attributes. A Boy and Girl Entity with Name, Age and DOB. How this can be formed as single entity so that fields are not repetitive ? Please share any idea. I'm also keen to find the right solution through studies. But your ideas may also help. Thanks.
Stephan van Hulst wrote:I don't think that Gender would be so complex to warrant an embeddable type. Just use an enum for Gender and you can annotate the gender field with @Enumerated in your Person entity.
Stephan, by your idea what I understand is change to the db design of table structure itself. Instead having two tables (Boy and Girl) have one table with the name PERSON with attributes(NAME, AGE, DOB, GENDER(ENUM)) and represent the above Person table as a single Entity. Am I on track to get the above ?
Thanks & Regards.
Today is the first day of the rest of your life.
Stephan van Hulst
posted 9 months ago
Yes, although I don't know why you would want to have an age field if you already have a date of birth field.