java - Is required new instance of LIST or SET in entity? -
this question has answer here:
i noticed in tutorials mapping columns in hibernate, initialize list(set). difference when don't use "new" , new arraylist()
? can use new linkedlist(
) too? , set? same in list? , there same difference across versions of hibernate?
@entiy public class student implements serializable{ private list<string> subjects1; private list<string> subjects2 = new arraylist(); }
or
@entiy public class student implements serializable{ private set<string> subjects1; private set<string> subjects2 = new hashset(); }
like other collection, need create instance before can add elements. when load entity database, collection created, don't need it.
Comments
Post a Comment