Database Jones

raw JSON →
1.2.8 verified Sat Apr 25 auth: no javascript maintenance

A Node.js database mapping framework (version 1.2.8) that provides a session-based API for CRUD operations, transactions, and query building. It offers flexible object-relational mapping with support for MySQL and MySQL Cluster (NDB), using Promises/A+ and connection pooling. The project appears to be in early development (sparse releases, incomplete docs) and is distinguished by its session abstraction and adherence to standard JavaScript objects. Notable version: 1.2.8 released 2014-10-06. Competing with Sequelize and Bookshelf, but less mature.

error Error: Cannot find module 'mysql'
cause The mysql adapter is not installed.
fix
npm install mysql
error TypeError: Cannot read property 'then' of undefined
cause Called openSession without providing ConnectionProperties or with invalid adapter name.
fix
Ensure you create a valid ConnectionProperties and pass it to openSession.
deprecated Package has not been updated since 2014 and uses old patterns (callbacks, no TypeScript).
fix Consider using a modern ORM like Sequelize or Prisma.
gotcha Session factories must be closed explicitly with closeAllOpenSessionFactories() to avoid hanging connections.
fix Always call jones.closeAllOpenSessionFactories() after all sessions complete.
gotcha The mysql adapter requires the 'mysql' npm package as a peer dependency; not automatically installed.
fix Run: npm install mysql
npm install database-jones
yarn add database-jones
pnpm add database-jones

Opens a session, stores a simple object into a MySQL table, then closes all session factories.

const jones = require('database-jones');
const props = new jones.ConnectionProperties('mysql');
props.host = 'localhost';
props.port = 3306;
props.user = 'root';
props.password = process.env.DB_PASSWORD ?? '';
props.database = 'test';

jones.openSession(props).then(session => {
  const user = { id: 1, name: 'Database Jones'};
  return session.persist('user', user);
}).then(() => {
  console.log('Persisted successfully');
  jones.closeAllOpenSessionFactories();
}).catch(err => {
  console.error('Error:', err);
  jones.closeAllOpenSessionFactories();
});