PDA

View Full Version : Recomended practice for service layer from domain object



garpinc2
Sep 27th, 2004, 04:07 PM
Using spring for service layer. What is the best practice for accessing service layer from domain object. My particular issue is I have a domain object whose children are also the same typed domain object but there is a complicated HQL join to retreive the results so I just can't create a mapping. Should I access the spring service layer from my domain object such that when I iterate through a list of these domain objects then each domain object will have access to it's parents? Maybe this question is better answered in hibernate forum but since it's also Spring related I thought I'd also ask it here.

Rod Johnson
Sep 28th, 2004, 02:13 AM
Spring 1.2 will have a feature to configure objects persisted with Hibernate or JDO implementations using Dependency Injection. The Hibernate code is already in the sandbox: org.springframework.orm.support.hibernate.Dependen cyInjectionInterceptorFactoryBean. There was also thread about this usage in the forum a while ago...

This might be what you're looking for.

Colin Sampaleanu
Sep 29th, 2004, 01:38 PM
Note also that Spring 1.1 also added ConfigurableBeanFactory.applyBeanPropertyValues, which is another approach which could be used to wire up classes created by Hibernate, without them having to be created by Spring itself. You'd probably still need to do it via a Hibernate Interceptor though...