Announcement Announcement Module
Collapse
No announcement yet.
handling transient entity in delete processing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • handling transient entity in delete processing

    I have exception in my "delete" method but similar "add" method working correct.
    Please help me with my problem))
    Code:
    26.03.2012 21:33:41 org.hibernate.event.internal.DefaultDeleteEventListener deleteTransientEntity
    INFO: HHH000114: Handling transient entity in delete processing
    Code:
    	public void delBlockedProcess(String ip, String nameBlockProcess) throws SQLException{
    		Session session = null;	
    		
    		try{
    			BlockedProcess exemBlock = new BlockedProcess();
    			exemBlock.setClientIP_id(ip);
    			exemBlock.setBlockedName(nameBlockProcess);
    			session = factory.openSession();
    			session.beginTransaction();
    			session.delete(exemBlock);
    			session.getTransaction().commit();
    		}catch(Exception ex){
    			System.out.println("Error in delBlockedNameByIP  " + ex.getMessage());
    		}finally{
    			if(session != null && session.isOpen()){
    				
    				session.close();
    			}
    			
    		}
    		
    	}
    Code:
    <bean id="propertyConfigurer"  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    
        <property name="location" value="/WEB-INF/jdbc.properties" />
    
    </bean>
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    
        <property name="driverClassName" value="${jdbc.driverClassName}" />
    
        <property name="url" value="${jdbc.databaseurl}" />
    
        <property name="username" value="${jdbc.username}" />
    
        <property name="password" value="${jdbc.password}" />
    
    </bean>
    <bean id="mySessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
                      
                      <property name="mappingResources">
                            <list>                            
                                <value>springapp/hibernate_logic/ClientIP.hbm.xml</value> 
        						<value>springapp/hibernate_logic/StartProcess.hbm.xml</value> 
        						<value>springapp/hibernate_logic/BlockedProcess.hbm.xml</value>                  
                            </list>
                        </property>
                       <property name="hibernateProperties">
                       <props>                    
                        <prop key="hibernate.dialect">${jdbc.dialect}</prop>
                        <prop key="hibernate.show_sql">true</prop>
                       </props>
                       </property>
                        <property name="dataSource">
                            <ref bean="dataSource"/>
                        </property>
                         
                    </bean>
    Last edited by _exp_; Apr 1st, 2012, 02:47 AM.
Working...
X