Announcement Announcement Module
Collapse
No announcement yet.
HibernateTransactionManager doesn't work Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • HibernateTransactionManager doesn't work

    I want to use transactions in my application and my settings are like this:

    Code:
           <bean id="userDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    			<property name="driverClassName">
    				<value>${db.driver}</value>
    			</property>
    			<property name="url">
    				<value>${db.url}</value>
    			</property>
    			<property name="username">
    				<value>${user.name}</value>
    			</property>
    			<property name="password">
    				<value>${user.password}</value>
    			</property>			 
    			<property name="maxActive">
    				<value>15</value>
    			</property>		
      	</bean>        
    
    
           <bean id="userSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">				
    		<property name="dataSource"><ref local="userDataSource"/></property>
    		<property name="configLocation">
    			<value>/WEB-INF/hibernate.cfg.xml</value>
    		</property>
    		
    		<property name="hibernateProperties">
    			<props>						
    				<prop key="hibernate.dialect">${hibernate.dialect}</prop>
    				<prop key="hibernate.show_sql">true</prop>
    				<prop key="hibernate.current_session_context_class">thread</prop>
    				<prop key="hibernate.max_fetch_depth">3</prop>
    				
    				<prop key="hibernate.connection.pool_size">3</prop>
    				<prop key="hibernate.connection.isolation">2</prop>
    				<prop key="hibernate.connection.release_mode">after_transaction</prop>
    				<prop key="hibernate.bytecode.use_reflection_optimizer">true</prop>
    				<prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
    				<prop key="hibernate.use_outer_join">true</prop>																		
    			</props>
    		</property>
    	</bean>
    
           <bean id="userFacade" class="org.bivela.business.facade.UserFacade">
    		<property name="sessionFactory"><ref bean="userSessionFactory" /></property>
    	</bean>
    
    
            <bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory">
    			<ref bean="userSessionFactory"/>
    		</property>
    	</bean>
    	
    	<bean id="userTransactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
    		<property name="transactionManager">
    			<ref local="hibernateTransactionManager"/>
    		</property>
    		<property name="transactionAttributeSource">
    			<value>
    				org.bivela.business.facade.UserFacadeInterface.updateShareholders=PROPAGATION_REQUIRED
    			</value>
    		</property>
    	</bean>
    	
    	<bean id="userProxyService" class="org.springframework.aop.framework.ProxyFactoryBean">
    		<property name="proxyInterfaces">
    			<value>org.bivela.business.facade.UserFacadeInterface</value>
    		</property>
    		<property name="interceptorNames">
    			<list>
    				<value>userTransactionInterceptor</value>
    				<value>userFacade</value>
    			</list>
    		</property>
    	</bean>

    my servlet configuration where I have all actions in application looks like

    Code:
    <bean id="InsertNewShareholdersController" class="org.bivela.controllers.users.shareholders.InsertNewShareholders" lazy-init="true">
    				<property name="facade"><ref bean="userProxyService" /></property>
    			</bean>

    and this method which requires transaction have some queries to database and at the end saves new object in database

    Code:
    public class UserFacade extends HibernateDaoSupport implements
    		UserFacadeInterface {
    
    public void updateShareholders(int companyId, List<Shares> newShares)
    			throws HibernateException {
    		try {
                    Shares oneShare = new Shares();
    		oneShare.setChangeDate(new Date());
                      .....
                     // moment where I have my problem
    
                     List shareExists = getHibernateTemplate().find(
    							"select share from Shareholders share"
    									+ " JOIN FETCH share.company company"
    									+ " WHERE company.id = ?",
    							companyHolder.getId());
                    if (shareExists.isEmpty()) {
    						saveShareholder = getHibernateTemplate().save(
    								shareholder);
    						oneShare
    								.setShareholder((Shareholders) getHibernateTemplate()
    										.get(Shareholders.class,
    												saveShareholder));
    					} else {
    						oneShare.setShareholder((Shareholders) shareExists
    								.get(0));
    					}
    
                                            // here I get the exception
                                            getHibernateTemplate().save(oneShare);
    
                    } catch (Exception e) {
    			throw new HibernateException(e.toString());
    		}
    and my exception:
    Code:
    org.hibernate.HibernateException: org.springframework.orm.hibernate3.HibernateSystemException: could not initialize proxy - no Session; nested exception is org.hibernate.LazyInitializationException: could not initialize proxy - no Session
    	org.bivela.business.facade.UserFacade.updateShareholders(UserFacade.java:1399)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	java.lang.reflect.Method.invoke(Method.java:585)
    	org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
    	org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
    	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
    	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
    	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
    	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
    	$Proxy57.updateShareholders(Unknown Source)
    	org.bivela.controllers.users.shareholders.InsertNewShareholders.handleRequest(InsertNewShareholders.java:40)
    	org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:45)
    	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:820)
    	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:755)
    	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
    	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:360)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    	org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
    	org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
    	org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
    	org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
    	org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217)
    	org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
    	org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
    	org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
    	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

    It looks like I have simple exception with lazy initialization, because in hibernate's xml files I have default settings (proxy), but I have fetch joining in my query and I think that should be working (and it worked until I put a proxy bean).

  • #2
    I looked to debug file and it's very interesting, because at the beggining query is executed with fetch join and than it's replaced by inner join. Take a look:

    Code:
    2007-06-28 14:44:03,227 DEBUG [org.hibernate.hql.ast.QueryTranslatorImpl] parse() - HQL: 
    
    select share from org.bivela.dto.bivela.Shareholders share JOIN FETCH share.company company WHERE company.id = ?
    
    
    2007-06-28 14:44:03,238 DEBUG [org.hibernate.hql.ast.AST] --- HQL AST ---
     \-[QUERY] 'query'
        +-[SELECT_FROM] 'SELECT_FROM'
        |  +-[FROM] 'from'
        |  |  +-[RANGE] 'RANGE'
        |  |  |  +-[DOT] '.'
        |  |  |  |  +-[DOT] '.'
        |  |  |  |  |  +-[DOT] '.'
        |  |  |  |  |  |  +-[DOT] '.'
        |  |  |  |  |  |  |  +-[IDENT] 'org'
        |  |  |  |  |  |  |  \-[IDENT] 'bivela'
        |  |  |  |  |  |  \-[IDENT] 'dto'
        |  |  |  |  |  \-[IDENT] 'bivela'
        |  |  |  |  \-[IDENT] 'Shareholders'
        |  |  |  \-[ALIAS] 'share'
        |  |  \-[JOIN] 'JOIN'
        |  |     +-[FETCH] 'FETCH'
        |  |     +-[DOT] '.'
        |  |     |  +-[IDENT] 'share'
        |  |     |  \-[IDENT] 'company'
        |  |     \-[ALIAS] 'company'
        |  \-[SELECT] 'select'
        |     \-[IDENT] 'share'
        \-[WHERE] 'WHERE'
           \-[EQ] '='
              +-[DOT] '.'
              |  +-[IDENT] 'company'
              |  \-[IDENT] 'id'
              \-[PARAM] '?'
    
    2007-06-28 14:44:03,239 DEBUG [org.hibernate.hql.ast.ErrorCounter] throwQueryException() : no errors
    2007-06-28 14:44:03,239 DEBUG [org.hibernate.hql.antlr.HqlSqlBaseWalker] select << begin [level=1, statement=select]
    2007-06-28 14:44:03,240 DEBUG [org.hibernate.hql.ast.tree.FromElement] FromClause{level=1} :  org.bivela.dto.bivela.Shareholders (share) -> shareholde0_
    2007-06-28 14:44:03,240 DEBUG [org.hibernate.hql.ast.tree.FromReferenceNode] Resolved :  share -> shareholde0_.id
    2007-06-28 14:44:03,240 DEBUG [org.hibernate.hql.ast.tree.DotNode] getDataType() : company -> org.hibernate.type.ManyToOneType(org.bivela.dto.bivela.Companies)
    2007-06-28 14:44:03,240 DEBUG [org.hibernate.hql.ast.tree.DotNode] dereferenceEntityJoin() : generating join for company in org.bivela.dto.bivela.Shareholders (company) parent = [ {null} ]
    2007-06-28 14:44:03,240 DEBUG [org.hibernate.hql.ast.tree.FromElement] FromClause{level=1} :  org.bivela.dto.bivela.Companies (company) -> companies1_
    2007-06-28 14:44:03,240 DEBUG [org.hibernate.hql.ast.tree.FromClause] addJoinByPathMap() : share.company -> Companies companies1_
    2007-06-28 14:44:03,240 DEBUG [org.hibernate.hql.ast.tree.FromReferenceNode] Resolved :  share.company -> shareholde0_.Companies_id
    2007-06-28 14:44:03,241 DEBUG [org.hibernate.hql.ast.HqlSqlWalker] createFromJoinElement() : -- join tree --
     \-[JOIN_FRAGMENT] FromElement: 'Companies companies1_' FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=company,role=null,tableName=Companies,tableAlias=companies1_,origin=Shareholders shareholde0_,colums={shareholde0_.Companies_id ,className=org.bivela.dto.bivela.Companies}}
    
    2007-06-28 14:44:03,242 DEBUG [org.hibernate.hql.ast.tree.FromReferenceNode] Resolved :  share -> shareholde0_.id
    2007-06-28 14:44:03,242 DEBUG [org.hibernate.hql.ast.tree.FromReferenceNode] Resolved :  company -> companies1_.id
    2007-06-28 14:44:03,242 DEBUG [org.hibernate.hql.ast.tree.DotNode] getDataType() : id -> org.hibernate.type.IntegerType@d6c6ea
    2007-06-28 14:44:03,242 DEBUG [org.hibernate.hql.ast.tree.FromReferenceNode] Resolved :  company.id -> companies1_.id
    2007-06-28 14:44:03,242 DEBUG [org.hibernate.hql.antlr.HqlSqlBaseWalker] select : finishing up [level=1, statement=select]
    2007-06-28 14:44:03,242 DEBUG [org.hibernate.hql.ast.HqlSqlWalker] processQuery() :  ( SELECT ( {select clause} shareholde0_.id ) ( FromClause{level=1} ( Shareholders shareholde0_ Companies companies1_ ) ) ( WHERE ( = ( companies1_.id companies1_.id id ) ? ) ) )
    2007-06-28 14:44:03,243 DEBUG [org.hibernate.hql.ast.util.JoinProcessor] Using FROM fragment [Shareholders shareholde0_]
    2007-06-28 14:44:03,243 DEBUG [org.hibernate.hql.ast.util.JoinProcessor] 
    
                              Using FROM fragment [inner join Companies companies1_ on shareholde0_.Companies_id=companies1_.id]
    
    
    2007-06-28 14:44:03,243 DEBUG [org.hibernate.hql.antlr.HqlSqlBaseWalker] select >> end [level=1, statement=select]
    2007-06-28 14:44:03,245 DEBUG [org.hibernate.hql.ast.AST] --- SQL AST ---

    I don't know than if it's hibernate or sping fault, because everything was working without proxyfactorybean.

    Can somebody explain me what I've done wrong and how to configurate all beans to work properly?

    Comment


    • #3
      It is due to your misconfiguration.

      Code:
      <property name="interceptorNames">
      	<list>
      		<value>userTransactionInterceptor</value>
      		<value>userFacade</value>
      	</list>
      </property>
      Your userFacade bean is not an interceptor it is the target of your ProxyFactoryBean. Or even better would be to make your userFacade an anonymous innerbean

      Code:
      <bean id="userProxyService" class="org.springframework.aop.framework.ProxyFactoryBean">
      	<property name="proxyInterfaces">			
      		<value>org.bivela.business.facade.UserFacadeInterface</value>
      	</property>
      	<property name="target" ref="userFacade">
      	<property name="interceptorNames">
      		<list>
      			<value>userTransactionInterceptor</value>
      		</list>
      	</property>
      </bean>
      After this modification also make sure that you inject the userProxyService into the beans instead of the userFace. (Hence my tip to define that one as an anonymous inner bean).

      Another option would be using the BeanNameAutoProxyCreator, that way you only have to specify the bean names and proxies will be created for you, that way you can configure your beans as usual and don't need to explicitly wrap them in a ProxyFactoryBean. If you have another bean which needs transactions simply add them to the list of beannames.

      Code:
      <bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">	
      	<property name="interceptorNames">
      		<list>
      			<value>userTransactionInterceptor</value>
      		</list>
      	</property>
      	<property name="beanNames">
      		<list>
      			<value>userFacade</value>
      		</list>
      	</property>
      </bean>
      Last edited by Marten Deinum; Jun 28th, 2007, 10:23 AM.

      Comment


      • #4
        I set 'target' property in ProxyFactoryBean and now I get exception:

        Code:
        org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.aop.AopInvocationException: AOP configuration seems to be invalid: tried calling method [public abstract void org.bivela.business.facade.UserFacadeInterface.updateShareholders(int,java.util.List) throws org.hibernate.HibernateException] on target [userFacade]; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
        I checked my arguments which are passed to this method and everything seems to be OK, so where is an error?

        Comment


        • #5
          Did you remove your userFacade from the list of interceptors?

          Comment


          • #6
            Yes, of course. I have the same settings as you gave me. So in interceptorNames I have only transactionInterceptor.

            Comment


            • #7
              Is there anymore log information, this actually seems to be a HibernateException.
              Last edited by karldmoore; Aug 29th, 2007, 11:15 AM.

              Comment


              • #8
                Ok, I now I don't have exception, which I wrote last time
                Code:
                org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.aop.AopInvocationException: AOP configuration seems to be invalid: tried calling method [public abstract void org.bivela.business.facade.UserFacadeInterface.updateShareholders(int,java.util.List) throws org.hibernate.HibernateException] on target [userFacade]; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
                and my proxy configuration looks like:

                Code:
                	<bean id="userProxyService" class="org.springframework.aop.framework.ProxyFactoryBean">
                		<property name="proxyInterfaces">
                			<value>org.bivela.business.facade.UserFacadeInterface</value>
                		</property>
                		<property name="target" ref="userFacade" />
                		<property name="interceptorNames">
                			<list>				
                				<value>userTransactionInterceptor</value>				
                			</list>
                		</property>
                	</bean>
                and I get HibernateException again:

                Code:
                org.hibernate.HibernateException: org.springframework.orm.hibernate3.HibernateSystemException: could not initialize proxy - the owning Session was closed; nested exception is org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
                	org.bivela.business.facade.UserFacade.updateShareholders(UserFacade.java:1398)
                	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                	java.lang.reflect.Method.invoke(Method.java:585)
                	org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
                Can anybody help me?

                Comment


                • #9
                  It is not the same exception:
                  Code:
                  could not initialize proxy - no Session
                  Code:
                  the owning Session was closed
                  From creating the Shares object until saving it what operations do you perform on it ?

                  Comment


                  • #10
                    Generally, my method looks like this:

                    Code:
                    public void updateShareholders(int companyId, List newShares)throws Exception{
                    try{	
                    			Companies company = this.getCompanyObject(companyId);
                    			Iterator iter = newShares.iterator();			
                    			while(iter.hasNext()){
                    				Shares oneShare = (Shares)iter.next();
                    				oneShare.setChangeDate(new Date());
                    				//set company id if it's empty
                    				if(oneShare.getCompany() == null)
                    					oneShare.setCompany(company);
                    				
                    				Shareholders shareholder = oneShare.getShareholder();
                    				Serializable saveShareholder = null;
                    					
                    				Companies companyHolder = (Companies)shareholder.getCompany();
                    				List shareExists = getHibernateTemplate().find("select share from Shareholders share" +
                    				" JOIN FETCH share.company company" +
                    				" WHERE company.id = ?", companyHolder.getId());
                    					
                    					//if there isn't the same shareholder
                    					//else get shareholder from database
                    					if(shareExists.isEmpty()){
                    						saveShareholder = getHibernateTemplate().save(shareholder);
                    						oneShare.setShareholder((Shareholders)getHibernateTemplate().get(Shareholders.class, saveShareholder));
                    						//shareholder = (Shareholders)getHibernateTemplate().get(Shareholders.class, saveShareholder);
                    					}else{										
                    						//shareholder = (Shareholders)shareExists.get(0);
                    						oneShare.setShareholder((Shareholders)shareExists.get(0));
                    						
                    					}
                    				}
                    				//oneShare.setShareholder(shareholder);
                    				
                    				//save new share in database				
                    				getHibernateTemplate().save(oneShare);				
                    								
                    			}
                    			
                    		}catch(Exception e){
                    			throw new Exception(e.toString());
                    		}
                    
                    }
                    but now, when I've changed exception from HibernateException to general Exception I get exception like this:

                    Code:
                    org.hibernate.AssertionFailure: null id in org.bivela.dto.bivela.Shares entry (don't flush the Session after an exception occurs)
                    	org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:55)
                    	org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:157)
                    	org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:113)
                    	org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
                    	org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
                    	org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
                    	org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
                    	org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
                    	org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)

                    Comment


                    • #11
                      I suspect you have passed a child entity or collection, which is initialized in other session, to Shares entity and, when saving, Hibernate tries to save the child entity or collection and thus resulting in lazy-init exception.

                      Comment


                      • #12
                        Yes, exactly. Andrei Stefan thanks a lot for your tips. It was one of the childes collection that was initialized in earlier session.

                        But now I have another problem, because my transaction doesn't rollback when there is an exception.

                        Comment


                        • #13
                          If it's a runtime exception, the rollback will be done automatically. If it's another exception, you have to specify this in your transaction interceptor attributes:
                          http://www.springframework.org/docs/...tributeSource)
                          http://www.springframework.org/docs/...Attribute.html

                          Comment


                          • #14
                            Originally posted by Andrei Stefan View Post
                            If it's a runtime exception, the rollback will be done automatically. If it's another exception, you have to specify this in your transaction interceptor attributes
                            Indeed, the root exception is effectively thrown away and wrapped.
                            Code:
                            throw new Exception(e.toString());
                            Last edited by karldmoore; Aug 29th, 2007, 11:14 AM.

                            Comment


                            • #15
                              Ok, I don't have code for tests, but to check my transactions I throw exception in my code. Lets say after first loop's run and then hibernateexception is thrown. Unfortunatelly, there is no rollback

                              I added to configuration file some changes:

                              Code:
                                     <bean id="userTransactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
                              		<property name="transactionManager">
                              			<ref local="hibernateTransactionManager"/>
                              		</property>
                              		<property name="transactionAttributeSource">
                              			<value>
                              				org.bivela.business.facade.UserFacadeInterface.updateShareholders=PROPAGATION_REQUIRED,+HibernateException
                              			</value>
                              		</property>
                              	</bean>
                              and my debug file looks like:

                              Code:
                              2007-07-02 08:44:36,020 DEBUG [org.hibernate.engine.StatefulPersistenceContext] initializing non-lazy collections
                              2007-07-02 08:44:36,021 DEBUG [org.springframework.orm.hibernate3.HibernateTemplate] Not closing pre-bound Hibernate Session after HibernateTemplate
                              2007-07-02 08:44:36,021 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] Completing transaction for [org.bivela.business.facade.UserFacadeInterface.updateShareholders] after exception: java.lang.Exception: org.hibernate.HibernateException: Blad wymuszony
                              2007-07-02 08:44:36,021 DEBUG [org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] Applying rules to determine whether transaction should rollback on java.lang.Exception: org.hibernate.HibernateException: Blad wymuszony
                              2007-07-02 08:44:36,021 DEBUG [org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] Winning rollback rule is: null
                              2007-07-02 08:44:36,021 DEBUG [org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] No relevant rollback rule found: applying superclass default
                              2007-07-02 08:44:36,022 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] Triggering beforeCommit synchronization
                              2007-07-02 08:44:36,035 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] Triggering beforeCompletion synchronization
                              2007-07-02 08:44:36,036 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] Initiating transaction commit
                              2007-07-02 08:44:36,036 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] Committing Hibernate transaction on Session [org.hibernate.impl.SessionImpl@869e8f]
                              2007-07-02 08:44:36,036 DEBUG [org.hibernate.transaction.JDBCTransaction] commit
                              2007-07-02 08:44:36,036 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] processing flush-time cascades
                              2007-07-02 08:44:36,036 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] dirty checking collections
                              2007-07-02 08:44:36,037 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 insertions, 0 updates, 0 deletions to 6 objects
                              2007-07-02 08:44:36,038 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
                              2007-07-02 08:44:36,038 DEBUG [org.hibernate.pretty.Printer] listing entities:
                              2007-07-02 08:44:36,038 DEBUG [org.hibernate.pretty.Printer] org.bivela.dto.bivela.Companies{purpose=money, employeesNumber=123, country=org.bivela.dto.bivela.Countries#1, zipCode=12345, companyStatus=SA, address=Doki 2, state=pomorskie, capital=123423, fiscalPeriod=01-01, name=Sunreef Yachts, city=gdansk, id=1}
                              2007-07-02 08:44:36,038 DEBUG [org.hibernate.pretty.Printer] org.bivela.dto.bivela.Companies{purpose=money, employeesNumber=123, country=org.bivela.dto.bivela.Countries#1, zipCode=12345, companyStatus=SARL, address=Doki 2, state=pomorskie, capital=123, fiscalPeriod=01-01, name=htep, city=Gdansk, id=2}
                              2007-07-02 08:44:36,038 DEBUG [org.hibernate.pretty.Printer] org.bivela.dto.bivela.Companies{purpose=fdksf, employeesNumber=123, country=org.bivela.dto.bivela.Countries#1, zipCode=12345, companyStatus=SARL, address=Doki 2, state=pomorskie, capital=123, fiscalPeriod=01-01, name=htep2, city=gdansk, id=3}
                              2007-07-02 08:44:36,047 DEBUG [org.hibernate.pretty.Printer] org.bivela.dto.bivela.Shares{shareholder=org.bivela.dto.bivela.Shareholders#1, changeDate=2007-07-02 08:44:35, quantity=60.00, id=8, company=org.bivela.dto.bivela.Companies#1}
                              2007-07-02 08:44:36,048 DEBUG [org.hibernate.pretty.Printer] org.bivela.dto.bivela.Shareholders{contact=null, type=artificial person, id=1, company=org.bivela.dto.bivela.Companies#2}
                              2007-07-02 08:44:36,048 DEBUG [org.hibernate.pretty.Printer] org.bivela.dto.bivela.Shareholders{contact=null, type=artificial person, id=3, company=org.bivela.dto.bivela.Companies#3}
                              2007-07-02 08:44:36,420 DEBUG [org.hibernate.transaction.JDBCTransaction] re-enabling autocommit
                              2007-07-02 08:44:36,420 DEBUG [org.hibernate.transaction.JDBCTransaction] committed JDBC Connection
                              2007-07-02 08:44:36,421 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
                              2007-07-02 08:44:36,421 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
                              2007-07-02 08:44:36,421 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] Triggering afterCommit synchronization
                              2007-07-02 08:44:36,421 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] Triggering afterCompletion synchronization
                              2007-07-02 08:44:36,421 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] Clearing transaction synchronization
                              2007-07-02 08:44:36,422 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] Removed value [org.springframework.orm.hibernate3.SessionHolder@142022d] for key [org.hibernate.impl.SessionFactoryImpl@1c1c9dc] from thread [http-0.0.0.0-8443-2]
                              2007-07-02 08:44:36,422 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] Removed value [org.springframework.jdbc.datasource.ConnectionHolder@1233bdc] for key [org.apache.commons.dbcp.BasicDataSource@5c2445] from thread [http-0.0.0.0-8443-2]
                              2007-07-02 08:44:36,422 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] Closing Hibernate Session [org.hibernate.impl.SessionImpl@869e8f] after transaction
                              2007-07-02 08:44:36,422 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] Closing Hibernate Session
                              2007-07-02 08:44:36,422 DEBUG [org.springframework.web.servlet.DispatcherServlet] Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@15d63da
                              2007-07-02 08:44:36,423 DEBUG [org.springframework.web.servlet.DispatcherServlet] Could not complete request
                              java.lang.Exception: org.hibernate.HibernateException: Blad wymuszony
                              	at org.bivela.business.facade.UserFacade.updateShareholders(UserFacade.java:1393)
                              What am I doing wrong?

                              Comment

                              Working...
                              X