Hibernate version:
3.2.5
Mapping documents:
<hibernate-mapping package="test">
<class name="Data" table="DATA">
<id name="id" column="ID" access="field" type="long">
<generator class="native"/>
</id>
<property name="value" type="string" length="256"
column="VALUE" access="field" not-null="false"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Data data = new Data("test value");
userTransaction.begin();
StatelessSession session = remoteSessionFactory.openStatelessSession();
session.insert(data);
userTransaction.commit();
session.close();
Name and version of the database you are using:
RDBMS: Oracle, version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
JDBC driver: Oracle JDBC driver, version: 10.2.0.3.0
Dialect - Using dialect: org.hibernate.dialect.Oracle10gDialect
The generated SQL (show_sql=true):
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: insert into DATA (VALUE, ID) values (?, ?)
Question:
Isn't StatelessSession interface suppose to use JDBC level inserts? When using MS SQL, the behavior is as expected, only a single insert is created. In this case an extra select is generated for every insert, is there anyway to get around that?
|