Changeset 6298
- Timestamp:
- 01/04/07 19:11:04
- Files:
-
- trunk/lib/jerbil/hibernate_task.rb (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jerbil/hibernate_task.rb
r6192 r6298 29 29 # serialized as a list of strings (YAML format). 30 30 attr_accessor :entities_yml 31 32 # a file containing a map of properties, property names are keys in the map, and 33 # property values are values in the map 34 attr_accessor :properties_yml 31 35 32 36 # Classname implementing the db dialect, defaults to … … 52 56 @schemafile = "schema.sql" 53 57 @entities_yml = "entities.yml" 58 @properties_yml = nil 54 59 @dialect = "org.hibernate.dialect.MySQL5Dialect" 55 60 … … 68 73 entities = entities.dup.select { |e| @classfilter.call(e) } if @classfilter 69 74 entity_classes = entities.map {|klass| Rjb::import(klass)} 70 71 cfg = get_config(entity_classes, package) 75 76 properties = (YAML.load_file(@properties_yml) if @properties_yml) || {} 77 78 cfg = get_config(entity_classes, properties, package) 72 79 sql = cfg.generateSchemaCreationScript(Rjb::import(dialect).new) 73 80 … … 100 107 101 108 protected 102 def get_config(classes, p ackage=nil)109 def get_config(classes, properties, package=nil) 103 110 anncfg = Rjb::import('org.hibernate.cfg.AnnotationConfiguration') 104 111 acfg = anncfg.new … … 114 121 packages.each { |pkg| acfg.addPackage(pkg) } 115 122 123 properties.each do |key,value| 124 acfg.setProperty(key, value) 125 end 126 116 127 acfg 117 128 end
