-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate with Spring in managed environment
PostPosted: Tue Mar 23, 2004 9:48 am 
Beginner
Beginner

Joined: Thu Feb 26, 2004 6:59 am
Posts: 47
Location: Gurgaon, India
Hello,

I deployed a application using hibernate. It is working very fine, and also proving strength of hibernate API.

Now I am trying to use Spring framework for my application. I customize my application with spring and it is working fine as standalone application. After this, I need help for porting it in application server, I am facing difficulty for finding configuration required in app server environment.

Like

1). where do we need to specifiy about our proxies, if we are using interceptors. I read something like ContextLoaderServlet and ContextLoader-listeners etc, but not got more about these.

2). Do we need to create instance of proxy ourself using xmlBeanFactory, or any other way is also there.

Can anyone help me for this. Any short example for web application settings and beans usage in this environment will work.

Waiting for response, its urgent.
Thanks,

_________________
Mohit Gupta
Software Engineer
Gurgaon, India


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 23, 2004 11:22 am 
Senior
Senior

Joined: Wed Aug 27, 2003 6:04 am
Posts: 161
Location: Linz, Austria
See the sample apps that come with the Spring distribution, in particular Petclinic and JPetStore: They illustrate the configuration strategy for web environments. Petclinic uses Hibernate and Spring web MVC; JPetStore uses iBATIS SQL Maps and features alternative Spring/Struts web tiers.

Basically, you keep your middle tier definitions in an XML file in the WEB-INF directory, typically "applicationContext.xml". This file gets loaded by a ContextLoaderServlet or ContextLoaderListener (prefer the latter in a Servlet 2.3/2.4 container, provided that listeners get invoked before load-on-startup servlets in your container).

From then on, you can access your root WebApplicationContext (and thus the beans defined there) in any web component, preferably via Spring's WebApplicationContextUtils.getWebApplicationContext(ServletContext) method: This works with Servlets, Struts, WebWork, even plain JSPs.

If you use Spring's web MVC framework on top, define DispatcherServlets with their own bean definition files. You can refer to your middle tier beans there, as a DispatcherServlet context has access to the beans in your root context. If all your controllers are Spring-managed, you typically don't need to use WebApplicationContextUtils at all.

Juergen


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 24, 2004 1:00 am 
Beginner
Beginner

Joined: Thu Feb 26, 2004 6:59 am
Posts: 47
Location: Gurgaon, India
This can be a useful hint for my work.

Thanks Juergen!

_________________
Mohit Gupta
Software Engineer
Gurgaon, India


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