Skip to content

mailgpa/rhino-orm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 

Repository files navigation

The quick and dirty JavaScript wrapper for the popular Java ORM library Hibernate to be used in Rhino scripts.

Inspired by ringo-hibernate package for RingoJS

##Requirements

  • Rhino - "Rhino is an open-source implementation of JavaScript written entirely in Java"
  • or vert.x - "Effortless asynchronous application development for the modern web and enterprise"
  • or RingoJS - "Ringo is a CommonJS-based JavaScript runtime written in Java and based on the Mozilla Rhino JavaScript engine."
  • Hibernate in CLASSPATH

##Examples

###Initializing ORM object:

var ORM = require('orm').ORM,
orm = new ORM({
  // Hibernate configuration options
  config: {
    "hibernate.connection.driver_class": "org.h2.Driver",
    "hibernate.connection.url": "jdbc:h2:db/test;AUTO_SERVER=TRUE",
    "hibernate.connection.username": "sa",
    "hibernate.connection.password": "",
    "hibernate.show_sql": "true",
    "hibernate.hbm2ddl.auto": "update",
  },
  // HBM mappings from CLASSPATH
  resources: ['mappings.hbm.xml']
});

###Persisting object:

var result = orm.entityWrapper('City', {'name': 'Lipetsk', 'area': 'Lipetskaya obl.'}, function (session, data) {
  return session.merge(data);
});

##To-Do

  • Tests!

##License and Contact

License: MIT (http://www.opensource.org/licenses/mit-license.php)

Pavel Goloborodko
https://github.com/mailgpa
[email protected]

About

HIbernate wrapper for Rhino/vert.x/RingoJS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published