Announcement Announcement Module
Collapse
No announcement yet.
Problems with the insertion of data Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems with the insertion of data

    Hi to all!
    There is somebody can help me in this problem?

    I am using DB postgreSQL 7,3,4, for the mapeo use ibatis 2.0.My problem is that I cannot insert data.But the rare thing is that if I can read them and when inserted duplicated keys recognize that there is an error;but when inserted correct data, do not leave eror but the data do not get to be inserted in the Data Base, is enough stranger.

    I am using ibatis 2,0 of the following form:

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName"><value>org.postgresql.Drive r</value></property>
    <property name="url"><value>jdbcostgresql://localhost/sad</value></property>
    <property name="username"><value>postgres</value></property>
    <property name="password"><value>postgres</value></property>
    </bean>


    <bean id="sqlMap" class="org.springframework.orm.ibatis.SqlMapClient FactoryBean">
    <property name="dataSource"><ref bean="dataSource"/></property>
    <property name="configLocation"><value>WEB-INF/sql-map- config.xml</value></property>
    </bean>

    <bean id="facade" class="creasser.mapeo.StoreFacade">
    <property name="sqlMapClient"><ref bean="sqlMap"/></property>
    </bean>

    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">

    <property name="dataSource"><ref local="dataSource"/></property>
    </bean>
    ---------------------------------------------------
    And the form in I make my insertion with sqlMapClient is:
    ----------------------------------------------------.
    try {
    sqlMapClient.startTransaction();
    sqlMapClient.insert("insertPedido",ped);
    sqlMapClient.commitTransaction();
    }finally{
    sqlMapClient.endTransaction();
    }

    ------------------------------------------------

    When executing error does not leave to me but it does not insert the data either and in the archives logs of tomcat 4,1 leaves the following message

    ---------------------------------------------------

    WebappClassLoader: validateJarFile(/opt/jakarta/tomcat/webapps/sad/WEB-INF/lib/servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    log4j:WARN No appenders could be found for logger (org.springframework.web.servlet.DispatcherServlet ).
    log4j:WARN Please initialize the log4j system properly.


    --------------------------------------------------------

    Help please, not that to do!.

    Atte NIRVANA :evil:

  • #2
    I would use a org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean for transaction management so that code like try...cacth...finally is avoided. See the jpetstore sample as an example of this.

    There is no log because it seems that you don't have a log4j.properties within your web classpath. You should add that file in WEB-INF/classes

    Also, I don't think you should include the servlet.jar within your WEB-INF/lib directory

    Comment

    Working...
    X