Hi,
I get the following error dont know what is happening?

Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL):
Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker
from transaction definition.

My code is 
PersonManagerImpl

public class PersonManagerImpl extends GenericManagerImpl<Person, Long>
implements PersonManager { 
    
    
        PersonDao personDao; 
        GenericManager<Address, Long> addressManager;
        //private Person person = new Person();
 
    public PersonManagerImpl(PersonDao personDao) { 
        super(personDao); 
        this.personDao = personDao; 
        /*for(Iterator it=person.getAddresses().iterator();it.hasNext();){
                Address addr=(Address)it.next();
                addr.setPerson(person);
                personDao.save(person);                 
        }*/
    } 
    public void setAddressManager(GenericManager<Address, Long>
addressManager){
        this.addressManager = addressManager;
    }
 
    public List<Person> findByLastName(String lastName) { 
        return personDao.findByLastName(lastName); 
    }
    
    public void save(Person person){
        personDao.save(person);
        for (Iterator iter = person.getAddresses().iterator(); iter.hasNext();)
{
                        Address address = (Address) iter.next();
                        address.setPerson(person);
                        addressManager.save(address);
                }
        personDao.save(person);
    }
    
} 

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://www.springframework.org/schema/beans 
      http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>

    <bean id="personDao"
class="com.mycompany.app.model.dao.hibernate.PersonDaoHibernate">  
        <property name="sessionFactory" ref="sessionFactory"/> 
    </bean>  
        <bean id="addressManager"
class="org.appfuse.service.impl.GenericManagerImpl">
        <constructor-arg>          
                <bean class="org.appfuse.dao.hibernate.GenericDaoHibernate"
autowire="byType">              
                <constructor-arg
value="com.mycompany.app.model.model.Address"/>          
                </bean>      
        </constructor-arg>
        </bean> 

        <bean id="personManager"
class="com.mycompany.app.model.service.impl.PersonManagerImpl">
        <constructor-arg ref="personDao" />
            <property name="addressManager" ref="addressManager" />
        </bean> 

        <bean id="personAction"
                class="com.mycompany.app.model.webapp.action.PersonAction"
                scope="prototype">
                <property name="personManager" ref="personManager" />
        </bean>

</beans>
-- 
View this message in context: 
http://www.nabble.com/Data-Access-Failure-tf3692048s2369.html#a10322638
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to