Announcement Announcement Module
Collapse
No announcement yet.
Struts 1.2.4,Ibatis 2.1.0,Spring 1.2.1 No multiple rollback! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Struts 1.2.4,Ibatis 2.1.0,Spring 1.2.1 No multiple rollback!

    Hi all!
    I'm a newbie and i've a problem:
    Following istructions made by equinox-ibatis, i've created an application like this.
    -Ibatis for OR Mapper
    -Struts for mvc
    -Spring for transaction
    -Firebird 1.5.2 + jdbc 1.5.5

    So, i've create the following files: Pojo, dao, Manager.

    My code:

    The sqlmap implementation:

    public class PatientSqlMapDao extends SqlMapClientDaoSupport implements PatientDAO {
    public it.axiosinformatica.webward.database.domain.Patien t getPatientById(Integer id) {
    return (Patient) getSqlMapClientTemplate().queryForObject("Patient. getPatientById", id);
    }

    public java.util.List getPatientList() {
    return getSqlMapClientTemplate().queryForList("Patient.ge tPatientList", null);
    }

    public java.util.List getPatientListByAdmissionDate(java.util.Date dte) {
    return getSqlMapClientTemplate().queryForList("Patient.ge tPatientListByAdmissionDate", dte);
    }

    public java.util.List getPatientListByAdmissionNoNew(Integer id) {
    return getSqlMapClientTemplate().queryForList("Patient.ge tPatientListByAdmissionNoNew", id);
    }

    public java.util.List getPatientListByBedId(Integer id) {
    return getSqlMapClientTemplate().queryForList("Patient.ge tPatientListByBedId", id);
    }

    public java.util.List getPatientListByDismissionDate(java.util.Date dte) {
    return getSqlMapClientTemplate().queryForList("Patient.ge tPatientListByDismissionDate", dte);
    }

    public java.util.List getPatientListByLanguageId(Integer id) {
    return getSqlMapClientTemplate().queryForList("Patient.ge tPatientListByLanguageId", id);
    }

    public java.util.List getPatientListByName(String str) {
    return getSqlMapClientTemplate().queryForList("Patient.ge tPatientListByName", str);
    }

    public void insertPatient(it.axiosinformatica.webward.database .domain.Patient obj) {
    getSqlMapClientTemplate().insert("Patient.insertPa tient", obj);
    }

    public void updatePatientById(it.axiosinformatica.webward.data base.domain.Patient obj) {
    getSqlMapClientTemplate().update("Patient.updatePa tientById", obj);
    }

    public Patient getPatientByBedIdAndAdmissionDate(Patient obj) {
    return (Patient) getSqlMapClientTemplate().queryForObject("Patient. getPatientByBedIdAndAdmissionDate", obj);
    }

    public java.util.List getPatientListByWardIdAndDismissionDate(java.util. HashMap hm) {
    return getSqlMapClientTemplate().queryForList("Patient.ge tPatientListByWardIdAndDismissionDate", hm);
    }


    }

    -Note: i've extend SqlMapClientDaoSupport and i call getSqlMapClientTemplate() before the query (like equinox)


    The manager:

    public class PatientManagerImpl implements PatientManager {

    private PatientDietManager iface = null;

    public PatientDietManager getPatientDietManager() {
    return iface;
    }

    public void setPatientDietManager(PatientDietManager iface) {
    this.iface = iface;
    }

    private FastManager iface2 = null;

    public FastManager getFastManager() {
    return iface2;
    }

    public void setFastManager(FastManager iface2) {
    this.iface2 = iface2;
    }

    private PatientDAO dao;

    public void setPatientDAO(PatientDAO dao) {
    this.dao = dao;
    }

    public Patient getPatient(Integer id){
    return dao.getPatientById(id);
    }

    public Patient getPatientByBedIdAndAdmissionDate(Patient obj){
    return dao.getPatientByBedIdAndAdmissionDate(obj);
    }


    public List getPatientList(){
    return dao.getPatientList();
    }

    public List getPatientListByAdmissionNoNew(boolean bool){
    if (bool){
    return dao.getPatientListByAdmissionNoNew(new Integer(1));
    }else{
    return dao.getPatientListByAdmissionNoNew(new Integer(0));
    }

    }

    public List getPatientListByAdmissionDate(Date dte){
    return dao.getPatientListByAdmissionDate(dte);
    }

    public List getPatientListByBed(Bed obj){
    return dao.getPatientListByBedId(obj.getId());
    }

    public List getActivePatientListByBedAndDate(Bed obj, Date date){
    List patientList = dao.getPatientListByBedId(obj.getId());


    ArrayList al = new ArrayList();


    for (int i = 0; i< patientList.size(); i++){
    Patient p = (Patient) patientList.get(i);

    if (p.getDismissionDate() != null){
    if (p.getDismissionDate().getTime()< date.getTime()){
    System.out.println("PATIENT: " + p.getName() + " => DismissionDate:" + p.getDismissionDate().toString() + " TEST DATE:" + date.toString());
    continue;
    }

    }

    HashMap hm = new HashMap();
    hm.put("patientId", p.getId());
    hm.put("managementDate", date);
    p.setActivePatientDiet(iface.getLastPatientDietByP atientAndDate(hm));
    p.setActiveFastList(iface2.getFastListByPatientAnd Date(hm));
    al.add(p);
    }

    return (List)al;


    }

    public List getPatientListByDismissionDate(Date dte){
    return dao.getPatientListByDismissionDate(dte);
    }


    public List getPatientListByLanguage(Language obj){
    return dao.getPatientListByLanguageId(obj.getId());
    }

    public List getPatientListByName(String name){
    return dao.getPatientListByName(name);
    }

    public List getPatientListByWardIdAndDismissionDate(Integer wardId, Date dismissionDateMin, Date dismissionDateMax){
    HashMap hm = new HashMap();
    hm.put("wardId", wardId);
    hm.put("dismissionDateMin", dismissionDateMin);
    hm.put("dismissionDateMax", dismissionDateMax);

    return dao.getPatientListByWardIdAndDismissionDate(hm);
    }

    public void insertPatient(Patient obj){
    dao.insertPatient(obj);
    }

    public void updatePatient(Patient obj){
    dao.updatePatientById(obj);
    }

    }


    So, all work fine (no errors), but when i try to rollback a transaction that contains an update in 2 or more table, only exception's relative table will be rolled back!

    I put my configuration files:

    Sqlmap file:

    <sqlMap namespace="Patient">

    <typeAlias alias="patient" type="it.axiosinformatica.webward.database.domain. Patient"/>

    <resultMap id="get-patient-result" class="patient">
    <result property="id" column="IRICID"/>
    <result property="bedId" column="ILETID" />
    <result property="admissionDate" column="DRIC_DATA_RIC"/>
    <result property="dismissionDate" column="DRIC_DATA_DIM"/>
    <result property="name" column="SRICNOME"/>
    <result property="note" column="SRICNOTE"/>
    <result property="languageId" column="ILINGID"/>
    <result property="admissionNoNew" column="IRICNONEW"/>
    <result property="patientDietList" column="IRICID" select="PatientDiet.getPatientDietListByPatientId"/>
    <result property="fastList" column="IRICID" select="Fast.getFastListByPatientId"/>
    <result property="bed" column="ILETID" select="Bed.getBedById"/>
    </resultMap>

    <statement id="getPatientById" parameterClass="java.lang.Integer"
    resultMap="get-patient-result" >
    <![CDATA[
    SELECT *
    FROM TRIC_RICOVERI WHERE IRICID = #value#
    ]]>
    </statement>

    <statement id="getPatientListByBedId" parameterClass="java.lang.Integer"
    resultMap="get-patient-result" >
    <![CDATA[
    SELECT *
    FROM TRIC_RICOVERI WHERE ILETID = #value#
    ]]>
    </statement>

    <statement id="getPatientListByWardIdAndDismissionDate" parameterClass="java.util.HashMap"
    resultMap="get-patient-result" >
    <![CDATA[
    SELECT * FROM TRIC_RICOVERI WHERE ILETID IN(
    SELECT ILETID FROM TLET_LETTI WHERE IREPID = #wardId#
    )
    AND DRIC_DATA_DIM > #dismissionDateMin#
    AND DRIC_DATA_DIM <= #dismissionDateMax#
    ]]>
    </statement>

    <statement id="getPatientByBedIdAndAdmissionDate" parameterClass="patient"
    resultMap="get-patient-result" >
    <![CDATA[
    SELECT *
    FROM TRIC_RICOVERI WHERE ILETID = #bedId#
    AND DRIC_DATA_RIC = #admissionDate#
    AND DRIC_DATA_DIM IS NULL
    ]]>
    </statement>

    <statement id="getPatientListByLanguageId" parameterClass="java.lang.Integer"
    resultMap="get-patient-result" >
    <![CDATA[
    SELECT *
    FROM TRIC_RICOVERI WHERE ILINGID = #value#
    ]]>
    </statement>

    <statement id="getPatientListByName" parameterClass="java.lang.String"
    resultMap="get-patient-result" >
    <![CDATA[
    SELECT *
    FROM TRIC_RICOVERI WHERE SRICNOME = #value#
    ]]>
    </statement>

    <statement id="getPatientListByAdmissionNoNew" parameterClass="java.lang.Integer"
    resultMap="get-patient-result" >
    <![CDATA[
    SELECT *
    FROM TRIC_RICOVERI WHERE IRICNONEW = #value#
    ]]>
    </statement>

    <statement id="getPatientListByAdmissionDate" parameterClass="java.util.Date"
    resultMap="get-patient-result" >
    <![CDATA[
    SELECT *
    FROM TRIC_RICOVERI WHERE DRIC_DATA_RIC = #value#
    ]]>
    </statement>

    <statement id="getPatientListByDismissionDate" parameterClass="java.util.Date"
    resultMap="get-patient-result" >
    <![CDATA[
    SELECT *
    FROM TRIC_RICOVERI WHERE DRIC_DATA_DIM = #value#
    ]]>
    </statement>


    <statement id="getPatientList" resultMap="get-patient-result" >
    <![CDATA[
    SELECT *
    FROM TRIC_RICOVERI
    ]]>
    </statement>


    <statement id="updatePatientById" parameterClass="patient" >
    <![CDATA[
    UPDATE TRIC_RICOVERI SET
    ILETID = #bedId#,
    DRIC_DATA_RIC = #admissionDate#,
    DRIC_DATA_DIM = #dismissionDate#,
    SRICNOME = #name#,
    SRICNOTE = #note#,
    IRICNONEW = #admissionNoNew#,
    ILINGID = #languageId#
    WHERE IRICID = #id#
    ]]>
    </statement>

    <statement id="insertPatient" parameterClass="patient" >
    <![CDATA[
    INSERT INTO TRIC_RICOVERI
    (
    ILETID,
    DRIC_DATA_RIC,
    DRIC_DATA_DIM,
    SRICNOME,
    SRICNOTE,
    IRICNONEW,
    ILINGID
    )
    VALUES
    (
    #bedId#,
    #admissionDate#,
    #dismissionDate#,
    #name#,
    #note#,
    #admissionNoNew#,
    #languageId#
    )
    ]]>
    </statement>

    </sqlMap>

    -- My sqlmapconfig

    <sqlMapConfig>

    <settings
    cacheModelsEnabled="false"
    enhancementEnabled="true"
    lazyLoadingEnabled="true"
    useStatementNamespaces="true"
    />
    <sqlMap resource="ibatis/Patient.xml"/>

    </sqlMapConfig>

    The application context

    <beans>
    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName">
    <value>java:comp/env/jdbc/repartoweb</value>
    </property>
    </bean>

    <!-- Transaction manager for iBATIS DAOs -->
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
    <property name="dataSource"><ref bean="dataSource"/></property>
    </bean>

    <!-- SqlMap setup for iBATIS Database Layer -->
    <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClient FactoryBean">
    <property name="dataSource"><ref bean="dataSource"/></property>
    <property name="configLocation">
    <value>classpath:/ibatis/config/SqlMapConfig.xml</value>
    </property>
    </bean>
    <bean id="patientDietDAO" class="it.axiosinformatica.webward.database.implem entations.PatientDietSqlMapDao">
    <property name="sqlMapClient"><ref bean="sqlMapClient"/></property>
    </bean>
    <bean id="txProxyTemplate" abstract="true"
    class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager"><ref bean="transactionManager"/></property>
    <property name="transactionAttributes">
    <props>
    <prop key="*">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    </bean>

    <bean id="patientManager" parent="txProxyTemplate">
    <property name="target">
    <bean class="it.axiosinformatica.webward.manager.impl.Pa tientManagerImpl">
    <property name="patientDAO"><ref bean="patientDAO"/></property>
    <property name="patientDietManager"><ref bean="patientDietManager"/></property>
    <property name="fastManager"><ref bean="fastManager"/></property>
    </bean>
    </property>
    <property name="transactionAttributes">
    <props>
    <prop key="*">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    </bean>
    </beans>

    --and my action servlet mapped by spring

    <beans>
    <bean name="/manageAdmissionsNewPatient" class="it.axiosinformatica.webward.web.actions.man ageAdmissions.ManageAdmissionsNewPatientAction" singleton="false">
    <property name="bedManager"><ref bean="bedManager"/></property>
    <property name="baseParameterManager"><ref bean="baseParameterManager"/></property>
    <property name="dietManager"><ref bean="dietManager"/></property>
    <property name="languageManager"><ref bean="languageManager"/></property>
    <property name="mealManager"><ref bean="mealManager"/></property>
    </bean>

    <bean name="/manageAdmissionsNewPatientSubmit" class="it.axiosinformatica.webward.web.actions.man ageAdmissions.ManageAdmissionsNewPatientAction" singleton="false">
    <property name="patientManager"><ref bean="patientManager"/></property>
    <property name="mealManager"><ref bean="mealManager"/></property>
    <property name="fastManager"><ref bean="fastManager"/></property>
    <property name="patientDietManager"><ref bean="patientDietManager"/></property>
    </bean>

    </beans>

    --My mapping with struts(extract)

    <action path="/manageAdmissionsNewPatient" validate="false" type="org.springframework.web.struts.DelegatingAct ionProxy" name="manageAdmissionsPatientForm" input="/WEB-INF/pages/login/login.jsp" parameter="new">
    <forward name="success" path="/WEB-INF/pages/manageAdmissions/manageAdmissionsNewPatient.jsp"/>
    </action>

    <action path="/manageAdmissionsNewPatientSubmit" type="org.springframework.web.struts.DelegatingAct ionProxy" name="manageAdmissionsPatientForm" input="/WEB-INF/pages/manageAdmissions/manageAdmissionsNewPatient.jsp" parameter="save">
    <forward name="success" path="/manageAdmissionsSubmit.do"/>
    </action>

    <plug-in className="org.springframework.web.struts.ContextL oaderPlugIn">
    <set-property property="contextConfigLocation"
    value="/WEB-INF/applicationContext.xml, /WEB-INF/action-servlet.xml"/>
    </plug-in>



    So, when i call the "/manageAdmissionsNewPatientSubmit", Spring have 4 ref bean relative to managers.

    I put my Struts Action:

    public class ManageAdmissionsNewPatientAction extends BaseSecuredAction {

    Logger log = Logger.getLogger(ManageAdmissionsNewPatientAction. class);
    private PatientManager patientMgr = null;
    private FastManager fastMgr = null;
    private MealManager mealMgr = null;
    private PatientDietManager patientDietMgr = null;
    private DietManager dietMgr = null;
    private BaseParameterManager bpMgr = null;
    private LanguageManager langMgr = null;
    private BedManager bedMgr = null;

    public void setPatientManager(PatientManager theManager) {
    this.patientMgr = theManager;
    }

    public void setFastManager(FastManager theManager) {
    this.fastMgr = theManager;
    }

    public void setMealManager(MealManager theManager) {
    this.mealMgr = theManager;
    }

    public void setPatientDietManager(PatientDietManager theManager) {
    this.patientDietMgr = theManager;
    }

    public void setDietManager(DietManager theManager) {
    this.dietMgr = theManager;
    }

    public void setBaseParameterManager(BaseParameterManager theManager) {
    this.bpMgr = theManager;
    }

    public void setLanguageManager(LanguageManager theManager) {
    this.langMgr = theManager;
    }

    public void setBedManager(BedManager theManager) {
    this.bedMgr = theManager;
    }

    public ActionForward doPerform(ActionMapping mapping, ActionForm form,
    HttpServletRequest req, HttpServletResponse res) throws Exception{

    DynaActionForm theForm = (DynaActionForm) form;

    Logger log = Logger.getLogger(ManageAdmissionsNewPatientAction. class);

    String operation = mapping.getParameter();

    if (operation.equals(AppConstants.createNew)) {
    log.debug("Parameter type is " + AppConstants.createNew + ", do a new Patient.");

    Integer bedId = Integer.valueOf(req.getParameter("bedId"));

    log.debug("The bed id is: " + bedId);

    String dateLong = req.getParameter("date");

    String parsedDate = new DateUtil().fromLongStringToParsedString(dateLong, "dd/MM/yyyy");

    log.debug("Admission Date Long is: " + dateLong);

    log.debug("Parsed date : " + parsedDate);

    log.debug("Retriving Bed for bed Id " + bedId);

    Bed bed = bedMgr.getBed(bedId);

    String fictitiousBedString = "";

    String selectedDietId = "-1";

    try{
    fictitiousBedString = ((BaseParameter)bpMgr.getBaseParameterByCode(BaseP arameterConstants.DEFAULT_FICTITIOUS_BED)).getValu e().trim();
    log.debug("Fictitious bed description is " + fictitiousBedString);
    }catch(Exception e){
    log.error("No Fictitious bed description found!!!", e);
    }

    try{
    String theDietId = ((BaseParameter)bpMgr.getBaseParameterByCode(BaseP arameterConstants.DEFAULT_DIET_ADMISSION)).getValu e().trim();
    //if conversion is successfully, the diet is not an empty string
    int dietIdTmp = Integer.parseInt(theDietId);
    selectedDietId = theDietId;
    log.debug("Selected Diet id (default diet) is " + selectedDietId);
    }catch(Exception e){
    log.error("No Default diet found!!!", e);
    }

    log.debug("Load diet list...");
    List dietList = dietMgr.getDietList();

    log.debug("Load language list...");
    List languageList = langMgr.getLanguageList();

    log.debug("Load fast list...");
    List mealFastList = mealMgr.getMealList();


    log.debug("Bed code is " + bed.getCode());

    theForm.set("bedCode", bed.getCode());
    theForm.set("bedId", bed.getId().toString());
    theForm.set("fictitiousBed", fictitiousBedString);
    theForm.set("selectedDietId", selectedDietId);
    theForm.set("selectedLanguageId", "-1");
    theForm.set("dietList", dietList.toArray());
    theForm.set("fastList", mealFastList.toArray());
    theForm.set("selectedFastsId", new String[]{});
    theForm.set("notes", "");
    theForm.set("patientId", "");
    theForm.set("patientName", "");
    theForm.set("languageList", languageList.toArray());
    theForm.set("parsedDate", parsedDate);
    theForm.set("dateLong", dateLong);

    if (Long.parseLong(dateLong) != Long.parseLong(new DateUtil().getActualDateLongEmphasized())){
    log.debug("We not are in the System day, set hour and minute to empty!");
    theForm.set("hour", "");
    theForm.set("minute", "");
    }else{
    log.debug("GOOD! We are in the System day, set hour and minute to actual value!");
    GregorianCalendar gc = new GregorianCalendar();
    theForm.set("hour", String.valueOf(gc.get(gc.HOUR_OF_DAY)));
    theForm.set("minute", String.valueOf(gc.get(gc.MINUTE)));
    }


    log.debug("Done, return.");

    return mapping.findForward(AppConstants.success);
    }

    if(operation.equals(AppConstants.save)){
    log.info("Parameter is " + AppConstants.save + ", add Patient.");

    Integer bedId = Integer.valueOf((String) theForm.get("bedId"));
    String patientName = ((String)theForm.get("patientName")).trim();
    Integer selectedDietId = Integer.valueOf((String) theForm.get("selectedDietId"));
    Integer selectedLanguageId = Integer.valueOf((String) theForm.get("selectedLanguageId"));
    String notes = ((String)theForm.get("notes")).trim();

    String[] selectedFastsId = req.getParameterValues("selectedFastsId");

    String admissionDateLong = ((String) theForm.get("dateLong"));
    Integer hourAdmission = Integer.valueOf((String) theForm.get("hour"));
    Integer minuteAdmission = Integer.valueOf((String) theForm.get("minute"));

    //create admissionDate
    GregorianCalendar admissionDate = new GregorianCalendar();
    admissionDate.setTimeInMillis(Long.parseLong(admis sionDateLong));
    admissionDate.set(admissionDate.HOUR_OF_DAY, hourAdmission.intValue());
    admissionDate.set(admissionDate.MINUTE, minuteAdmission.intValue());
    admissionDate.set(admissionDate.SECOND, new GregorianCalendar().get(GregorianCalendar.SECOND)) ;
    admissionDate.set(admissionDate.MILLISECOND, 0);

    //populating patient
    Patient p = new Patient();

    p.setBedId(bedId);
    p.setName(patientName);
    p.setNote(notes);
    p.setAdmissionDate(admissionDate.getTime());

    if (selectedLanguageId.intValue() != -1){
    p.setLanguageId(selectedLanguageId);
    }

    //store
    patientMgr.insertPatient(p);

    //reloaded because we need the patient id
    Patient thePatient = patientMgr.getPatientByBedIdAndAdmissionDate(p);

    //get actual date for "fast" update
    GregorianCalendar gc = (GregorianCalendar)admissionDate.clone();

    gc = new DateUtil().removeTime(gc);
    //ok, we have the date without time

    List mealList = mealMgr.getMealList();

    //this is a new patient; insert all fasts to 0, next, set 1 the fasts checked!
    for (int i = 0; i< mealList.size(); i++){

    Integer mealId = ((Meal) mealList.get(i)).getId();
    Fast f = new Fast();
    f.setPatientId(thePatient.getId());
    f.setMealId(mealId);
    f.setAssociationDate(gc.getTime());
    f.setFastEnable(new Integer(0));
    //NOTE HERE fastMgr.insertFast(null);
    }

    //ok, update the checked fasts!
    if (selectedFastsId != null){
    for (int i= 0; i< selectedFastsId.length; i++){

    Integer fastMealId = Integer.valueOf(selectedFastsId[i]);

    //load the fast to update
    Fast f = fastMgr.getFastByPatientIdAndMealIdAndAssociationD ate(fastMealId, thePatient.getId(), gc.getTime());

    //set fast to on
    f.setFastEnable(new Integer(1));

    //update
    fastMgr.updateFast(f);

    }
    }
    //fasts done!

    //add diet to patient
    if (selectedDietId.intValue() != -1){

    PatientDiet pd = new PatientDiet();
    //populate patientDiet
    pd.setAssociationDate(gc.getTime());
    pd.setDietId(selectedDietId);
    pd.setPatientId(thePatient.getId());

    //insert patientDiet

    patientDietMgr.insertPatientDiet(pd);

    }
    //done


    return mapping.findForward(AppConstants.success);
    }


    return mapping.findForward(AppConstants.success);

    }
    }



    So, i've forced an error setting the insert of a fast to null.
    I'll recive this (correct) error:

    16:12:38,509 INFO ManageAdmissionsNewPatientAction:182 - Parameter is save, add Patient.
    6-giu-2005 16.12.38 org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
    6-giu-2005 16.12.38 org.springframework.beans.factory.support.Abstract BeanFactory getBean
    INFO: Creating shared instance of singleton bean 'DB2'
    6-giu-2005 16.12.38 org.springframework.beans.factory.support.Abstract BeanFactory getBean
    INFO: Creating shared instance of singleton bean 'HSQL'
    6-giu-2005 16.12.38 org.springframework.beans.factory.support.Abstract BeanFactory getBean
    INFO: Creating shared instance of singleton bean 'MS-SQL'
    6-giu-2005 16.12.38 org.springframework.beans.factory.support.Abstract BeanFactory getBean
    INFO: Creating shared instance of singleton bean 'MySQL'
    6-giu-2005 16.12.38 org.springframework.beans.factory.support.Abstract BeanFactory getBean
    INFO: Creating shared instance of singleton bean 'Oracle'
    6-giu-2005 16.12.38 org.springframework.beans.factory.support.Abstract BeanFactory getBean
    INFO: Creating shared instance of singleton bean 'Informix'
    6-giu-2005 16.12.38 org.springframework.beans.factory.support.Abstract BeanFactory getBean
    INFO: Creating shared instance of singleton bean 'PostgreSQL'
    6-giu-2005 16.12.38 org.springframework.beans.factory.support.Abstract BeanFactory getBean
    INFO: Creating shared instance of singleton bean 'Sybase'
    6-giu-2005 16.12.38 org.springframework.jdbc.support.SQLErrorCodesFact ory <init>
    INFO: SQLErrorCodes loaded: [DB2, HSQL, MS-SQL, MySQL, Oracle, Informix, PostgreSQL, Sybase]
    6-giu-2005 16.12.38 org.apache.struts.action.RequestProcessor processException
    AVVERTENZA: Unhandled Exception thrown: class org.springframework.jdbc.UncategorizedSQLException
    6-giu-2005 16.12.38 org.apache.catalina.core.StandardWrapperValve invoke
    GRAVE: Servlet.service() for servlet actions threw exception
    org.springframework.jdbc.UncategorizedSQLException : SqlMapClient operation: encountered SQLException [
    --- The error occurred in ibatis/Fast.xml.
    --- The error occurred while preparing the mapped statement for execution.
    --- Check the Fast.insertFast.
    --- Check the parameter map.
    --- Cause: java.lang.NullPointerException]; nested exception is com.ibatis.common.jdbc.exception.NestedSQLExceptio n:
    --- The error occurred in ibatis/Fast.xml.
    --- The error occurred while preparing the mapped statement for execution.
    --- Check the Fast.insertFast.
    --- Check the parameter map.
    --- Cause: java.lang.NullPointerException
    com.ibatis.common.jdbc.exception.NestedSQLExceptio n:
    --- The error occurred in ibatis/Fast.xml.
    --- The error occurred while preparing the mapped statement for execution.
    --- Check the Fast.insertFast.
    --- Check the parameter map.
    --- Cause: java.lang.NullPointerException
    Caused by: java.lang.NullPointerException
    at com.ibatis.sqlmap.engine.mapping.statement.General Statement.executeUpdate(GeneralStatement.java:90)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelega te.insert(SqlMapExecutorDelegate.java:442)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.in sert(SqlMapSessionImpl.java:85)
    at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.ins ert(SqlMapClientImpl.java:57)
    at org.springframework.orm.ibatis.SqlMapClientTemplat e$9.doInSqlMapClient(SqlMapClientTemplate.java:319 )
    at org.springframework.orm.ibatis.SqlMapClientTemplat e.execute(SqlMapClientTemplate.java:165)
    at org.springframework.orm.ibatis.SqlMapClientTemplat e.insert(SqlMapClientTemplate.java:317)
    at it.axiosinformatica.webward.database.implementatio ns.FastSqlMapDao.insertFast(FastSqlMapDao.java:47)
    at it.axiosinformatica.webward.manager.impl.FastManag erImpl.insertFast(FastManagerImpl.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:288)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.invokeJoinpoint(ReflectiveMethodInvocat ion.java:155)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :122)
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:57)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :144)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:174)
    at $Proxy298.insertFast(Unknown Source)
    at it.axiosinformatica.webward.web.actions.manageAdmi ssions.ManageAdmissionsNewPatientAction.doPerform( ManageAdmissionsNewPatientAction.java:239)
    at it.axiosinformatica.webward.web.actions.BaseSecure dAction.execute(BaseSecuredAction.java:42)
    at org.springframework.web.struts.DelegatingActionPro xy.execute(DelegatingActionProxy.java:105)
    at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:421)
    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:226)
    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1164)
    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:415)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
    at org.netbeans.modules.web.monitor.server.MonitorFil ter.doFilter(MonitorFilter.java:362)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:825)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:738)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:526)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.NullPointerException
    at it.axiosinformatica.webward.database.domain.Fast$$ BulkBeanByCGLIB$$38de3712.getPropertyValues(<gener ated>)
    at net.sf.cglib.beans.BulkBean.getPropertyValues(Bulk Bean.java:86)
    at com.ibatis.sqlmap.engine.accessplan.EnhancedProper tyAccessPlan.getProperties(EnhancedPropertyAccessP lan.java:37)
    at com.ibatis.sqlmap.engine.exchange.JavaBeanDataExch ange.getData(JavaBeanDataExchange.java:91)
    at com.ibatis.sqlmap.engine.mapping.parameter.BasicPa rameterMap.getParameterObjectValues(BasicParameter Map.java:132)
    at com.ibatis.sqlmap.engine.mapping.statement.General Statement.executeUpdate(GeneralStatement.java:67)
    ... 45 more

    Caused by:
    java.lang.NullPointerException
    at it.axiosinformatica.webward.database.domain.Fast$$ BulkBeanByCGLIB$$38de3712.getPropertyValues(<gener ated>)
    at net.sf.cglib.beans.BulkBean.getPropertyValues(Bulk Bean.java:86)
    at com.ibatis.sqlmap.engine.accessplan.EnhancedProper tyAccessPlan.getProperties(EnhancedPropertyAccessP lan.java:37)
    at com.ibatis.sqlmap.engine.exchange.JavaBeanDataExch ange.getData(JavaBeanDataExchange.java:91)
    at com.ibatis.sqlmap.engine.mapping.parameter.BasicPa rameterMap.getParameterObjectValues(BasicParameter Map.java:132)
    at com.ibatis.sqlmap.engine.mapping.statement.General Statement.executeUpdate(GeneralStatement.java:67)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelega te.insert(SqlMapExecutorDelegate.java:442)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.in sert(SqlMapSessionImpl.java:85)
    at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.ins ert(SqlMapClientImpl.java:57)
    at org.springframework.orm.ibatis.SqlMapClientTemplat e$9.doInSqlMapClient(SqlMapClientTemplate.java:319 )
    at org.springframework.orm.ibatis.SqlMapClientTemplat e.execute(SqlMapClientTemplate.java:165)
    at org.springframework.orm.ibatis.SqlMapClientTemplat e.insert(SqlMapClientTemplate.java:317)
    at it.axiosinformatica.webward.database.implementatio ns.FastSqlMapDao.insertFast(FastSqlMapDao.java:47)
    at it.axiosinformatica.webward.manager.impl.FastManag erImpl.insertFast(FastManagerImpl.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:288)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.invokeJoinpoint(ReflectiveMethodInvocat ion.java:155)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :122)
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:57)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :144)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:174)
    at $Proxy298.insertFast(Unknown Source)
    at it.axiosinformatica.webward.web.actions.manageAdmi ssions.ManageAdmissionsNewPatientAction.doPerform( ManageAdmissionsNewPatientAction.java:239)
    at it.axiosinformatica.webward.web.actions.BaseSecure dAction.execute(BaseSecuredAction.java:42)
    at org.springframework.web.struts.DelegatingActionPro xy.execute(DelegatingActionProxy.java:105)
    at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:421)
    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:226)
    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1164)
    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:415)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
    at org.netbeans.modules.web.monitor.server.MonitorFil ter.doFilter(MonitorFilter.java:362)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:825)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:738)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:526)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)

    --Now, ill suppose that the entire transaction (started with the /manageAdmissionsNewPatientSubmit action), will be rolled back.

    But this not appear!!!!
    Only the InsertFast query is rolled back!
    the patientMgr.insertPatient(p) that insert the new patient is not rolled back!!!
    So, i'll need to rollback the entire "Action".

    Where is the problem??

    what can i do to apply only one transaction to many query in many tables????

    Help me!


    P.s. sorry for my very bad english!
Working...
X