Hi Larry,

I have the same thing

<transactionManager type="JDBC"> But my commit work without 
commitRequired="true".  Isn't this 
default.

Has this changed in the newer version of IBatis.  Eduardo, I hope you are check 
the database you
are writing to.

Rgds

Prashanth.

--- Larry Meadors <[EMAIL PROTECTED]> wrote:

> <transactionManager type="JDBC" commitRequired="true">
> 
> On 8/25/05, Eduardo Lobo <[EMAIL PROTECTED]> wrote:
> >  
> >  Thanks for the answer,
> >  
> >  This is the SQL config that I'm using:
> >  
> >  <?xml version="1.0" encoding="UTF-8"?>
> >  <!DOCTYPE sqlMapConfig
> >      PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
> >      "http://www.ibatis.com/dtd/sql-map-config-2.dtd";>
> >  
> >  <sqlMapConfig>
> >      
> >      <settings
> >          cacheModelsEnabled="false"
> >          enhancementEnabled="true"
> >          lazyLoadingEnabled="true"
> >          maxRequests="32"
> >          maxSessions="10"
> >          maxTransactions="5"
> >          useStatementNamespaces="false"/>
> >      
> >      <transactionManager type="JDBC" commitRequired="true" >
> >          <dataSource type="SIMPLE">
> >              <property name="JDBC.Driver"
> > value="net.sourceforge.jtds.jdbc.Driver"/>
> >              <property name="JDBC.ConnectionURL"
> > value="jdbc:jtds:sqlserver://192.168.1.20:1433/Database"/>
> >              <property name="JDBC.Username" value="user"/>
> >              <property name="JDBC.Password" value="*****"/>
> >              <property name="JDBC.DefaultAutoCommit" value="true"/>
> >          </dataSource>
> >      </transactionManager>
> >      
> >      <sqlMap resource="Person.xml"/>
> >      
> >  </sqlMapConfig>
> >  
> >  Could you tell me, please, what I need to change to make this work?
> > 
> >  
> >  
> >  Larry Meadors wrote: 
> >  The transaction's being rolled back, it looks like.
> > 
> > Change your transaction manager to commitRequired="true" and i think
> > it will work.
> > 
> > On a related note..you do know that you can do all of that without a
> > stored proc, right?
> > 
> > <insert ...>
> >  insert Person (Name) values (#name#)
> >  <selectKey property="id">
> >  select SCOPE_IDENTITY()
> >  </selectKey>
> > </insert>
> > 
> > Insert the record, set the id property to the generated key. Done. :-)
> > 
> > Larry
> > 
> > 
> > On 8/25/05, Eduardo Lobo <[EMAIL PROTECTED]> wrote:
> >  
> >  
> >  Hi,
> > 
> > My problem is this:
> > 
> > I create this SP(in SQL Server 2000):
> > 
> > create procedure create_person
> > @name varchar(80)
> > as
> > begin
> >  declare @id int
> > 
> >  insert Person (Name)
> >  values (@name)
> > 
> >  Set @id = SCOPE_IDENTITY()
> > 
> >  select Id, Name
> >  from Person
> >  where Id = @id
> > end
> > GO
> > 
> > 
> > This is the XML Map:
> > 
> > <?xml version="1.0" encoding="UTF-8" ?>
> > <!DOCTYPE sqlMap
> >  PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
> >  "http://www.ibatis.com/dtd/sql-map-2.dtd";>
> > 
> > <sqlMap namespace="Person">
> > 
> >  <!-- ///////////////Type Aliases/////////////// -->
> >  <typeAlias alias="Map" type="java.util.Map"/>
> >  <typeAlias alias="Person" type="Person"/>
> >  <!-- ///////////////Type Aliases/////////////// -->
> > 
> >  <!-- ///////////////Result Maps/////////////// -->
> >  <resultMap id="Person_Result" class="Person">
> >  <result property="id" column="Id"/>
> >  <result property="name" column="Name"/>
> >  </resultMap>
> >  <!-- ///////////////Result Maps/////////////// -->
> > 
> >  <!-- ///////////////Procedues/////////////// -->
> >  <procedure id="create_person" resultMap="Person_Result"
> > parameterClass="Map">
> >  {call create_person (#name#)}
> >  </procedure>
> >  <!-- ///////////////Procedues/////////////// -->
> > 
> > </sqlMap>
> > 
> > 
> > This is the java code:
> > 
> > SqlMapClient sqlMap = null;
> >  try {
> >  String file = "SQLConfigMap.xml";
> >  Reader reader = Resources.getResourceAsReader(file);
> >  sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
> > 
> >  HashMap params = new HashMap();
> >  params.put("name", "David");
> >  Object obj = sqlMap.queryForObject("create_person", params);
> >  System.out.println("create_person: " + obj);
> > 
> >  } catch (Exception e) {
> >  System.out.println(e.getMessage());
> >  }
> > 
> > 
> > Results:
> > 
> > Finally when I print the result I got the new Record info,
> > 
> > Person: id = 1, name = David
> > 
> > That's fine, but when I check the Table there's not record...
> > 
> > But the strange is that it returns the mapped object with the new data,
> > like if it was successfully inserted.
> > 
> > The "Id" field from the table Person is Identity (automatic sequential),
> > and if I try to insert the record again then a I get the next "Id"
> > (Person: id = 2, name = David), but again nothing is in the table..
> > 
> > 
> > Thanks for the help.
> > 
> > Eduardo Lobo
> > 
> > 
> > 
> > 
> > 
> > 
> >  
> >  
> >  
> >
> 



                
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

Reply via email to