Discussions

Performance and scalability: Performance DTO's

  1. Performance DTO's (2 messages)

    Hi Everybody, Firts : I looked a topic on this and I didn't find. ---------------------------------------------------- I have an application that it has many DTO's (TO's/Model's): Tables: Company ------------- IDCompany_1 = PK -> ID IDCompany_2 = PK -> REGISTER DATE Desc Phone ------------- and Employee ------------- IDCompany_1 IDCompany_2 IDEmployee Desc Address ------------- I have: ================================================ A ================================================ public class CompanyDTO extends CompanyPKDTO { private String desc; private String phone; //get and set } public class CompanyPKDTO implements Serializable { private Integer IDCompany_1; private Date IDCompany_2; //get and set } public class EmployeeDescDTO extends EmployeeDTO { private String descCompany; private String phoneCompany; //get and set } public class EmployeeDTO extends EmployeePKDTO { private String descEmployee; private String addressEmployee; //get and set } public class EmployeePKDTO implements Serializable { private Integer IDCompany_1; private Date IDCompany_2; private Integer IDEmployee; //get and set } ================================================ B ================================================ public class CompanyDTO implements Serializable { private Integer IDCompany_1; private Date IDCompany_2; private String desc; private String phone; //get and set } public class EmployeeDTO implements Serializable { private Integer IDEmployee; private String descEmployee; private String addressEmployee; private CompanyDTO companyDTO; //get and set } =========================================================== However, situation exists I'll only need the ID's of the company and I won't need 'desc' and 'phone' of the Company. =========================================================== You must consider all aspects of development, performance and memory; And considering, I can consult a list(ArrayList) of EmployeeDTO. Which is better, 'A'or 'B' ? I think the 'B', but I'm opening this topic to take off doubts. Thanks......!!!

    Threaded Messages (2)

  2. Re: Performance DTO's[ Go to top ]

    This may be just a reflection of how companies use our software to build data grids, but I would suggest a variant of B: public class EmployeeDTO implements Serializable { private int IDEmployee; private String descEmployee; private String addressEmployee; private int IDCompany; //get and set // ... // additional helpers public CompanyDTO getCompany() { // look up the Company object using the ID // .. } } Peace, Cameron Purdy Tangosol Coherence: The Java Data Grid
  3. Re: Performance DTO's[ Go to top ]

    Hi Cameron, Could you explain ? Please....... I didn't understand, however in the EmployeeDTO of the 'B' have the property CompanyDTO with 'set' and 'get'. Then getCompanyDTO method is same 'additional helper' your. :) Adenilton Soares