Back Forum Reply New

Lazy load problem

Hello!

I have a problem with lazy loading. i will use no lazy=quot;falsequot;. I thought, that it goes with HibernateInterceptor, but it does not function.

so this is entity mapping:

lt;hibernate-mappinggt;
lt;class name=quot;com.ibs.rdc.uvz.bo.RegisterOfDocumentsquot;
table=quot;uvz_register_of_documentsquot;gt;
lt;meta attribute=quot;extendsquot; inherit=quot;falsequot;gt;
com.ibs.rdc.bo.base.PersistentObject
lt;/metagt;
lt;meta attribute=quot;implementsquot;gt;
com.ibs.rdc.uvz.dao.hibernate.bo.IRegisterOfDocume  nts
lt;/metagt;
lt;id name=quot;idquot; type=quot;integerquot;gt;
lt;meta attribute=quot;use-in-tostringquot;gt;truelt;/metagt;
lt;meta attribute=quot;use-in-equalsquot;gt;truelt;/metagt;
lt;column name=quot;idquot; length=quot;10quot; /gt;
lt;generator class=quot;nativequot; /gt;lt;/idgt;

lt;!-- Properties section --gt;
lt;property name=quot;processTypequot; type=quot;stringquot;gt;
lt;meta attribute=quot;use-in-tostringquot;gt;truelt;/metagt;
lt;meta attribute=quot;use-in-equalsquot;gt;truelt;/metagt;
lt;column name=quot;process_typequot; length=quot;80quot; not-null=quot;truequot; /gt;lt;/propertygt;

lt;property name=quot;processNumberquot; type=quot;integerquot;gt;
lt;meta attribute=quot;use-in-tostringquot;gt;truelt;/metagt;
lt;meta attribute=quot;use-in-equalsquot;gt;truelt;/metagt;
lt;column name=quot;process_numberquot; length=quot;10quot; not-null=quot;truequot; /gt;lt;/propertygt;

lt;property name=quot;objectIdquot; type=quot;stringquot;gt;
lt;meta attribute=quot;use-in-tostringquot;gt;truelt;/metagt;
lt;meta attribute=quot;use-in-equalsquot;gt;truelt;/metagt;
lt;column name=quot;object_idquot; length=quot;80quot; not-null=quot;truequot; /gt;lt;/propertygt;

lt;property name=quot;originIdquot; type=quot;stringquot;gt;
lt;meta attribute=quot;use-in-tostringquot;gt;truelt;/metagt;
lt;meta attribute=quot;use-in-equalsquot;gt;truelt;/metagt;
lt;column name=quot;origin_idquot; length=quot;80quot; not-null=quot;truequot; /gt;lt;/propertygt;

lt;property name=quot;rdKey1quot; type=quot;stringquot;gt;
lt;meta attribute=quot;use-in-tostringquot;gt;truelt;/metagt;
lt;meta attribute=quot;use-in-equalsquot;gt;truelt;/metagt;
lt;column name=quot;rd_key_1quot; length=quot;80quot; not-null=quot;truequot; /gt;lt;/propertygt;

lt;!-- i will use lazy loading for this set of documents --gt;
lt;set name=quot;documentsquot; table=quot;uvz_documentquot; inverse=quot;truequot;
cascade=quot;all-delete-orphanquot; lazy=quot;truequot;gt;
lt;key column=quot;register_of_documents_idquot; /gt;
lt;one-to-many class=quot;com.ibs.rdc.uvz.bo.Documentquot; /gt;lt;/setgt;lt;/classgt;lt;/hibernate-mappinggt;

this is my spring-hibernate config:

lt;!-- dataSource --gt;lt;bean id=quot;uvzDataSourcequot;
class=quot;org..jndi.JndiObjectFactoryB  eanquot;gt;
lt;property name=quot;jndiNamequot;gt;
lt;valuegt;${hibernate.connection.datasource.uvz}lt;/valuegt;lt;/propertygt;lt;/beangt;

lt;!-- session factory --gt;
lt;bean id=quot;uvzSessionFactoryquot;
class=quot;org..orm.hibernate3.LocalSes  sionFactoryBeanquot;gt;
lt;property name=quot;dataSourcequot; ref=quot;uvzDataSourcequot; /gt;
lt;property name=quot;hibernatePropertiesquot;gt;
lt;propsgt;
lt;prop key=quot;hibernate.dialectquot;gt;
${hibernate.dialect}
lt;/propgt;
lt;prop key=quot;hibernate.hbm2ddl.autoquot;gt;
${hibernate.hbm2ddl.auto}
lt;/propgt;

lt;prop key=quot;hibernate.jndi.uclquot;gt;
${hibernate.jndi.ucl}
lt;/propgt;

lt;prop key=quot;hibernate.jndi.classquot;gt;
${hibernate.jndi.class}
lt;/propgt;
lt;prop
key=quot;hibernate.transaction.manager_lookup_classquot;gt;
${hibernate.transaction.manager_lookup_class}
lt;/propgt;
lt;prop key=quot;hibernate.transaction.factory_classquot;gt;
${hibernate.transaction.factory_class}
lt;/propgt;
lt;prop key=quot;hibernate.cache.provider_classquot;gt;
${hibernate.cache.provider_class}
lt;/propgt;
lt;prop
key=quot;hibernate.cache.provider_configuration_file_r  esource_pathquot;gt;
${hibernate.cache.provider_configuration_file_reso  urce_path.uvz}
lt;/propgt;
lt;prop key=quot;hibernate.cache.use_second_level_cachequot;gt;
${hibernate.cache.use_second_level_cache}
lt;/propgt;
lt;prop key=quot;hibernate.cache.use_query_cachequot;gt;
${hibernate.cache.use_query_cache}
lt;/propgt;
lt;!--  
lt;prop key=quot;hibernate.cache.use_minimal_putsquot;gt;
${hibernate.cache.use_minimal_puts}
lt;/propgt;
--gt;

lt;prop key=quot;hibernate.show_sqlquot;gt;
${hibernate.show_sql}
lt;/propgt;
lt;prop key=quot;hibernate.format_sqlquot;gt;
${hibernate.format_sql}
lt;/propgt;
lt;prop key=quot;hibernate.use_sql_commentsquot;gt;
${hibernate.use_sql_comments}
lt;/propgt;
lt;prop
key=quot;hibernate.bytecode.use_reflection_optimizerquot;gt;
${hibernate.bytecode.use_reflection_optimizer}
lt;/propgt;
lt;prop key=quot;hibernate.max_fetch_depthquot;gt;
${hibernate.max_fetch_depth}
lt;/propgt;
lt;prop key=quot;hibernate.query.factory_classquot;gt;
${hibernate.query.factory_class}
lt;/propgt;
lt;/propsgt;lt;/propertygt;
lt;property name=quot;mappingLocationsquot;gt;
lt;listgt;
lt;valuegt;
classpath:/com/ibs/rdc/uvz/bo/hbm/Attachment.hbm.xml
lt;/valuegt;
lt;valuegt;
classpath:/com/ibs/rdc/uvz/bo/hbm/Document.hbm.xml
lt;/valuegt;
lt;valuegt;
classpath:/com/ibs/rdc/uvz/bo/hbm/DocumentText.hbm.xml
lt;/valuegt;
lt;valuegt;
classpath:/com/ibs/rdc/uvz/bo/hbm/Property.hbm.xml
lt;/valuegt;
lt;valuegt;
classpath:/com/ibs/rdc/uvz/bo/hbm/RegisterOfDocuments.hbm.xml
lt;/valuegt;
lt;valuegt;
classpath:/com/ibs/rdc/uvz/bo/hbm/Relation.hbm.xml
lt;/valuegt;lt;/listgt;lt;/propertygt;
lt;property name=quot;entityInterceptorquot; ref=quot;hibernateInterceptorquot;/gt;lt;/beangt;
lt;bean id=quot;hibernateInterceptorquot;
class=quot;org..orm.hibernate3.Hibernat  eInterceptorquot;gt;
lt;/beangt;
lt;!-- hibernate template -- gt;
lt;bean id=quot;uvzHibernateTemplatequot;
class=quot;org..orm.hibernate3.Hibernat  eTemplatequot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;

lt;!-- DAO objectss--gt;
lt;bean id=quot;com.ibs.rdc.uvz.dao.AttachmentDaoquot;
class=quot;com.ibs.rdc.uvz.dao.hibernate.AttachmentHib  ernateDaoImplquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;

lt;bean id=quot;com.ibs.rdc.uvz.dao.DocumentDaoquot;
class=quot;com.ibs.rdc.uvz.dao.hibernate.DocumentHiber  nateDaoImplquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;

lt;bean id=quot;com.ibs.rdc.uvz.dao.DocumentTextDaoquot;
class=quot;com.ibs.rdc.uvz.dao.hibernate.DocumentTextH  ibernateDaoImplquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;

lt;bean id=quot;com.ibs.rdc.uvz.dao.PropertyDaoquot;
class=quot;com.ibs.rdc.uvz.dao.hibernate.PropertyHiber  nateDaoImplquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;

lt;bean id=quot;com.ibs.rdc.uvz.dao.RegisterOfDocumentsDaoquot;
class=quot;com.ibs.rdc.uvz.dao.hibernate.RegisterOfDoc  umentsHibernateDaoImplquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;

lt;bean id=quot;com.ibs.rdc.uvz.dao.RelationDaoquot;
class=quot;com.ibs.rdc.uvz.dao.hibernate.RelationHiber  nateDaoImplquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;
lt;!-- facade Dao object. Access to all dao Objects --gt;
lt;bean id=quot;com.ibs.rdc.dao.facade.UvzFacadeDaoquot;
class=quot;com.ibs.rdc.dao.facade.UvzFacadeDaoImplquot;gt;
lt;property name=quot;attachmentDaoquot;
ref=quot;com.ibs.rdc.uvz.dao.AttachmentDaoquot; /gt;
lt;property name=quot;documentDaoquot;
ref=quot;com.ibs.rdc.uvz.dao.DocumentDaoquot; /gt;
lt;property name=quot;documentTextDaoquot;
ref=quot;com.ibs.rdc.uvz.dao.DocumentTextDaoquot; /gt;
lt;property name=quot;propertyDaoquot;
ref=quot;com.ibs.rdc.uvz.dao.PropertyDaoquot; /gt;
lt;property name=quot;registerOfDocumentsDaoquot;
ref=quot;com.ibs.rdc.uvz.dao.RegisterOfDocumentsDaoquot; /gt;
lt;property name=quot;relationDaoquot;
ref=quot;com.ibs.rdc.uvz.dao.RelationDaoquot; /gt;

lt;/beangt;

lt;!-- transaction config --gt;lt;bean id=quot;uvzTransactionManagerquot;
class=quot;org..orm.hibernate3.Hibernat  eTransactionManagerquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;lt;/beangt;
lt;tx:advice id=quot;uvzDaoTxAdvicequot;
transaction-manager=quot;uvzTransactionManagerquot;gt;
lt;tx:attributesgt;
lt;tx:method name=quot;getDocumentListOutquot; read-only=quot;truequot;
propagation=quot;REQUIREDquot; /gt;
lt;tx:method name=quot;saveDocumentsquot; read-only=quot;falsequot;
propagation=quot;REQUIREDquot; /gt;lt;/tx:attributesgt;lt;/tx:advicegt;
lt;aop:configgt;
lt;aopointcut id=quot;uvzDaoTxPoincutquot;
expression=quot;execution(* com.ibs.rdc.services.impl.util.*.*(..))quot; /gt;
lt;aop:advisor advice-ref=quot;uvzDaoTxAdvicequot;
pointcut-ref=quot;uvzDaoTxPoincutquot; /gt;lt;/aop:configgt;when i will load all documents of one registerOfDocuments, than i become this exception:

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.ibs.rdc.uvz.bo.RegisterOfDocuments.documents, no session or session was closed

i think that transaction or hibernate interceptor is wrong configured....

thak for advice

m.

Is it possible to see the stacktrace?  Are you programming to interfaces?  Is it possible to see the code that you are using?


Originally Posted by modrofuzI thought, that it goes with HibernateInterceptor, but it does not function.

when i will load all documents of one registerOfDocuments, than i become this exception:

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.ibs.rdc.uvz.bo.RegisterOfDocuments.documents, no session or session was closed

i think that transaction or hibernate interceptor is wrong configured....

I guess you are just accessing the collection when the session has already been closed, for example in a second request. OSIV does not self every problem for you, especially not transparent reattaching of objects to sessions.

Joerg

ponent.pojo.JavaClassComponent.in  voke(JavaClassComponent.java:99)
at weblogic.wsee.ws.dispatch.server.ComponentHandler.  handleRequest(ComponentHandler.java:64)
at weblogic.wsee.handler.HandlerIterator.handleReques  t(HandlerIterator.java:123)
at weblogic.wsee.ws.dispatch.server.ServerDispatcher.  dispatch(ServerDispatcher.java:85)
at weblogic.wsee.ws.WsSkel.invoke(WsSkel.java:80)
at weblogic.wsee.server.servlet.SoapProcessor.handleP  ost(SoapProcessor.java:66)
at weblogic.wsee.server.servlet.SoapProcessor.process  (SoapProcessor.java:44)
at weblogic.wsee.server.servlet.BaseWSServlet$Authori  zedInvoke.run(BaseWSServlet.java:257)
at weblogic.wsee.server.servlet.BaseWSServlet.service  (BaseWSServlet.java:156)
at javax.servlet.from.fromServlet.service(fromServlet  .java:820)
at weblogic.servlet.internal.StubSecurityHelper$Servl  etServiceAction.run(StubSecurityHelper.java:226)
at weblogic.servlet.internal.StubSecurityHelper.invok  eServlet(StubSecurityHelper.java:124)
at weblogic.servlet.internal.ServletStubImpl.execute(  ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.execute(  ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$Ser  vletInvocationAction.run(WebAppServletContext.java  :3370)
at weblogic.security.acl.internal.AuthenticatedSubjec  t.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Un  known Source)
at weblogic.servlet.internal.WebAppServletContext.sec  uredExecute(WebAppServletContext.java:2117)
at weblogic.servlet.internal.WebAppServletContext.exe  cute(WebAppServletContext.java:2023)
at weblogic.servlet.internal.ServletRequestImpl.run(S  ervletRequestImpl.java:1359)
at weblogic.work.ExecuteThread.execute(ExecuteThread.  java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java  :172)

I thougth, when i have my method in one transaction, than session is active and i need any lazy loading in my mappings...

thanks for help

Where is the Spring config for DocumentGetter class?

DocumentGetter class has no spring config.
I retrieve FacadeDao object from springUtils. FacadeDao object provides access to all Dao Objects.

this is code of Spring Utils:

public class SpringUtils implements Serializable {

/*** */private static final long serialVersionUID = 1L;

private static WebApplicationContext webApplicationContext;

private static boolean initialized = false;

private SpringUtils() {
}

protected static synchronized WebApplicationContext initialize(final ServletContext servletContext) {
if (webApplicationContext == null) {
webApplicationContext = WebApplicationContextUtils.getRequiredWebApplicati  onContext(servletContext);
initialized = true;}
return webApplicationContext;}

public static Object load(final String name) throws IllegalStateException {
if (!initialized)
throw new IllegalStateException(quot;SpringContext has not been initialized.quot;);return webApplicationContext.getBean(name);}

public static InputStream getInputStream(String path) {
return webApplicationContext.getServletContext().getResou  rceAsStream(path);}

public static WebApplicationContext getWebApplicationContext() {
return webApplicationContext;}

public static String getLocalizedMessage(String key, String language) {
return webApplicationContext.getMessage(key, new Object[0], new Locale(language));}

public static RdcFacadeDao getRdcFacadeDao() {
return (RdcFacadeDao) load(quot;com.ibs.rdc.dao.facade.RdcFacadeDaoquot;);}

public static UvzFacadeDao getUvzFacadeDao() {
return (UvzFacadeDao) load(quot;com.ibs.rdc.dao.facade.UvzFacadeDaoquot;);}}

and this is the coding of ConfigurationListener:public class ConfigurationListener extends ContextLoaderListener {
@Override
public void contextInitialized(final ServletContextEvent servletContextEvent) {
super.contextInitialized(servletContextEvent);
SpringUtils.initialize(servletContextEvent.getServ  letContext());}}

in web.xml intialize ConfigurationListener:

lt;listenergt;lt;listener-classgt;com.ibs.rdc.util.ConfigurationListenerlt;/listener-classgt;lt;/listenergt;DocumentGetter has method getDocumentListOut (see my previous post) which is wrapped with transaction (see my first post)

It really helps to use [code] [ /code] tags, it's impossible to read what's actually going on.

If you are not getting the instance from Spring you get no transactions, that's why I asked. Also, you need an interface or you have to turn on cglib proxies.

I must say, i am really frustrated. I think, I dont really uderstand this transactions concept. I have make some changes so i send all my coding one more time. with this code tags

DocumentGetter

Code:
public class DocumentGetter implements IDocumentGetter {

private UvzFacadeDao uvzFacadeDao;

public GetDocumentsOutput getDocumentsOutput(GetDocumentsInput getDocumentsInput) throws NoSuchDbObjectException {

DocumentListOut documentListOut = getDocuments(getDocumentsInput);
GetDocumentsOutput response = new GetDocumentsOutput();
response.setDocumentListOut(documentListOut);
response.setIsSuccessful(true);

return response;
}

/*** This method gets rdcBusinessProcess object from input. This method is* wrapped in transaction. see transaction.xml* * @param getDocumentsInput* @return List of converted documents* @throws NoSuchDbObjectException*/
public DocumentListOut getDocuments(GetDocumentsInput getDocumentsInput) throws NoSuchDbObjectException {
Setlt;Documentgt; documents;
RegisterOfDocuments registerOfDocuments;
registerOfDocuments = getRegisterOfDocuments(getDocumentsInput.getRdcBusinessProcess());
documents = registerOfDocuments.getDocuments();
DocumentListOut documentListOut = new DocumentListOut();
documentListOut.setRdcBusinessProcess(getDocumentsInput.getRdcBusinessProcess());
documentListOut.setDocument(getRequiredDocuments(documents));
String language = getDocumentsInput.getUsedLanguage() == null ? Constants.DEFAULT_LANGUAGE : getDocumentsInput
.getUsedLanguage();
documentListOut.setUsedLanguage(language);

return documentListOut;
}

/*** Method creates registerOfDocuments object and gets registerOfDocument it* from db and retruns it.* * @param rdcBusinessProcess* @return registerOfDocuments* @throws NoSuchDbObjectException*/
private RegisterOfDocuments getRegisterOfDocuments(RdcBusinessProcess rdcBusinessProcess)
throws NoSuchDbObjectException {
// RegisterOfDocumnets object setting
RegisterOfDocuments registerOfDocumentsBO = new RegisterOfDocuments();

registerOfDocumentsBO.setProcessType(rdcBusinessProcess.getProcessKey().getProcess());
registerOfDocumentsBO.setObjectId(rdcBusinessProcess.getProcessKey().getObject());
registerOfDocumentsBO.setOriginId(rdcBusinessProcess.getOrigin());
registerOfDocumentsBO.setRdKey1(rdcBusinessProcess.getObjectKey());
registerOfDocumentsBO.setProcessNumber(rdcBusinessProcess.getProcessNumber());

RDCLogger.getLogger().debug(registerOfDocumentsBO.getProcessType());
RDCLogger.getLogger().debug(registerOfDocumentsBO.getObjectId());
RDCLogger.getLogger().debug(registerOfDocumentsBO.getOriginId());
RDCLogger.getLogger().debug(registerOfDocumentsBO.getRdKey1());
RDCLogger.getLogger().debug(registerOfDocumentsBO.getProcessNumber().toString());
// DB accesssing

Listlt;?gt; registerOfDocumentsList = uvzFacadeDao.getRegisterOfDocumentsDao().findByExample(registerOfDocumentsBO);
if (!registerOfDocumentsList.isEmpty()) {
return (RegisterOfDocuments) registerOfDocumentsList.get(0);
} else {
RDCLogger.getLogger().debug(quot;register not foundquot;);
Listlt;Stringgt; messageList = new ArrayListlt;Stringgt;();
String messageText = new String(quot;rod: quot; + SpringUtils.getLocalizedMessage(quot;no.such.db.objectquot;, quot;enquot;)
+ quot; : RegisterOfDocuments object not found.quot;);
messageList.add(messageText);
Message message = MessageContainer.generateMessage(messageList, Constants.DEFAULT_LANGUAGE,
Severity.FATALERROR, quot;ibsquot;);
NoSuchDbObjectException e = new NoSuchDbObjectException(message);
throw e;
}
}

/*** This method iterate all documents from register and converts it to output objects.* @param documentList* @return list of documents as output*/
private Listlt;DocumentOutgt; getRequiredDocuments(Setlt;Documentgt; documentList) {

Listlt;DocumentOutgt; list = new ArrayListlt;DocumentOutgt;();
for (Document documentUvzBo : documentList) {
DocumentOut documentOut = new DocumentOut();
documentOut.setDocumentId(documentUvzBo.getDocumentType());
documentOut.setPropertyOut(new DocumentPropertiesOut());
setDocumentPropertiesOut(documentOut.getPropertyOut(), documentUvzBo);

list.add(documentOut);
}
return list;
}this is all my spring configuration:

HTML Code:
lt;bean id=quot;uvzDataSourcequot;
class=quot;org..jndi.JndiObjectFactoryBeanquot;gt;
lt;property name=quot;jndiNamequot;gt;
lt;valuegt;${hibernate.connection.datasource.uvz}lt;/valuegt;
lt;/propertygt;
lt;/beangt;
lt;bean id=quot;uvzSessionFactoryquot;
class=quot;org..orm.hibernate3.LocalSessionFactoryBeanquot;gt;
lt;property name=quot;dataSourcequot; ref=quot;uvzDataSourcequot; /gt;
lt;property name=quot;hibernatePropertiesquot;gt;
lt;propsgt;
...
lt;/propsgt;
lt;/propertygt;
lt;property name=quot;mappingLocationsquot;gt;
lt;listgt;
lt;valuegt;
classpath:/com/ibs/rdc/uvz/bo/hbm/Attachment.hbm.xml
lt;/valuegt;
lt;valuegt;
classpath:/com/ibs/rdc/uvz/bo/hbm/Document.hbm.xml
lt;/valuegt;
lt;valuegt;
classpath:/com/ibs/rdc/uvz/bo/hbm/DocumentText.hbm.xml
lt;/valuegt;
lt;valuegt;
classpath:/com/ibs/rdc/uvz/bo/hbm/Property.hbm.xml
lt;/valuegt;
lt;valuegt;
classpath:/com/ibs/rdc/uvz/bo/hbm/RegisterOfDocuments.hbm.xml
lt;/valuegt;
lt;valuegt;
classpath:/com/ibs/rdc/uvz/bo/hbm/Relation.hbm.xml
lt;/valuegt;
lt;/listgt;
lt;/propertygt;
lt;/beangt;
lt;bean id=quot;uvzHibernateTemplatequot;
class=quot;org..orm.hibernate3.HibernateTemplatequot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;

lt;bean id=quot;com.ibs.rdc.uvz.dao.AttachmentDaoquot;
class=quot;com.ibs.rdc.uvz.dao.hibernate.AttachmentHibernateDaoImplquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;

lt;bean id=quot;com.ibs.rdc.uvz.dao.DocumentDaoquot;
class=quot;com.ibs.rdc.uvz.dao.hibernate.DocumentHibernateDaoImplquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;

lt;bean id=quot;com.ibs.rdc.uvz.dao.DocumentTextDaoquot;
class=quot;com.ibs.rdc.uvz.dao.hibernate.DocumentTextHibernateDaoImplquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;

lt;bean id=quot;com.ibs.rdc.uvz.dao.PropertyDaoquot;
class=quot;com.ibs.rdc.uvz.dao.hibernate.PropertyHibernateDaoImplquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;

lt;bean id=quot;com.ibs.rdc.uvz.dao.RegisterOfDocumentsDaoquot;
class=quot;com.ibs.rdc.uvz.dao.hibernate.RegisterOfDocumentsHibernateDaoImplquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;

lt;bean id=quot;com.ibs.rdc.uvz.dao.RelationDaoquot;
class=quot;com.ibs.rdc.uvz.dao.hibernate.RelationHibernateDaoImplquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;

lt;bean id=quot;com.ibs.rdc.dao.facade.UvzFacadeDaoquot;
class=quot;com.ibs.rdc.dao.facade.UvzFacadeDaoImplquot;gt;
lt;property name=quot;attachmentDaoquot;
ref=quot;com.ibs.rdc.uvz.dao.AttachmentDaoquot; /gt;
lt;property name=quot;documentDaoquot;
ref=quot;com.ibs.rdc.uvz.dao.DocumentDaoquot; /gt;
lt;property name=quot;documentTextDaoquot;
ref=quot;com.ibs.rdc.uvz.dao.DocumentTextDaoquot; /gt;
lt;property name=quot;propertyDaoquot;
ref=quot;com.ibs.rdc.uvz.dao.PropertyDaoquot; /gt;
lt;property name=quot;registerOfDocumentsDaoquot;
ref=quot;com.ibs.rdc.uvz.dao.RegisterOfDocumentsDaoquot; /gt;
lt;property name=quot;relationDaoquot;
ref=quot;com.ibs.rdc.uvz.dao.RelationDaoquot; /gt;

lt;/beangt;

lt;bean id=quot;uvzTransactionManagerquot;
class=quot;org..orm.hibernate3.HibernateTransactionManagerquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;uvzSessionFactoryquot; /gt;
lt;/beangt;
lt;tx:advice id=quot;uvzDaoTxAdvicequot;
transaction-manager=quot;uvzTransactionManagerquot;gt;
lt;tx:attributesgt;
lt;tx:method name=quot;getDocumentsquot; read-only=quot;truequot;
propagation=quot;REQUIREDquot; /gt;
lt;tx:method name=quot;saveDocumentsquot; read-only=quot;falsequot;
propagation=quot;REQUIREDquot; /gt;
lt;tx:method name=quot;setDocumentsquot; read-only=quot;falsequot;
propagation=quot;REQUIREDquot; /gt;
lt;/tx:attributesgt;
lt;/tx:advicegt;
lt;aop:configgt;
lt;aop:pointcut id=quot;uvzDaoTxPoincutquot;
expression=quot;execution(* com.ibs.rdc.services.impl.util.Document*.*(..))quot; /gt;
lt;aop:advisor advice-ref=quot;uvzDaoTxAdvicequot;
pointcut-ref=quot;uvzDaoTxPoincutquot; /gt;
lt;/aop:configgt;

lt;bean id=quot;DocumentGetterquot;
class=quot;com.ibs.rdc.services.impl.util.DocumentGetterquot;gt;
lt;property name=quot;uvzFacadeDaoquot;
ref=quot;com.ibs.rdc.dao.facade.UvzFacadeDaoquot; /gt;
lt;/beangt;
When i use lazy=quot;falsequot; all goes good, but i dont want to use that. I was wondering, when i comment my transaction config out and turn lazy loading off all goes good too. so that means, that my transactions is not used as you sad. I thought, that without transaction i can do any request do DB?.

So i tried create object DocumentGetter in spring, but i become the same exception.
¥
Back Forum Reply New