Class: Rubernate::Entity

Inherits:
Object
  • Object
show all
Includes:
Relations
Defined in:
lib/rubernate/entity.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Relations

included

Instance Attribute Details

#proxy_classObject

Returns the value of attribute proxy_class.



6
7
8
# File 'lib/rubernate/entity.rb', line 6

def proxy_class
  @proxy_class
end

Class Method Details

.allObject



12
13
14
# File 'lib/rubernate/entity.rb', line 12

def self.all()
  Connection.entity_manager.create_query("SELECT e FROM #{self} as e ").result_list
end

.by_hql(hql) ⇒ Object



16
17
18
# File 'lib/rubernate/entity.rb', line 16

def self.by_hql(hql)
  Connection.entity_manager.create_query(hql)
end

.find(id) ⇒ Object



8
9
10
# File 'lib/rubernate/entity.rb', line 8

def self.find(id)
  Connection.entity_manager.create_query("SELECT e FROM #{self} as e where e.id = :id").set_parameter(id).get_single_result
end