Skip to content

Commit

Permalink
Added few more supported types to specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Gega (pietia) committed Feb 14, 2010
1 parent 1103a38 commit 349699e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
7 changes: 5 additions & 2 deletions hibernate.rb
Expand Up @@ -97,7 +97,6 @@ def self.add_model(mapping)
mapping_file = mapping[/\w+.hbm.xml/] #produces ie. "Book.hbm.xml"
unless mapped?(mapping_file)
config.add_xml(File.read(mapping))
@mapped_classes ||= []
@mapped_classes << mapping_file
else
puts "mapping file/class registered already"
Expand All @@ -106,6 +105,7 @@ def self.add_model(mapping)

private
def self.mapped?(mapping_file)
@mapped_classes ||= []
if @mapped_classes.member?(mapping_file)
return true
else
Expand All @@ -114,10 +114,13 @@ def self.mapped?(mapping_file)
end

module Model
# TODO enhance TYPEs list
TYPES = {
:string => java.lang.String,
:long => java.lang.Long,
:date => java.util.Date
:integer => java.lang.Integer,
:date => java.util.Date,
:boolean => java.lang.Boolean
}

def hibernate_sigs
Expand Down
2 changes: 1 addition & 1 deletion lib/dm-hibernate-adapter.rb
Expand Up @@ -17,7 +17,7 @@ def initialize(name, options = {})
Hibernate.connection_password = ""
Hibernate.connection_pool_size = "1"
Hibernate.properties["hbm2ddl.auto"] = "update"
Hibernate.properties["format_sql"] = "true"
Hibernate.properties["format_sql"] = "false"
Hibernate.properties["show_sql"] = "true"
Hibernate.properties["cache.provider_class"] = "org.hibernate.cache.NoCacheProvider"
end
Expand Down
6 changes: 3 additions & 3 deletions spec/adapter_shared_spec.rb
Expand Up @@ -21,12 +21,12 @@ class ::Heffalump
property :id, Serial
property :color, String
# TODO add more supported types
# property :num_spots, Integer
# property :striped, Boolean
property :num_spots, Integer
property :striped, Boolean

# TODO
extend Hibernate::Model
hibernate_attr :id => :long, :color => :string
hibernate_attr :id => :long, :color => :string, :num_spots => :integer, :striped => :boolean
hibernate!
end

Expand Down
3 changes: 3 additions & 0 deletions spec/dm-hibernate-adapter_spec.rb
Expand Up @@ -12,4 +12,7 @@

it_should_behave_like 'An Adapter'

#TODO add hibernate specyfic specs
# it_should_behave_like 'An Hibernate Adapter'

end

0 comments on commit 349699e

Please sign in to comment.