[Seasar-user:6210] [S2Dao]insertができない原因がわからないです

Takuya Aono [E-MAIL ADDRESS DELETED]
2007年 2月 17日 (土) 16:28:13 JST


はじめまして、あおのと申します。

S2Daoの勉強のために、S2Daoに添付されているexamples.dao.DepartmentDaoClient
を実行したのですが、insertではなく、selectが実行されてしまいます。
自前で組んだプログラムにおいては、selectは正しく動作して、テーブルの
内容を取得できています。

原因として、何が考えられますでしょうか。
念のために、DDLとdiconを添付します。
(パスワードは***で潰してあります)

実行環境
Windows XP SP2
JDK 1.5.0_11
Seasar 2.4.9
S2Dao 1.0.40
Eclipse 3.2.1
MS SQL Server 2005 Express

--- 以下、出力されたログ ---------------------------------------
DEBUG 2007-02-17 14:51:48,218 [main] 物理的なコネクションを取得しました
DEBUG 2007-02-17 14:51:48,218 [main] 論理的なコネクションを取得しました
DEBUG 2007-02-17 14:51:48,250 [main] 論理的なコネクションを閉じました
DEBUG 2007-02-17 14:51:48,250 [main] 論理的なコネクションを取得しました
DEBUG 2007-02-17 14:51:48,265 [main] 物理的なコネクションを取得しました
DEBUG 2007-02-17 14:51:48,265 [main] 論理的なコネクションを取得しました
DEBUG 2007-02-17 14:51:48,265 [main] 論理的なコネクションを閉じました
DEBUG 2007-02-17 14:52:09,656 [main] 論理的なコネクションを閉じました
DEBUG 2007-02-17 14:52:09,703 [main] SELECT DEPT.deptno, DEPT.dname,
DEPT.versionno, DEPT.loc FROM DEPT WHERE  DEPT.deptno = 99 AND
DEPT.dname = 'foo' AND DEPT.versionno = 0
DEBUG 2007-02-17 14:52:09,703 [main] 論理的なコネクションを取得しました
DEBUG 2007-02-17 14:52:09,859 [main] 論理的なコネクションを閉じました
before update versionNo:0
DEBUG 2007-02-17 14:52:09,859 [main] SELECT DEPT.deptno, DEPT.dname,
DEPT.versionno, DEPT.loc FROM DEPT WHERE  DEPT.deptno = 99 AND
DEPT.dname = 'bar' AND DEPT.versionno = 0
DEBUG 2007-02-17 14:52:09,859 [main] 論理的なコネクションを取得しました
DEBUG 2007-02-17 14:52:09,859 [main] 論理的なコネクションを閉じました
after update versionNo:0
DEBUG 2007-02-17 14:52:09,859 [main] SELECT DEPT.deptno, DEPT.dname,
DEPT.versionno, DEPT.loc FROM DEPT WHERE  DEPT.deptno = 99 AND
DEPT.dname = 'bar' AND DEPT.versionno = 0
DEBUG 2007-02-17 14:52:09,859 [main] 論理的なコネクションを取得しました
DEBUG 2007-02-17 14:52:09,859 [main] 論理的なコネクションを閉じました
DEBUG 2007-02-17 14:52:09,859 [main] 物理的なコネクションを閉じました
DEBUG 2007-02-17 14:52:09,859 [main] 物理的なコネクションを閉じました
-------------- next part --------------
<?xml version="1.0" encoding="Shift_JIS"?>
<!DOCTYPE components PUBLIC "-//SEASAR2.1//DTD S2Container//EN"
	"http://www.seasar.org/dtd/components21.dtd">
<components namespace="dao">
	<include path="j2ee-sqlserver2005.dicon"/>
	<component
		class="org.seasar.dao.impl.FieldAnnotationReaderFactory"/>
	<component
		class="org.seasar.dao.impl.DaoMetaDataFactoryImpl">
		<property name="sqlFileEncoding">"MS932"</property>
	</component>
	<component name="interceptor"
		class="org.seasar.dao.interceptors.S2DaoInterceptor"/>
	<component
		class="org.seasar.dao.impl.ValueTypeFactoryImpl"/>
	<component class="org.seasar.dao.impl.BeanMetaDataFactoryImpl"/>
	<component class="org.seasar.dao.impl.DaoNamingConventionImpl">
		<property name="insertPrefixes">new String[]{"generate"}</property>
		<property name="deletePrefixes">new String[]{"destory"}</property>
		<property name="updatePrefixes">new String[]{"change"}</property>
	</component>
	<component class="org.seasar.dao.impl.BeanEnhancerImpl"/>
</components>
-------------- next part --------------
USE [Stock]
GO
/****** 〓I〓u〓W〓F〓N〓g:  Table [dbo].[DEPT]    〓X〓N〓〓〓v〓g〓〓〓t: 02/17/2007 16:17:48 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DEPT](
	[deptno] [int] NULL,
	[dname] [nchar](10) COLLATE Japanese_CI_AS NULL,
	[loc] [nchar](10) COLLATE Japanese_CI_AS NULL,
	[versionNo] [int] NULL
) ON [PRIMARY]
-------------- next part --------------
<?xml version="1.0" encoding="Shift_JIS"?>
<!DOCTYPE components PUBLIC "-//SEASAR2.1//DTD S2Container//EN"
	"http://www.seasar.org/dtd/components21.dtd">
<components namespace="j2ee">
	<component name="transactionManager"
		class="org.seasar.extension.jta.TransactionManagerImpl"/>
	<component name="requiredTx"
		class="org.seasar.extension.tx.RequiredInterceptor"/>
	<component name="requiresNewTx"
		class="org.seasar.extension.tx.RequiresNewInterceptor"/>
	<component name="mandatoryTx"
		class="org.seasar.extension.tx.MandatoryInterceptor"/>
	<component name="notSupportedTx"
		class="org.seasar.extension.tx.NotSupportedInterceptor"/>
		
	<component 
		name="resultSetFactory"
		class="org.seasar.dao.pager.PagerResultSetFactoryWrapper">
		<arg>
			<component class="org.seasar.extension.jdbc.impl.BasicResultSetFactory"/>
		</arg>
		<property name="useScrollCursor">true</property>
	</component>
	<!--
	<component 
		name="resultSetFactory"
		class="org.seasar.dao.pager.PagerResultSetFactoryLimitOffsetWrapper">
		<arg>
			<component class="org.seasar.extension.jdbc.impl.BasicResultSetFactory"/>
		</arg>
		<arg>dataSource</arg>
	</component>
	-->

	<component class="org.seasar.extension.jdbc.impl.ConfigurableStatementFactory">
		<arg>
			<component class="org.seasar.dao.pager.PagerStatementFactory"/>
		</arg>
		<property name="fetchSize">100</property>
		<!--
		<property name="maxRows">100</property>
		-->
	</component>

	<!--
	<component class="org.seasar.extension.jdbc.impl.BasicResultSetFactory"/>
	<component class="org.seasar.extension.jdbc.impl.ConfigurableStatementFactory">
		<arg>
			<component class="org.seasar.extension.jdbc.impl.BasicStatementFactory"/>
		</arg>
		<property name="fetchSize">100</property>
		<! - -
		<property name="maxRows">100</property>
		- - >
	</component>
	<component class="org.seasar.extension.jdbc.impl.OracleResultSetFactory"/>
	<component class="org.seasar.extension.jdbc.impl.BooleanToIntStatementFactory"/>
	-->

	<!--
	<component name="xaDataSource"
		class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
		<property name="driverClassName">
			"oracle.jdbc.driver.OracleDriver"
		</property>
		<property name="URL">
			"jdbc:oracle:thin:@xxx:1521:xxx"
		</property>
		<property name="user">"xxx"</property>
		<property name="password">"xxx"</property>
	</component>

	<component name="xaDataSource"
		class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
		<property name="driverClassName">
			"org.postgresql.Driver"
        </property>
        <property name="URL">
          "jdbc:postgresql://localhost/TEST"
        </property>
        <property name="user">"xxxx"</property>
        <property name="password">"xxxx"</property>
    </component>

	<component name="xaDataSource"
		class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
		<property name="driverClassName">
			"net.sourceforge.jtds.jdbc.Driver"
        </property>
        <property name="URL">
            "jdbc:jtds:sqlserver://localhost/TEST;instance=SQLEXPRESS"
        </property>
        <property name="user">"xxxx"</property>
        <property name="password">"xxxx"</property>
    </component>
	-->
	
	<!-- SQL Server 2005 Express -->
	<component name="xaDataSource"
		class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
		<property name="driverClassName">
			"com.microsoft.sqlserver.jdbc.SQLServerDriver"
		</property>
		<property name="URL">
			<!--
			"jdbc:hsqldb:hsql://localhost:9001"
			-->
			"jdbc:sqlserver://localhost\\SQLEXPRESS;database=Stock"
		</property>
		<property name="user">"aono"</property>
		<property name="password">"***"</property>
		<!--<initMethod>#out.println(@[E-MAIL ADDRESS DELETED]("s2dao").getAbsolutePath())</initMethod>-->
	</component>
	
	<component name="connectionPool"
		class="org.seasar.extension.dbcp.impl.ConnectionPoolImpl">
		<property name="timeout">600</property>
		<property name="maxPoolSize">10</property>
		<!-- JTA〓g〓〓〓〓〓U〓N〓V〓〓〓〓〓〓〓J〓n〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓R〓l〓N〓V〓〓〓〓〓〓
		     〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓v〓〓〓p〓e〓B〓〓false〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓D-->
		<property name="allowLocalTx">true</property>
		<destroyMethod name="close"/>
	</component>
	<component name="dataSource"
		class="org.seasar.extension.dbcp.impl.DataSourceImpl"/>
	
	<!-- WebLogic
	<component name="initialContext" class="javax.naming.InitialContext"/>
	<component name="transactionManager"
	    class="org.seasar.extension.j2ee.JndiTransactionManager">
	    <arg>initialContext</arg>
	    <arg>"javax.transaction.TransactionManager"</arg>
	</component>
	<component
	    class="org.seasar.extension.j2ee.JndiDataSource">
	    <arg>initialContext</arg>
	    <arg>"jndiName"</arg>
	</component>
	-->
	
	<!-- WebSphere 4
	<component name="initialContext" class="javax.naming.InitialContext"/>
	<component name="transactionManager"
		class="org.seasar.extension.j2ee.SingletonTransactionManager">
		<arg>"com.ibm.ejs.jts.jta.JTSXA"</arg>
		<arg>"getTransactionManager"</arg>
	</component>
	<component
		class="org.seasar.extension.j2ee.JndiDataSource">
		<arg>initialContext</arg>
		<arg>"jndiName"</arg>
	</component>
	-->
	
	<!-- WebSphere 5
	<component name="initialContext" class="javax.naming.InitialContext"/>
	<component name="transactionManager"
		class="org.seasar.extension.j2ee.SingletonTransactionManager">
		<arg>"com.ibm.ejs.jts.jta.TransactionManagerFactory"</arg>
		<arg>"getTransactionManager"</arg>
	</component>
	<component
		class="org.seasar.extension.j2ee.JndiDataSource">
		<arg>initialContext</arg>
		<arg>"jndiName"</arg>
	</component>
	-->
	
	<!-- JBoss
	<component name="initialContext" class="javax.naming.InitialContext"/>
	<component name="transactionManager"
		class="org.seasar.extension.j2ee.JndiTransactionManager">
		<arg>initialContext</arg>
		<arg>"java:/TransactionManager"</arg>
	</component>
	<component
		class="org.seasar.extension.j2ee.JndiDataSource">
		<arg>initialContext</arg>
		<arg>"jndiName"</arg>
	</component>
	-->
	
	<!-- Oracle10gAS
	<component name="initialContext" class="javax.naming.InitialContext"/>
	<component name="transactionManager"
    	class="org.seasar.extension.j2ee.JndiTransactionManager">
    	<arg>initialContext</arg>
    	<arg>"java:comp/UserTransaction"</arg>
	</component>
	<component
    	class="org.seasar.extension.j2ee.JndiDataSource">
    	<arg>initialContext</arg>
    	<arg>"jndiName"</arg>
	</component>
	-->
</components>


Seasar-user メーリングリストの案内