These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Conceptual Architectural Question
PostPosted: Thu Dec 15, 2005 8:10 pm 
Newbie

Joined: Mon Nov 28, 2005 12:43 am
Posts: 9
I am about to use Hibernate for my first application. I have two "best practice" guidance questions:

1) Should the POJOs I create that map to data be simple "Value Objects" (otherwise called Data Transfer Objects) or richer Domain Objects.

For example, suppose I have an InsurancePolicy entity. I was planning to implement a method calculatePremium(). Is there any reason to limit business logic in the class?

2) Should I hand-code both the java and hbm.xml mapping files, or build one of the two and generate the other. (I was planning to generate the DDL for the database).


Thanks for any advice


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 15, 2005 11:00 pm 
Beginner
Beginner

Joined: Tue Sep 09, 2003 9:11 pm
Posts: 32
Quote:
1) Should the POJOs I create that map to data be simple "Value Objects" (otherwise called Data Transfer Objects) or richer Domain Objects.


We use a rich domain model and implement most of our business logic on the POJOs. We're about to move to a JSF/Seam layered application (from JSP/Struts) and I have a feeling I'm going to be glad I put the logic in the domain model instead of the Struts Actions or in some other type of Command/Script Object.

While we don't use the EJB development model of Stateless/Stateful objects - I having a feeling when we move to EJBs we won't use the SLSB/SFSB objects. I just feel its cleaner to have the logic close to the data it modifies. But I'm sure there are very valid reason that I don't pretend to understand about using SLSBs....we just don't have that level of performance/scalability requirements....

Quote:
2) Should I hand-code both the java and hbm.xml mapping files, or build one of the two and generate the other. (I was planning to generate the DDL for the database).


Currently we build both by hand. Very shortely though we are going to start using annotations (see the Annotation Tools project). We also let hibernate generate the ddl.

Good luck!

_________________
___________
Chris....
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.