reset password
Author Message
aligh1979
Posts: 121
Posted 03:01 Oct 28, 2011 |

before reading the preferred design model on csns , what I had in my mind regarding RubricScore , was to have two field for the actual score , one , a Transient annotation field that does not get saved in database and only used in the object side , two , a String representation of the score that combined the list together with a separator and then get saved into database , and whenever we retrieve the data back we could just split the individuals based on that separator . but I did not see any mention to an extra field in the preferred design , so I assume we should just go by this and save the individual data piece in the database . which is sort of troublesome in this case since we do not have a certain number for the data columns (depends on the size / scale of the Rubrics) .

the other thing is that we have a list type for a field it gets translated to a "bytea" type . might not be a good question , does this mean that it somehow combines the List elements together and saves it into database ?  and we we get it back by Dao and Entity Manager (behind the scene) it automatically return a list of that one "bytea" type ?

cysun
Posts: 2935
Posted 08:52 Oct 28, 2011 |

Saving numbers as strings is a bad design because you can no longer query the values, sort them, add constraint to them, do calculation with them, and so on, and converting back and forth between strings and numbers add unnecessary overhead.

See the Customer/Phones example in the Hibernate lecture to see how to map a collection of simple types.