-->
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.  [ 6 posts ] 
Author Message
 Post subject: Good example application for a layered architecture
PostPosted: Sat Sep 27, 2003 8:03 pm 
Beginner
Beginner

Joined: Sat Sep 20, 2003 4:23 am
Posts: 48
I'm still deciding whether to go for Spring or Struts, but are there any downloadable examples which give a good example on how to incorporate Hibernate in a layered artichecture?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 27, 2003 8:10 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Please, start reading the available documentation. Take your time, this is not an easy decision.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 28, 2003 2:15 am 
Beginner
Beginner

Joined: Sat Sep 20, 2003 4:23 am
Posts: 48
I allready pretty much did. The thing is: I don't have much time. I'm working on a project which requires results quite soon. They want it quick 'n dirty, I want it properly. Having some example of how to use hibernate in a layered architecture (DAO-pattern) would help bigtime.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 28, 2003 2:53 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Ilja wrote:
I allready pretty much did. The thing is: I don't have much time. I'm working on a project which requires results quite soon. They want it quick 'n dirty, I want it properly. Having some example of how to use hibernate in a layered architecture (DAO-pattern) would help bigtime.

Hibernate is not a good choise for "quick 'n dirty" and if you have no expirence with O/R tools. I have implemented simple data access framework for "quick 'n dirty" solutions.
http://voruta.sourceforge.net it has no advanced features and documentation, but it will be very trivial to drop voruta and use hibernate or JDO later, if you prefer O/R tools.( dependancy on voruta API is very trivial ). But if you will spend more than hour to start with voruta, drop it and use something more trivial to understand.
[/url]


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 28, 2003 4:01 am 
Beginner
Beginner

Joined: Sat Sep 20, 2003 4:23 am
Posts: 48
baliukas wrote:
Ilja wrote:
I allready pretty much did. The thing is: I don't have much time. I'm working on a project which requires results quite soon. They want it quick 'n dirty, I want it properly. Having some example of how to use hibernate in a layered architecture (DAO-pattern) would help bigtime.

Hibernate is not a good choise for "quick 'n dirty" and if you have no expirence with O/R tools. I have implemented simple data access framework for "quick 'n dirty" solutions.
http://voruta.sourceforge.net it has no advanced features and documentation, but it will be very trivial to drop voruta and use hibernate or JDO later, if you prefer O/R tools.( dependancy on voruta API is very trivial ). But if you will spend more than hour to start with voruta, drop it and use something more trivial to understand.
[/url]


I'm not going to do it quick 'n dirty. And however I don't have much experience with O/R tools, I have enough programming knowledge to quickly grasp how to work with it. I allready do have setup my initial classes with a XDoclet/Hibernate implementation. However I would be greatly helped by pointing me out by a good way of implementing such a layered architecture. I personally learn alot just by looking at how others have done it.


Top
 Profile  
 
 Post subject: Re: Good example application for a layered architecture
PostPosted: Sun Sep 28, 2003 7:42 am 
Senior
Senior

Joined: Wed Aug 27, 2003 6:04 am
Posts: 161
Location: Linz, Austria
Ilja wrote:
I'm still deciding whether to go for Spring or Struts, but are there any downloadable examples which give a good example on how to incorporate Hibernate in a layered artichecture?


As outlined in the article in the Hibernate community area (http://www.hibernate.org/110.html), Spring offers a lot of features for setting up business and data access objects. From wiring up in an IoC style to declarative transaction demarcation, there should be everything you need for a proper and convenient local (non-remote) middle tier. This will work with all sorts of transaction and data access strategies, and with any client layer - be it Spring web MVC, Struts, WebWork, or a Swing UI.

Struts on the other hand is "just" a web MVC framework, like WebWork. That is fine, of course, but does not compete with Spring's middle tier features. Spring's web MVC is one of Spring's features, but by no means central: Use it if you like to, use any other web MVC framework if you prefer. Spring is as a la carte as possible: In contrast to other application frameworks like Expresso, it explicitly supports selective usage of features and seamless integration with other solutions.

So Spring vs Struts is not an exclusive choice: Spring web MVC vs Struts is. We have numerous users that combine a Struts web layer with a Spring business layer, mainly because of existing investments in Struts. Basically, you access Spring-configured business beans from within your Struts actions in such a scenario. See the "Web MVC" article on the Spring website (http://www.springframework.org/docs/web_mvc.html) for details, especially the section talking about integration.

A transaction strategy for Hibernate and support classes for IoC-style Hibernate access code make implementing Hibernate-based DAOs as simple as possible. Unfortunately, there is no full-fledged sample app for Spring/Hibernate yet: I'm currently working on one, though. The existing "webapp-hibernate" skeleton included in the Spring distribution should be a start for a typical application context configuration, illustrating both the business layer and a web layer on top.

Your Hibernate DAOs just implement the actual data access logic, preferably via HibernateTemplate, without dealing with transaction demarcation or explicit Session creation. Business objects demarcate transactions and invoke methods of DAOs (see the article). If you've got any specific questions regarding the implementation of such DAOs, let me know: I'm involved in 3 commercial products based on Spring/Hibernate, so I should be able help.

Juergen


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.