Skip to content

Commit

Permalink
using session.doWork to avoid the use of insane session.connection
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasrodrigo committed Sep 30, 2011
1 parent 79e1987 commit 1bd31a4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
13 changes: 7 additions & 6 deletions lib/dm-hibernate-adapter.rb
Expand Up @@ -200,12 +200,13 @@ def delete(resources)

def execute_update(sql)
unit_of_work do |session|
con = session.connection
st = con.create_statement
begin
st.execute_update(sql)
ensure
st.close
session.do_work do |connection|
st = connection.create_statement
begin
st.execute_update(sql)
ensure
st.close
end
end
end
end
Expand Down
30 changes: 15 additions & 15 deletions pom.xml
Expand Up @@ -11,16 +11,16 @@
<name>mkristian</name>
<email>m.kristian@web.de</email>
</developer>
<developer>
<id>pietia_dot_moo_at_gmail_dot_com</id>
<name>Piotr Gęga</name>
<email>pietia.moo@gmail.com</email>
</developer>
<developer>
<id>douglasrodrigo_at_gmail_dot_com</id>
<name>Douglas Ferreira</name>
<email>douglasrodrigo@gmail.com</email>
</developer>
<developer>
<id>pietia_dot_moo_at_gmail_dot_com</id>
<name>Piotr Gęga</name>
<email>pietia.moo@gmail.com</email>
</developer>
</developers>
<repositories>
<repository>
Expand All @@ -29,7 +29,7 @@
</repository>
<repository>
<id>rubygems-releases</id>
<url>http://gems.saumya.de/releases</url>
<url>http://rubygems-proxy.torquebox.org/releases</url>
</repository>
</repositories>
<dependencies>
Expand Down Expand Up @@ -181,7 +181,7 @@
<gem.home>${project.build.directory}/rubygems</gem.home>
<gem.path>${project.build.directory}/rubygems</gem.path>
<jruby.jvmargs>-Xmx1024m</jruby.jvmargs>
<jruby.plugins.version>0.28.3</jruby.plugins.version>
<jruby.plugins.version>0.28.4</jruby.plugins.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
Expand All @@ -193,11 +193,11 @@
<version>${jruby.plugins.version}</version>
<extensions>true</extensions>
<configuration>
<files>lib/dm-hibernate-adapter.rb,lib/dm-hibernate-adapter,lib/dm-hibernate-adapter/dialects.rb,lib/dm-hibernate-adapter/hibernate.rb,lib/dm-hibernate-adapter/spec,lib/dm-hibernate-adapter/transaction.rb,lib/dm-hibernate-adapter/spec/setup.rb,spec/abstract_adapter,spec/dm_core,spec/log4j.properties,spec/transient,spec/abstract_adapter/adapter_shared_spec.rb,spec/abstract_adapter/dm-hibernate-adapter_spec.rb,spec/abstract_adapter/rcov.opts,spec/abstract_adapter/spec.opts,spec/abstract_adapter/spec_helper.rb,spec/dm_core/adapter_spec.rb,spec/dm_core/db,spec/dm_core/rcov.opts,spec/dm_core/spec.opts,spec/dm_core/spec_helper.rb,spec/transient/dm-hibernate-adapter_spec.rb,spec/transient/lib,spec/transient/rcov.opts,spec/transient/shared,spec/transient/spec.opts,spec/transient/spec_helper.rb,spec/transient/lib/adapter_helpers.rb,spec/transient/lib/collection_helpers.rb,spec/transient/lib/counter_adapter.rb,spec/transient/lib/pending_helpers.rb,spec/transient/lib/rspec_immediate_feedback_formatter.rb,spec/transient/shared/adapter_shared_spec.rb,spec/transient/shared/finder_shared_spec.rb,spec/transient/shared/model_spec.rb,spec/transient/shared/property_spec.rb,spec/transient/shared/resource_shared_spec.rb,spec/transient/shared/resource_spec.rb,spec/transient/shared/sel_shared_spec.rb</files>
<files>lib/dm-hibernate-adapter.rb,lib/dm-hibernate-adapter,lib/dm-hibernate-adapter/hibernate.rb,lib/dm-hibernate-adapter/spec,lib/dm-hibernate-adapter/spec/setup.rb,lib/dm-hibernate-adapter/spec/setup.rb.~master~,lib/dm-hibernate-adapter/spec/setup.rb.~d2393c0d5057a157181e090262c84e219ccf23eb~,lib/dm-hibernate-adapter/dialects.rb,lib/dm-hibernate-adapter/transaction.rb,spec/transient,spec/transient/spec_helper.rb,spec/transient/dm-hibernate-adapter_spec.rb,spec/transient/rcov.opts,spec/transient/shared,spec/transient/shared/model_spec.rb,spec/transient/shared/adapter_shared_spec.rb,spec/transient/shared/resource_spec.rb,spec/transient/shared/finder_shared_spec.rb,spec/transient/shared/resource_shared_spec.rb,spec/transient/shared/sel_shared_spec.rb,spec/transient/shared/property_spec.rb,spec/transient/lib,spec/transient/lib/counter_adapter.rb,spec/transient/lib/rspec_immediate_feedback_formatter.rb,spec/transient/lib/pending_helpers.rb,spec/transient/lib/collection_helpers.rb,spec/transient/lib/adapter_helpers.rb,spec/transient/spec.opts,spec/log4j.properties,spec/abstract_adapter,spec/abstract_adapter/spec_helper.rb,spec/abstract_adapter/dm-hibernate-adapter_spec.rb,spec/abstract_adapter/rcov.opts,spec/abstract_adapter/adapter_shared_spec.rb,spec/abstract_adapter/spec.opts,spec/dm_core,spec/dm_core/spec_helper.rb,spec/dm_core/rcov.opts,spec/dm_core/spec_helper.rb.~f32a364af03e64dfa8a2280242edb568c9d246c0~,spec/dm_core/spec.opts,spec/dm_core/adapter_spec.rb</files>
<includeOpenSSL>false</includeOpenSSL>
<platform>java</platform>
<requiredRubygemsVersion><![CDATA[> 1.3.1]]></requiredRubygemsVersion>
<testFiles>spec/abstract_adapter/adapter_shared_spec.rb,spec/abstract_adapter/dm-hibernate-adapter_spec.rb,spec/dm_core/adapter_spec.rb,spec/transient/dm-hibernate-adapter_spec.rb,spec/transient/shared/adapter_shared_spec.rb,spec/transient/shared/finder_shared_spec.rb,spec/transient/shared/model_spec.rb,spec/transient/shared/property_spec.rb,spec/transient/shared/resource_shared_spec.rb,spec/transient/shared/resource_spec.rb,spec/transient/shared/sel_shared_spec.rb</testFiles>
<testFiles>spec/transient/dm-hibernate-adapter_spec.rb,spec/transient/shared/model_spec.rb,spec/transient/shared/adapter_shared_spec.rb,spec/transient/shared/resource_spec.rb,spec/transient/shared/finder_shared_spec.rb,spec/transient/shared/resource_shared_spec.rb,spec/transient/shared/sel_shared_spec.rb,spec/transient/shared/property_spec.rb,spec/abstract_adapter/dm-hibernate-adapter_spec.rb,spec/abstract_adapter/adapter_shared_spec.rb,spec/dm_core/adapter_spec.rb</testFiles>
</configuration>
<executions>
<execution>
Expand Down Expand Up @@ -229,42 +229,42 @@
</build>
<profiles>
<profile>
<id>transient</id>
<id>dm</id>
<build>
<plugins>
<plugin>
<groupId>de.saumya.mojo</groupId>
<artifactId>rspec-maven-plugin</artifactId>
<configuration>
<specSourceDirectory>spec/transient</specSourceDirectory>
<specSourceDirectory>spec/dm_core</specSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>adapter</id>
<id>transient</id>
<build>
<plugins>
<plugin>
<groupId>de.saumya.mojo</groupId>
<artifactId>rspec-maven-plugin</artifactId>
<configuration>
<specSourceDirectory>spec/abstract_adapter</specSourceDirectory>
<specSourceDirectory>spec/transient</specSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>dm</id>
<id>adapter</id>
<build>
<plugins>
<plugin>
<groupId>de.saumya.mojo</groupId>
<artifactId>rspec-maven-plugin</artifactId>
<configuration>
<specSourceDirectory>spec/dm_core</specSourceDirectory>
<specSourceDirectory>spec/abstract_adapter</specSourceDirectory>
</configuration>
</plugin>
</plugins>
Expand Down

0 comments on commit 1bd31a4

Please sign in to comment.