Giter Site home page Giter Site logo

cockroachdb / examples-orms Goto Github PK

View Code? Open in Web Editor NEW
83.0 50.0 38.0 900 KB

Sample uses of CockroachDB with popular ORMs

License: Apache License 2.0

Makefile 4.56% Go 38.09% Java 20.51% Python 13.00% JavaScript 3.70% Ruby 17.84% HTML 0.16% Shell 1.44% Dockerfile 0.69%
orm cockroachdb sql

examples-orms's Introduction

Cockroach ORM examples

This repo contains example uses of CockroachDB with popular ORMs. Each example will implement the sample application spec presented below.

See the CockroachDB ORM Compatibility Plan for a roadmap towards supporting various ORMs.

Installation

Clone this repo into your $GOPATH manually, e.g.,

$ cd ~/go/src/github.com/cockroachdb
$ git clone https://github.com/cockroachdb/examples-orms

This is required because this project uses Go to drive the automated tests, so it will look for things in your $GOPATH. If you try to clone it to a non-$GOPATH directory, it will fail roughly as follows:

$ cd ~/some/random/dir/examples-orms
$ make test
go test -v -i ./testing
testing/api_handler.go:13:2: cannot find package "github.com/cockroachdb/examples-orms/go/gorm/model" in any of:
	/usr/local/Cellar/go/1.10/libexec/src/github.com/cockroachdb/examples-orms/go/gorm/model (from $GOROOT)
	/Users/rloveland/go/src/github.com/cockroachdb/examples-orms/go/gorm/model (from $GOPATH)
testing/api_handler.go:11:2: cannot find package "github.com/pkg/errors" in any of:
	/usr/local/Cellar/go/1.10/libexec/src/github.com/pkg/errors (from $GOROOT)
	/Users/rloveland/go/src/github.com/pkg/errors (from $GOPATH)
make: *** [test] Error 1

However, this is not actually a Go project, so go get -d will also fail (hence the need to manually clone).

$ go get -d github.com/cockroachdb/examples-orms
package github.com/cockroachdb/examples-orms: no Go files in /Users/rloveland/go/src/github.com/cockroachdb/examples-orms

Testing

To run automated testing against all ORMs using the latest binary of CockroachDB, run:

$ make test

To run automated testing against all ORMs using a custom CockroachDB binary, run:

$ make test COCKROACH_BINARY=/path/to/binary/cockroach

To run automated testing against a specific ORM, you can also specify the name with:

$ make test COCKROACH_BINARY=/path/to/binary/cockroach TESTS=TestSequelize/password

These tests require dependencies to be installed on your system. You can install them with:

$ make deps

While running tests locally, you may find it useful to comment out the lines in the Makefile that install the dependencies for a tool that you don't want to test.

A final option is to run using docker, so that a reproducible build environment is used.

$ make dockertest COCKROACH_BINARY=/path/to/binary/cockroach

Project Structure

The repository contains a set of directories named after programming languages. Beneath these language directories are sub-directories named after specific ORM used for example application implementations.

Each ORM example uses whatever build tool is standard for the language, but provides a standardized Makefile with a start rule, which will start an instance of the sample application.

For instance, the directory structure for an example application of the Hibernate ORM will look like:

java
└── hibernate
    ├── Makefile
    └── example_source

Sample App

The sample application which each example implements is a JSON REST API modeling a company with customers, products, and orders. The API exposes access to the management of this company.

The purpose of the example application is to test common data access patterns so that we can stress various features and implementation details of each language/ORM.

Schema

An ideal schema diagram for the sample application looks like:

Customer
  |
  v
Order  <->  Product

The schema is implemented by each application using ORM-specific constructs to look as close as possible to:

CREATE DATABASE IF NOT EXISTS company_{language}_{ORM};

CREATE TABLE IF NOT EXISTS customers (
  id           SERIAL PRIMARY KEY,
  name         STRING
);

CREATE TABLE IF NOT EXISTS orders (
  id           SERIAL PRIMARY KEY,
  subtotal     DECIMAL(18,2)
  customer_id  INT    REFERENCES customers(id),
);

CREATE TABLE IF NOT EXISTS products (
  id           SERIAL PRIMARY KEY,
  name         STRING,
  price        DECIMAL(18,2)
);

CREATE TABLE IF NOT EXISTS product_orders (
  id           SERIAL PRIMARY KEY,
  product_id   INT    REFERENCES products(id),
  order_id     INT    REFERENCES orders(id) ON DELETE CASCADE
);

JSON API

Each example will expose a RESTful JSON API. The endpoints and example curl command lines are:

GET    /customer
    curl http://localhost:6543/customer

GET    /customer/:id
    curl http://localhost:6543/customer/1

POST   /customer
    curl -X POST -d '{"id": 1, "name": "bob"}' http://localhost:6543/customer

PUT    /customer/:id
    curl -X PUT -d '{"id": 2, "name": "robert"}' http://localhost:6543/customer/1

DELETE /customer
    curl -X DELETE http://localhost:6543/customer/1

GET    /product
    curl http://localhost:6543/product

GET    /product/:id
    curl http://localhost:6543/product/1

POST   /product
    curl -X POST -d '{"id": 1, "name": "apple", "price": 0.30}' http://localhost:6543/product

PUT    /product
DELETE /product

GET    /order
    curl http://localhost:6543/order

GET    /order/:id
    curl http://localhost:6543/order/1

POST   /order
    curl -X POST -d '{"id": 1, "subtotal": 18.2, "customer": {"id": 1}}' http://localhost:6543/order

PUT    /order
DELETE /order

The semantics of each endpoint will be fleshed out when necessary.

Unresolved Questions

  • Can the schema be completely standardized across ORMs without too much of a hassle with overriding default type and naming conventions?

examples-orms's People

Contributors

abarganier avatar apantel avatar arulajmani avatar asubiotto avatar benesch avatar bobvawter avatar bramgruneir avatar cuongdo avatar dependabot[bot] avatar dt avatar ericharmeling avatar irfansharif avatar jordanlewis avatar justinj avatar knz avatar lukaseder avatar nvanbenschoten avatar otan avatar rafiss avatar rail avatar rickystewart avatar rimadeodhar avatar rohany avatar solongordon avatar tamird avatar tbg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

examples-orms's Issues

Hibernate demo uses company_hibernate instead of the stated

CREATE DATABASE IF NOT EXISTS company_{language}_{ORM};

It uses the database company_hibernate..

Sep 21, 2017 4:40:15 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:524)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:470)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applyForeignKeys(AbstractSchemaMigrator.java:429)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:245)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:110)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:177)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:66)
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:309)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:445)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
at com.cockroachlabs.util.SessionUtil.(SessionUtil.java:64)
at com.cockroachlabs.util.SessionUtil.init(SessionUtil.java:68)
at com.cockroachlabs.Application.initHibernate(Application.java:33)
at com.cockroachlabs.Application.run(Application.java:28)
at com.cockroachlabs.Application.main(Application.java:24)
Caused by: org.postgresql.util.PSQLException: ERROR: database "company_hibernate" does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2284)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2003)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:200)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:424)

Examples should run against a secure cluster

I think this repo is awesome for providing code samples! However I think it should also aspire to show how to do things The Right Way (tm). Especially given that we print out a huge warning that says to users: "eat your vegetables".

My experience working on docs#631 so far is teaching me that (at least for Java) doing it the "right way" is quite complex! (But in the bad, uninteresting, fiddly and hard-to-get-right way, not in any of the good ways.)

I might be able to help with some PRs once I get through the docs issue and understand this a little better, but filing this to capture.

Python Asyncpg

I'm trying to use cockroach with asyncpg.

With plain connection it works like a charm. On the other hand using connection pool fails with the following error:

ERROR:sanic:Traceback (most recent call last):
  File "/Users/krisz/.pyenv/versions/miniconda3-latest/envs/ml3/lib/python3.6/site-packages/sanic/app.py", line 391, in handle_request
    response = await response
  File "/Users/krisz/Workspace/papi/papi/app.py", line 34, in accounts_create
    print(results)
  File "/Users/krisz/.pyenv/versions/miniconda3-latest/envs/ml3/lib/python3.6/site-packages/asyncpg/pool.py", line 257, in __aexit__
    await self.pool.release(con)
  File "/Users/krisz/.pyenv/versions/miniconda3-latest/envs/ml3/lib/python3.6/site-packages/asyncpg/pool.py", line 189, in release
    await connection.reset()
  File "/Users/krisz/.pyenv/versions/miniconda3-latest/envs/ml3/lib/python3.6/site-packages/asyncpg/connection.py", line 412, in reset
    ''')
  File "/Users/krisz/.pyenv/versions/miniconda3-latest/envs/ml3/lib/python3.6/site-packages/asyncpg/connection.py", line 171, in execute
    return await self._protocol.query(query, timeout)
  File "asyncpg/protocol/protocol.pyx", line 255, in query (asyncpg/protocol/protocol.c:56799)
asyncpg.exceptions.InternalServerError: syntax error at or near "DO"

Caused by the resetting the connection :

await self.execute('''
            DO $$
            BEGIN
                PERFORM * FROM pg_listening_channels() LIMIT 1;
                IF FOUND THEN
                    UNLISTEN *;
                END IF;
            END;
            $$;
            SET SESSION AUTHORIZATION DEFAULT;
            RESET ALL;
            CLOSE ALL;
            SELECT pg_advisory_unlock_all();
        ''')

I don't know the exact solution, but I'd like to use Cockroach with asyncpg :)

Create table statement incorrect on front page

There needs to a common after the DECIMAL declaration.

root@:26257/company_java_hibernate> CREATE TABLE IF NOT EXISTS orders (
                             ->   id           SERIAL PRIMARY KEY,
                             ->   subtotal     DECIMAL(18,2)
                             ->   customer_id  INT    REFERENCES customers(id),
                             -> );
invalid syntax: statement ignored: syntax error at or near "customer_id"

Some issues with the Hibernate example

I'm currently translating some of the Java/Hibernate examples to jOOQ and found a few issues that you may or may not want to address:

CustomerService::deleteCustomer fails when orders have OrderProduct entries:

This query here:

Query deleteReferencing = session.createQuery("delete from Order where customer_id = :id");

Will fail in case there are entries in order_products, which does not have ON DELETE CASCADE clauses on its foreign keys by default (I think). I'm not sure if this is desired here.

OrderService::deleteOrder fails because of wrong query:

This query here:

Query deleteReferencing = session.createQuery("delete from Order where order_id = :id");

Will fail because the Order entity doesn't have an order_id column. I think the intention here was to delete the record in order_products

`npm` reports Sequelize vulnerability

Looks like we need to upgrade the version (apologies for not PR'ing that change, wanted to at least file the issue). However perhaps I'm not understanding this correctly, as I'm not really a JS developer.

$ cd examples-orms/node/sequelize
$ npm install
added 112 packages from 146 contributors and audited 226 packages in 2.523s
found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details


   ╭───────────────────────────────────────────────────────────────╮
   │                                                               │
   │       New minor version of npm available! 6.5.0 → 6.9.0       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.9.0   │
   │                  Run npm i -g npm to update!                  │
   │                                                               │
   ╰───────────────────────────────────────────────────────────────╯

$ npm audit 
=== npm audit security report ===                        
                                                                                
# Run  npm install [email protected]  to resolve 1 vulnerability
SEMVER WARNING: Recommended action is a potentially breaking change
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ NoSQL Injection                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ sequelize                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ sequelize                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ sequelize                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/820                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


found 1 high severity vulnerability in 226 scanned packages
  1 vulnerability requires semver-major dependency updates.

$ npm audit fix 
up to date in 0.42s
fixed 0 of 1 vulnerability in 226 scanned packages
  1 package update for 1 vuln involved breaking changes
  (use `npm audit fix --force` to install breaking changes; or refer to `npm audit` for steps to fix these manually)

Invalid syntax on database table, example should work against 1.0

Example should work against 1.0

CockroachDB node starting at 2017-09-21 14:26:59.087913381 -0500 CDT
build:      CCL v1.0.5 @ 2017/08/24 17:43:46 (go1.8.3)
admin:      http://jackburton:2800
sql:        postgresql://root@jackburton:26257?sslmode=disable
logs:       /home/wdroste/tmp/cockroach-data/logs
store[0]:   path=/home/wdroste/tmp/cockroach-data
status:     initialized new cluster
clusterID:  e21342a8-06c0-41a8-bde8-3c1230ed0d72
nodeID:     1




CREATE TABLE IF NOT EXISTS product_orders (
  id           SERIAL PRIMARY KEY,
  product_id   INT    REFERENCES products(id),
  order_id     INT    REFERENCES orders(id) ON DELETE CASCADE
);

invalid syntax: statement ignored: unimplemented at or near "cascade"

COCKROACH_BINARY does not work as expected

COCKROACH_BINARY does not work with "~" paths, and is relative to the testing folder (as opposed to the folder with the Makefile), which should be called out. While on the subject of documentation, we should make make dockertest a first class citizen, it's much better than asking someone looking to jump in to figure out all the ORM dependencies they need to install.

We should include a COCKROACH_BINARY usage example for both make test and make dockertest (which would rely on a linux build of CRDB).

Add elixir/ecto

If we supported Ecto, we could migrate our hosted Bors instance to use CockroachDB, which would be really neat.

Re-enable django tests in examples-orm

They were turned off here: #86

To fix it, I think the name of the github repo referenced by examples-orm needs to be updated.

Also, we need to figure out how to deal with different CockroachDB versions.

activerecord-cockroachdb-adapter is incompatible with newer versions of pg

I just tried adding activerecord-cockroachdb-adapter to my project which already had the pg 1.1.4 gem installed. Because the cockroachdb adapter seems to depend on the 0.2x versions as of 0.2.2, bundler installed 0.2.1 and it does not work:
NameError (uninitialized constant ActiveRecord::ConnectionHandling::PGconn)

I'm not willing to downgrade pg just to be able to use this gem. I need to connect to postgresql servers also. Can you please make it work with recent pg versions so I can have both in my project? For now I'll see how far I can get with just the pg gem to connect to cockroachdb.

make test fails, gradle can't ID java version

I have Gradle 4.7 installed on OS X via brew install gradle.

Output of java -version is

java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

Testing output is below. Strangely, it kept running after the java test failure for ~190 seconds (!) if I'm reading it correctly.

make test
go test -v -i ./testing
github.com/cockroachdb/examples-orms/go/gorm/model
github.com/cockroachdb/examples-orms/vendor/github.com/lib/pq/oid
github.com/cockroachdb/examples-orms/vendor/github.com/pkg/errors
github.com/cockroachdb/examples-orms/vendor/github.com/lib/pq
github.com/cockroachdb/examples-orms/vendor/github.com/cockroachdb/cockroach-go/testserver
go test -v -run "." ./testing 
=== RUN   TestGORM
2018/05/17 14:48:14 GET https://edge-binaries.cockroachdb.com/cockroach/cockroach.darwin-amd64.LATEST
2018/05/17 14:48:14 saving https://edge-binaries.cockroachdb.com/cockroach/cockroach.darwin-amd64.6d0c09aee9ff49ff0e6ba09bac86f5da90f9b63c to /var/folders/dc/78f3lsy51h5gxhvzrcf1hsmm0000gn/T/cockroach.darwin-amd64.6d0c09aee9ff49ff0e6ba09bac86f5da90f9b63c, this may take some time
2018/05/17 14:48:18 Using automatically-downloaded binary: /var/folders/dc/78f3lsy51h5gxhvzrcf1hsmm0000gn/T/cockroach.darwin-amd64.6d0c09aee9ff49ff0e6ba09bac86f5da90f9b63c
2018/05/17 14:48:18 process 63701 started: /var/folders/dc/78f3lsy51h5gxhvzrcf1hsmm0000gn/T/cockroach.darwin-amd64.6d0c09aee9ff49ff0e6ba09bac86f5da90f9b63c start --logtostderr --insecure --host=localhost --port=0 --http-port=0 --store=/tmp/cockroach-testserver493513716 --listening-url-file=/tmp/cockroach-testserver493513716/listen-url
=== RUN   TestGORM/FirstRun
=== RUN   TestGORM/FirstRun/GeneratedTables
=== RUN   TestGORM/FirstRun/GeneratedColumns
=== RUN   TestGORM/FirstRun/GeneratedColumns/OrdersTable
=== PAUSE TestGORM/FirstRun/GeneratedColumns/OrdersTable
=== RUN   TestGORM/FirstRun/GeneratedColumns/OrderProductsTable
=== PAUSE TestGORM/FirstRun/GeneratedColumns/OrderProductsTable
=== RUN   TestGORM/FirstRun/GeneratedColumns/CustomersTable
=== PAUSE TestGORM/FirstRun/GeneratedColumns/CustomersTable
=== RUN   TestGORM/FirstRun/GeneratedColumns/ProductsTable
=== PAUSE TestGORM/FirstRun/GeneratedColumns/ProductsTable
=== CONT  TestGORM/FirstRun/GeneratedColumns/OrdersTable
=== CONT  TestGORM/FirstRun/GeneratedColumns/CustomersTable
=== CONT  TestGORM/FirstRun/GeneratedColumns/ProductsTable
=== CONT  TestGORM/FirstRun/GeneratedColumns/OrderProductsTable
=== RUN   TestGORM/FirstRun/EmptyTables
=== RUN   TestGORM/FirstRun/EmptyTables/CustomersTable
=== PAUSE TestGORM/FirstRun/EmptyTables/CustomersTable
=== RUN   TestGORM/FirstRun/EmptyTables/ProductsTable
=== PAUSE TestGORM/FirstRun/EmptyTables/ProductsTable
=== RUN   TestGORM/FirstRun/EmptyTables/OrdersTable
=== PAUSE TestGORM/FirstRun/EmptyTables/OrdersTable
=== RUN   TestGORM/FirstRun/EmptyTables/OrderProductsTable
=== PAUSE TestGORM/FirstRun/EmptyTables/OrderProductsTable
=== CONT  TestGORM/FirstRun/EmptyTables/CustomersTable
=== CONT  TestGORM/FirstRun/EmptyTables/OrderProductsTable
=== CONT  TestGORM/FirstRun/EmptyTables/OrdersTable
=== CONT  TestGORM/FirstRun/EmptyTables/ProductsTable
=== RUN   TestGORM/FirstRun/RetrieveFromAPIBeforeCreation
=== RUN   TestGORM/FirstRun/RetrieveFromAPIBeforeCreation/Customers
=== PAUSE TestGORM/FirstRun/RetrieveFromAPIBeforeCreation/Customers
=== RUN   TestGORM/FirstRun/RetrieveFromAPIBeforeCreation/Products
=== PAUSE TestGORM/FirstRun/RetrieveFromAPIBeforeCreation/Products
=== RUN   TestGORM/FirstRun/RetrieveFromAPIBeforeCreation/Orders
=== PAUSE TestGORM/FirstRun/RetrieveFromAPIBeforeCreation/Orders
=== CONT  TestGORM/FirstRun/RetrieveFromAPIBeforeCreation/Customers
=== CONT  TestGORM/FirstRun/RetrieveFromAPIBeforeCreation/Orders
=== CONT  TestGORM/FirstRun/RetrieveFromAPIBeforeCreation/Products
=== RUN   TestGORM/FirstRun/CreateCustomer
=== RUN   TestGORM/FirstRun/CreateProduct
=== RUN   TestGORM/FirstRun/RetrieveFromAPIAfterInitialCreation
=== RUN   TestGORM/FirstRun/RetrieveFromAPIAfterInitialCreation/Customers
=== PAUSE TestGORM/FirstRun/RetrieveFromAPIAfterInitialCreation/Customers
=== RUN   TestGORM/FirstRun/RetrieveFromAPIAfterInitialCreation/Products
=== PAUSE TestGORM/FirstRun/RetrieveFromAPIAfterInitialCreation/Products
=== CONT  TestGORM/FirstRun/RetrieveFromAPIAfterInitialCreation/Customers
=== CONT  TestGORM/FirstRun/RetrieveFromAPIAfterInitialCreation/Products
=== RUN   TestGORM/FirstRun/CreateOrder
=== RUN   TestGORM/FirstRun/RetrieveFromAPIAfterDependentCreation
=== RUN   TestGORM/FirstRun/RetrieveFromAPIAfterDependentCreation/Order
=== PAUSE TestGORM/FirstRun/RetrieveFromAPIAfterDependentCreation/Order
=== CONT  TestGORM/FirstRun/RetrieveFromAPIAfterDependentCreation/Order
2018/05/17 14:48:19 waiting for app server port to become available
=== RUN   TestGORM/SecondRun
=== RUN   TestGORM/SecondRun/RetrieveFromAPIAfterRestart
=== RUN   TestGORM/SecondRun/RetrieveFromAPIAfterRestart/Customers
=== PAUSE TestGORM/SecondRun/RetrieveFromAPIAfterRestart/Customers
=== RUN   TestGORM/SecondRun/RetrieveFromAPIAfterRestart/Products
=== PAUSE TestGORM/SecondRun/RetrieveFromAPIAfterRestart/Products
=== RUN   TestGORM/SecondRun/RetrieveFromAPIAfterRestart/Order
=== PAUSE TestGORM/SecondRun/RetrieveFromAPIAfterRestart/Order
=== CONT  TestGORM/SecondRun/RetrieveFromAPIAfterRestart/Customers
=== CONT  TestGORM/SecondRun/RetrieveFromAPIAfterRestart/Order
=== CONT  TestGORM/SecondRun/RetrieveFromAPIAfterRestart/Products
2018/05/17 14:48:21 waiting for app server port to become available
--- PASS: TestGORM (7.99s)
    --- PASS: TestGORM/FirstRun (2.33s)
        --- PASS: TestGORM/FirstRun/GeneratedTables (0.00s)
        --- PASS: TestGORM/FirstRun/GeneratedColumns (0.00s)
            --- PASS: TestGORM/FirstRun/GeneratedColumns/OrdersTable (0.00s)
            --- PASS: TestGORM/FirstRun/GeneratedColumns/CustomersTable (0.01s)
            --- PASS: TestGORM/FirstRun/GeneratedColumns/ProductsTable (0.01s)
            --- PASS: TestGORM/FirstRun/GeneratedColumns/OrderProductsTable (0.01s)
        --- PASS: TestGORM/FirstRun/EmptyTables (0.00s)
            --- PASS: TestGORM/FirstRun/EmptyTables/ProductsTable (0.00s)
            --- PASS: TestGORM/FirstRun/EmptyTables/OrderProductsTable (0.00s)
            --- PASS: TestGORM/FirstRun/EmptyTables/CustomersTable (0.00s)
            --- PASS: TestGORM/FirstRun/EmptyTables/OrdersTable (0.00s)
        --- PASS: TestGORM/FirstRun/RetrieveFromAPIBeforeCreation (0.00s)
            --- PASS: TestGORM/FirstRun/RetrieveFromAPIBeforeCreation/Orders (0.01s)
            --- PASS: TestGORM/FirstRun/RetrieveFromAPIBeforeCreation/Products (0.01s)
            --- PASS: TestGORM/FirstRun/RetrieveFromAPIBeforeCreation/Customers (0.01s)
        --- PASS: TestGORM/FirstRun/CreateCustomer (0.01s)
        --- PASS: TestGORM/FirstRun/CreateProduct (0.00s)
        --- PASS: TestGORM/FirstRun/RetrieveFromAPIAfterInitialCreation (0.00s)
            --- PASS: TestGORM/FirstRun/RetrieveFromAPIAfterInitialCreation/Customers (0.00s)
            --- PASS: TestGORM/FirstRun/RetrieveFromAPIAfterInitialCreation/Products (0.00s)
        --- PASS: TestGORM/FirstRun/CreateOrder (0.01s)
        --- PASS: TestGORM/FirstRun/RetrieveFromAPIAfterDependentCreation (0.00s)
            --- PASS: TestGORM/FirstRun/RetrieveFromAPIAfterDependentCreation/Order (0.00s)
    --- PASS: TestGORM/SecondRun (1.27s)
        --- PASS: TestGORM/SecondRun/RetrieveFromAPIAfterRestart (0.00s)
            --- PASS: TestGORM/SecondRun/RetrieveFromAPIAfterRestart/Customers (0.00s)
            --- PASS: TestGORM/SecondRun/RetrieveFromAPIAfterRestart/Products (0.00s)
            --- PASS: TestGORM/SecondRun/RetrieveFromAPIAfterRestart/Order (0.00s)
=== RUN   TestHibernate
2018/05/17 14:48:22 GET https://edge-binaries.cockroachdb.com/cockroach/cockroach.darwin-amd64.LATEST
2018/05/17 14:48:22 Process 63701 exited with status -1
2018/05/17 14:48:22 signal: killed
2018/05/17 14:48:22 Using automatically-downloaded binary: /var/folders/dc/78f3lsy51h5gxhvzrcf1hsmm0000gn/T/cockroach.darwin-amd64.6d0c09aee9ff49ff0e6ba09bac86f5da90f9b63c
2018/05/17 14:48:22 process 63739 started: /var/folders/dc/78f3lsy51h5gxhvzrcf1hsmm0000gn/T/cockroach.darwin-amd64.6d0c09aee9ff49ff0e6ba09bac86f5da90f9b63c start --logtostderr --insecure --host=localhost --port=0 --http-port=0 --store=/tmp/cockroach-testserver436594883 --listening-url-file=/tmp/cockroach-testserver436594883/listen-url
=== RUN   TestHibernate/FirstRun

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '10.0.1'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
make[1]: *** [start] Error 1
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x129deba]

goroutine 145 [running]:
testing.tRunner.func1(0xc42013c4b0)
	/usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:742 +0x29d
panic(0x12ee340, 0x14fe2f0)
	/usr/local/Cellar/go/1.10/libexec/src/runtime/panic.go:505 +0x229
os.(*ProcessState).Pid(...)
	/usr/local/Cellar/go/1.10/libexec/src/os/exec_posix.go:66
github.com/cockroachdb/examples-orms/testing.initORMApp(0x134d2bb, 0x4, 0x134ea1f, 0x9, 0xc420180300, 0xc42013e2d0, 0x10d7c4d, 0x1421ba8)
	/Users/rloveland/go/src/github.com/cockroachdb/examples-orms/testing/main_test.go:132 +0x33a
github.com/cockroachdb/examples-orms/testing.testORM.func1(0xc42013c4b0)
	/Users/rloveland/go/src/github.com/cockroachdb/examples-orms/testing/main_test.go:158 +0x6b
testing.tRunner(0xc42013c4b0, 0xc420166410)
	/usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:777 +0xd0
created by testing.(*T).Run
	/usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:824 +0x2e0
FAIL	github.com/cockroachdb/examples-orms/testing	191.080s
make: *** [test] Error 1

Failed to start demo

WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:524)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:470)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applyForeignKeys(AbstractSchemaMigrator.java:429)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:245)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:110)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:177)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:66)
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:309)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:445)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
at com.cockroachlabs.util.SessionUtil.(SessionUtil.java:64)
at com.cockroachlabs.util.SessionUtil.init(SessionUtil.java:68)
at com.cockroachlabs.Application.initHibernate(Application.java:33)
at com.cockroachlabs.Application.run(Application.java:28)
at com.cockroachlabs.Application.main(Application.java:24)
Caused by: org.postgresql.util.PSQLException: ERROR: columns cannot be used by multiple foreign key constraints
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2284)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2003)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:200)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.