Permalink
Browse files

get dm-hibernate-adapter to work with benchmark

  • Loading branch information...
1 parent 38fe910 commit be2bb03f2a81294361827025b7cffcd1235418c1 @mkristian committed Jun 25, 2010
Showing with 104 additions and 12 deletions.
  1. +1 −0 .gitignore
  2. +4 −3 README.md
  3. +8 −9 lib/fake_blood/orm/dm_do.rb
  4. +80 −0 pom.xml
  5. +11 −0 src/main/resources/log4j.properties
View
@@ -0,0 +1 @@
+target
View
@@ -1,4 +1,5 @@
-* cd fake_blood/lib/fake_blood/orm/
-* edit connection properties in dm_do.rb (will be moved to other file)
-* jruby dm_do.rb
+* switch sql logging on/off see src/main/resources/log4j.properties
+* edit connection properties in lib/fake_blood/orm/dm_do.rb (will be moved to other file)
+* mvn gem:exec -Dexec.file=lib/fake_blood/orm/dm_do.rb # needs maven3
+
@@ -1,4 +1,4 @@
-require 'base'
+require File.join(File.dirname(__FILE__), 'base')
require "rubygems" # rm that
require 'dm-core'
require 'dm-migrations'
@@ -31,13 +31,12 @@ class Party
def self.setup( opts = {})
connection_options = opts[:connection_options] ||
- {
- :orm => "data_mapper",
- :adapter => "mysql",
- :host => "localhost",
- :database => "simple_orm_benchmark",
- :user => "root",
- :password => "root"
+ {
+ :orm => "data_mapper",
+ :adapter => "hibernate",
+ :dialect => "H2",
+ :username => "sa",
+ :url => "jdbc:h2:target/simple_orm_benchmark_h2"
}
# DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, connection_options)
@@ -451,4 +450,4 @@ def run_opt()
end
end
-DataMapperOrm.finalize()
+DataMapperOrm.finalize()
View
80 pom.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.example</groupId>
+ <artifactId>bench</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <repositories>
+ <repository>
+ <id>saumya</id>
+ <url>http://mojo.saumya.de/</url>
+ <snapshots><enabled>true</enabled></snapshots>
+ </repository>
+ <repository>
+ <id>rubygems-releases</id>
+ <url>http://gems.saumya.de/releases</url>
+ <!-- in case you need to use a local gem-proxy -->
+<!--
+ <url>http://localhost:8080/releases</url>
+ -->
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>dm-hibernate-adapter</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <type>gem</type>
+ </dependency>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>dm-migrations</artifactId>
+ <version>${dm.version}</version>
+ <type>gem</type>
+ </dependency>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>dm-transactions</artifactId>
+ <version>${dm.version}</version>
+ <type>gem</type>
+ </dependency>
+ <!-- database for hibernate -->
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>1.2.128</version>
+ </dependency>
+ <!-- logging for hibernate -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.5.2</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <jruby.plugins.version>0.20.0-SNAPSHOT</jruby.plugins.version>
+ <dm.version>1.0.0</dm.version>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>de.saumya.mojo</groupId>
+ <artifactId>gem-maven-plugin</artifactId>
+ <version>${jruby.plugins.version}</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
@@ -0,0 +1,11 @@
+log4j.rootCategory=warn, stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=(%c) - %m%n
+
+log4j.category.org.hibernate=warn
+log4j.category.org.hibernate.SQL=debug
+log4j.category.DataMapper=debug
+log4j.category.DataMapper.Adapters.HibernateAdapter=warn
+log4j.category.Hibernate=debug
+log4j.category.Hibernate.Model=info

0 comments on commit be2bb03

Please sign in to comment.