Skip to content

Instantly share code, notes, and snippets.

AnnotationConfiguration cfg = new AnnotationConfiguration();
cfg.configure();
cfg.addAnnotatedClass(Produto.class);
cfg.addAnnotatedClass(Categoria.class);
// ...
SessionFactory factory = cfg.buildSessionFactory();
Session session = factory.openSession();
// ...
$ jruby -J-Xss256k -d -e "require 'java'; require 'servlet-api-2.5.jar'; module A; include Java::JavaxServletHttp::HttpServletResponse; end"
/Users/fck/Development/Ruby/jruby-1.1.4/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/module.rb:16 warning: instance variable @java_aliases not initialized
/Users/fck/Development/Ruby/jruby-1.1.4/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/module.rb:16 warning: instance variable @java_aliases not initialized
/Users/fck/Development/Ruby/jruby-1.1.4/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/module.rb:16 warning: instance variable @java_aliases not initialized
/Users/fck/Development/Ruby/jruby-1.1.4/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/module.rb:16 warning: instance variable @java_aliases not initialized
Error: Your application used more stack memory than the safety cap of 256k.
Specify -J-Xss####k to increase it (#### = cap size in KB).
Exception trace follows:
java.lang.StackOverflowError
at java.util.concurrent.locks.Reent
@Entity
public class Carro {
// ...
}
public class Bicicleta {
@Transient
private double velocity;
}
public class Sistema {
@EnviaEmail(Emails.CONFIRMACAO)
public void cadastra(Usuario usuario) {
//...
}
}
public class Sistema {
public void cadastra(Usuario usuario) {
mensageiro.enviaEmail(Emails.CONFIRMACAO, usuario);
// ...
}
}
<path id="lib.classpath">
<pathelement location="${build.lib.dir}/retroweaver-2.0.5.jar"/>
<pathelement location="${build.lib.dir}/retroweaver-rt-2.0.5.jar"/>
<pathelement location="${build.lib.dir}/backport-util-concurrent.jar"/>
<pathelement location="/usr/java/j2sdk1.4.2_16/jre/lib/rt.jar" />
<pathelement location="${lib.dir}/bsf.jar" />
</path>
@fabiokung
fabiokung / CaelumWebAppDeployer.java
Created December 17, 2008 01:31
WebAppDeployer for jetty, which supports different war folders for different virtual hosts
// WebAppDeployer for jetty, which supports different war folders for different virtual hosts
package br.com.caelum.jetty;
import java.util.ArrayList;
import org.mortbay.component.AbstractLifeCycle;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.HandlerContainer;
import org.mortbay.jetty.deployer.WebAppDeployer;
def method_missing(name, *args)
puts "<#{name}>#{args[0]}"
yield if block_given?
puts "</#{name}>"
end
html do
body do
h1 "My internal DSL"
div do
@fabiokung
fabiokung / cucumber_with_selenium.rake
Created March 4, 2009 08:31
Rake tasks for cucumber with selenium and pure webrat
require 'cucumber/rake/task'
namespace :cucumber do
Cucumber::Rake::Task.new(:plain) do |t|
t.cucumber_opts = "--format pretty"
t.step_list = %w{features/support/env.rb features/support/plain.rb features/step_definitions}
t.feature_list = %w{features/plain}
end
task :plain => 'db:test:prepare'